Repository navigation
feat(runtime)!: refuse runtime package changes when replicas are declared on the Redis driver - #31751
Conversation
…s on the Redis driver The runtime package doors (install, enable, disable, duplicate, ensure-customization, manifest edit, delete) change only the replica that serves the request: the registry is read at boot and the enable/disable choice is kept per replica. When the deployment declares several replicas on the Redis cluster driver they now refuse with MULTI_REPLICA_PACKAGE_CHANGE_REFUSED (409) and the maintenance-window recipe, before anything is written. The flow and permission-set clone doors refuse only when the copy would create the source's paired customization package. The condition is service-cluster's declaresMultiReplicaOnRedis. Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
… doors; changeset Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
…the packages gate suite Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 32 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7d658ad2857e72f4fa3747debc1d4ea1cfae3ee0 && git checkout 7d658ad2857e72f4fa3747debc1d4ea1cfae3ee0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91 b14cd22b091c973347e070876eb7da5c6b7fac4b && git checkout -B drift-repro 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91 && git merge --no-ff b14cd22b091c973347e070876eb7da5c6b7fac4b
node scripts/docs-audit/affected-docs.mjs --json 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91
|
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract-review-claim: session_01ADHkmP8JJo4zF2sjTBRwnX · head 5eb211c · 2026-11-09T02:30Z |
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract reviewServed-tier: Faces: schema ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Tests, read as evidence only (lane seat's ACCEPT at Findings: 1 must-fix (④.2, Implemented-by: VERDICT: FAIL Stamped 2026-11-09T02:43Z. |
The clone doors' multi-replica probe spelled the pair as <base>.custom, while the ensure it guards lands in pairOf(base): the App's pair for a member of an installed App. Under declared replicas that refused a member whose App's pair exists and let through one whose legacy per-member pair exists. The probe now derives with pairOf over this replica's installed manifests. The ledger row's comment also says the walled-catalog refusal answers first. Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
…s optional Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract-review-claim: session_01ADHkmP8JJo4zF2sjTBRwnX · head fad89bd · 2026-11-09T04:00Z |
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract reviewServed-tier: Delta review of the round-1 fixes to record 6730977111 (head ① Derived judgments
② Semver levelUnchanged from the prior record: ③ Boundary flags
④ Design judgment
Tests, read as evidence only (lane seat's ACCEPT at Findings: 0 must-fix · 0 should-fix · 1 accepted deviation (④.7) · 1 follow-up card recommended (①.4, outside this PR). The round ends on this head. Implemented-by: VERDICT: PASS Stamped 2026-11-09T04:06Z. |
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX ACCEPT · PR #31751 · #31599 · 2026-11-09T04:35ZHead-sha:
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 42562814556 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Steve · project thread
Fixes #31599
Maintainer ruling D1 on cloud#3814: 「多副本时拒绝」. Claim 6727421428 (
domain:server#4, card-thread session_01ADHkmPnqZD15YnBkNbm1jJ), as amended by 6728532665; seat rulings A on the three open questions (one code, R6-style recipe wording, runtime's own ledger row).Clause-②: yes (narrowing) — narrowed: the seven runtime package doors (
POST /api/v1/packages,PATCH …/:id/enable,PATCH …/:id/disable,POST …/:id/duplicate,POST …/:id/ensure-customization,PATCH …/:id,DELETE …/:id) answer409 MULTI_REPLICA_PACKAGE_CHANGE_REFUSEDbefore anything is written when the deployment declares several replicas (OS_CLUSTER_REPLICASgreater than 1, orOS_EXPECT_MULTI_NODE=true) and the composed cluster service runs theredisdriver;POST /api/v1/automation/:name/cloneandPOST /api/v1/security/permission-sets/:name/cloneanswer the same only when their default landing would create the source's paired customization package on this replica. Measured by the ablation that removes the condition (the base behaviour): every refused door answered2xxand ran its writer on base. Every other topology is unchanged. Widened:ERROR_CODE_LEDGER(@objectstack/spec) registers the already-registered code under@objectstack/runtimetoo (one row per emitting package); nothing is removed or renamed. A registered ledger row is a published schema, so this PR takes aCONTRACT_REVIEW_TIERreview.Metadata-protocol: none
维护者速读
OS_CLUSTER_REPLICAS大于 1 或OS_EXPECT_MULTI_NODE=true)且集群驱动是 Redis 时,运行时的 7 个包门(安装、启用、停用、复制、确保定制包、改清单、删除)直接返回 409MULTI_REPLICA_PACKAGE_CHANGE_REFUSED,提示在维护窗口里单副本或用 CLI 操作、再重启所有副本;流程和权限集的"新建相似"只在需要新建配对定制包时才拒绝。packages/runtime/src/multi-replica-package-refusal.ts(新文件,复用 feat(cloud-connection)!: refuse marketplace install-local when multi-replica is declared (#3814 R6) #31602 落地的declaresMultiReplicaOnRedis);domains/packages.ts7 处调用点;automation.ts与permission-set-clone.ts的两处克隆门;账本新增的一行。pnpm --filter @objectstack/runtime exec vitest run src/domains/packages-capability-gate.test.ts src/domains/automation-flow-clone-custom-package.test.ts src/domains/permission-set-clone.test.ts—— 预期 209 passed,其中本卡新增 64 个。What changes
Step 0, the doors that change the package registry or the per-replica package state, read on
cae8d8fe:POST /packageshandlePackagesRequestinstall branchprotocolinstall orregistry.installPackage: a package in this replica's registryPATCH /:id/enable,/:id/disablewritePackageState: the host store, orOS_HOME/package-state/<env>.<project>.jsonon this replica's volume; then the registry switchPOST /:id/duplicateprotocol.duplicatePackage: a new packagePOST /:id/ensure-customizationprotocol.ensureCustomizationPackage: the pair packagePATCH /:idprotocol.updatePackage(sys_packages+ registry) orregistry.updatePackageManifestDELETE /:idregistry.uninstallPackage+sys_metadataremovalPOST /automation/:name/cloneresolveCloneTarget→land<base>.customwhen the default landing needs itPOST /security/permission-sets/:name/cloneresolveDefaultCloneLandingpackages/runtime/src/multi-replica-package-refusal.ts(new) —packageChangeReachesOneReplicareads the composedclusterservice's driver per request and asksdeclaresMultiReplicaOnRedis(process.env, driver)from@objectstack/service-cluster(landed by feat(cloud-connection)!: refuse marketplace install-local when multi-replica is declared (#3814 R6) #31602).refuseMultiReplicaPackageChangeanswers409with the code and the recipe ("make the change in a maintenance window: run it on a single replica or through the CLI, then restart every replica").multiReplicaPairCreationRefusalrefuses a clone only when this replica's registry does not hold the pair yet.packages/runtime/src/domains/packages.ts— the refusal at each of the seven doors right afterrequireManageMetadataand the walled-catalog refusal, before the body is judged or anything is read or written.packages/runtime/src/domains/automation.ts,permission-set-clone.ts— the pair-creation refusal right before the ensure. The flow door asks it insideland, after the engine has accepted the copy, so a refusal withdraws the registration as a refused landing already does; the permission-set door asks it through abeforeEnsurehook and throws a409the door's existing envelope renders.packages/spec/src/api/error-code-ledger.zod.ts—MULTI_REPLICA_PACKAGE_CHANGE_REFUSEDunder@objectstack/runtime(seat ruling: one row per emitting package, no second waiver). The code was already in the union, so no reference doc changes (check:docsgreen).describe:packages-capability-gate.test.ts(themake()fake kernel gains an optionalclusterservice),automation-flow-clone-custom-package.test.tsandpermission-set-clone.test.ts(eachbootgainsclusterDriver). No existing case changed..changeset/31599-runtime-package-doors-multi-replica-refusal.md—patchfor@objectstack/runtimeand@objectstack/spec; both declaration lines;adr-0087: not-required (no-migration-prescription); Before / Now / Unchanged / Who sees it.Tests
OS_CLUSTER_REPLICAS=3,OS_EXPECT_MULTI_NODE=true) onredis, each of the seven doors:409with the code, the message names the maintenance window and "restart every replica", none of the registry or protocol writers ran, andOS_HOMEstays empty (no package-state file). AnisSystemcaller is refused too; a caller withoutmanage_metadatastill gets the403first.redis,OS_CLUSTER_REPLICAS=1onredis, declared replicas on the in-process driver (escape hatch), declared replicas with no cluster service. On a single node, disable writesOS_HOME/package-state, so the "nothing written" check would see a write.redis.ObjectQL+ObjectStackProtocolImplementationrig):409when the pair is absent (no pair installed, nothing published, no row, the copy's registration withdrawn);200into an existing pair;200for an explicit writable target; CONTROLs on a single node and on the in-process driver.409when the pair is absent (no ensure, no save);200into an existing pair; environment-authored source and explicit target200with no ensure; CONTROLs on a single node, the in-process driver and no cluster service.Acceptance notes
commits/:commitId/revertand adopt-orphans write the shared metadata store, which every replica reads (and the metadata cluster bridge fans out). The CLI'sos plugin disable(plugin-installation-store) is the recipe's own path and is not an HTTP door.@objectstack/metadata-protocolare outside the claimed surface and are not touched.multiReplicaPackageChangeMessage.Verification
Head
5eb211c4(fix6a362f63, tests and changesetcecb6bff, the collection-time import the test-source-alias gate asks for5eb211c4), cut onorigin/maincae8d8fe;mainhas since moved 7 commits, none touching a file this PR changes.Suites (os-verify-lock, every VERDICT command-exit 0)
pnpm --filter @objectstack/runtime test: 563 files / 9117 passed, 19 skipped (cecb6bff);typecheckexit 0; the edited suite rerun on5eb211c4: 134 passed.pnpm --filter @objectstack/service-cluster test: 10 files / 128 tests.pnpm --filter @objectstack/spec test: 823 files / 26079 passed, 1 skipped, 1 todo.typecheck: exit 0 withNODE_OPTIONS=--max-old-space-size=8192; at the script's default 4096 itscheck:test-typecheckleg ran out of heap in this container before reporting (no diagnostics; the diff tospecis one ledger string).pnpm --filter @objectstack/spec check:docs: exit 0, 246 generated files in sync.pnpm --filter @objectstack/dogfood test(full battery, narrowing arm): 440 passed, 3 skipped files / 3652 passed, 41 skipped tests (5eb211c4).eslint --no-inline-config) onpackages/runtime/srcand the ledger file: exit 0.Ablations (negative pins)
scripts/ablation-replace.mjsoncecb6bff; the tests import the runtime fromsrc, so no rebuild leg.ABLATED_31599:packageChangeReachesOneReplicaalways answersfalse(the base behaviour). 19 of 209 red, exactly the refusal cases: 14 package-door cases (7 doors × 2 declarations), theisSystemcase, and the two clone doors × 2 declarations. Every CONTROL and every unchanged case green. Restored: blobaad86398== HEAD,git diff HEADempty.ABLATED_31599_PAIR: the existing-pair exemption removed. 2 of 75 red, exactly the two "pair already served is reused" cases. Restored, blob == HEAD.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 93 families, each run with stdin closed and its exit recorded;--ranreconciliation: "93 derived famil(ies) accounted for — 93 run, 0 NOT-MEASURED". All 93 exit 0, among themcheck:error-code-provenance,check:error-code-casing,check:dispatcher-error-vocabulary,check:error-status-conformance,check:route-envelopeandcheck:changeset-no-major. The first pass oncecb6bffhad fivespecsurface gates at exit 3 (nospecdeclarations built; green afterpnpm --filter @objectstack/spec build) andcheck:test-source-aliasred (the edited packages suite reaches@objectstack/metadataduring collection; fixed in5eb211c4with the module-top import the gate prescribes, then green).Generated by Claude Code