Repository navigation
feat(cloud-connection)!: refuse marketplace install-local when replicas are declared on the Redis driver - #31712
Conversation
… on the Redis driver The marketplace install-local install and uninstall doors change only the replica that serves the request (its own ledger, its own kernel). 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 read or written. The condition is the new shared predicate declaresMultiReplicaOnRedis in @objectstack/service-cluster, which the cloud binding credential ledger now delegates to as well. Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 174 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 c5a2484fd42def147949deb94c9a033c37bb66fa && git checkout c5a2484fd42def147949deb94c9a033c37bb66fa
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 35a9c6941c18eb5597dedd8e27b518050851bdd5 3a897d94bb3c952bfed2159a71348c54bdfd5eba && git checkout -B drift-repro 35a9c6941c18eb5597dedd8e27b518050851bdd5 && git merge --no-ff 3a897d94bb3c952bfed2159a71348c54bdfd5eba
node scripts/docs-audit/affected-docs.mjs --json 35a9c6941c18eb5597dedd8e27b518050851bdd5
|
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract-review-claim: session_01ADHkmP8JJo4zF2sjTBRwnX · head 6f4c42d · 2026-11-08T23:00Z |
|
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: 0 must-fix · 1 should-fix (④.7, prose faces only) · 2 nits (④.6, ④.8). The should-fix earns a delta review of its fix by this reviewer; a prose-only fix keeps this record under the Implemented-by: VERDICT: PASS Stamped 2026-11-08T23:14Z. |
…refused dry run Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract reviewServed-tier: Regen-provenance: 6728523407 · ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo Implemented-by: VERDICT: PASS Stamped 2026-11-08T23:25Z. |
Claude-Session: https://claude.ai/code/session_01ADHkmPnqZD15YnBkNbm1jJ Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX ACCEPT · PR #31712 · #31602 · 2026-11-09T00:07ZHead-sha:
|
Requested by Steve · project thread
Fixes #31602
Maintainer ruling R6 on cloud#3814 (2026-11-08 14:16 UTC): 「多副本时拒绝」. Claim 6727409308 (
domain:server#4, card-thread session_01ADHkmPnqZD15YnBkNbm1jJ).Clause-②: yes (narrowing) — narrowed, measured on head
6f4c42d9and, for base, by the ablation that removes the new guard (equivalent tomain5d1382a5on these doors): withOS_CLUSTER_REPLICAS=3(orOS_EXPECT_MULTI_NODE=true) and a composedclusterservice on theredisdriver,POST /api/v1/marketplace/install-localanswered200withhotLoaded: trueand wrote the ledger on base, andDELETE /api/v1/marketplace/install-local/:manifestIdanswered200and withdrew the package; on head both answer409 MULTI_REPLICA_PACKAGE_CHANGE_REFUSEDand nothing is written, registered or withdrawn. Every other topology is unchanged. Widened: two published faces gain members,ERROR_CODE_LEDGER(@objectstack/spec) registersMULTI_REPLICA_PACKAGE_CHANGE_REFUSEDunder@objectstack/cloud-connection(the ledger header's "Registering a new code" rule), and the@objectstack/service-clusterroot exportsdeclaresMultiReplicaOnRedis,composedClusterDriver,MULTI_REPLICA_CLUSTER_DRIVERandMULTI_REPLICA_PACKAGE_CHANGE_REFUSED; nothing is removed or renamed. This PR takes aCONTRACT_REVIEW_TIERreview (PASS, 6728523407).Metadata-protocol: none
Shared predicate (card item 4, for #31599):
declaresMultiReplicaOnRedis(env, clusterDriver)in@objectstack/service-cluster(packages/services/service-cluster/src/multi-replica.ts), withcomposedClusterDriver(services)to read the driver from a kernel context and the code constantMULTI_REPLICA_PACKAGE_CHANGE_REFUSED.@objectstack/runtimealready depends on@objectstack/service-cluster, so the runtime package doors import it from there.维护者速读
OS_CLUSTER_REPLICAS大于 1 或OS_EXPECT_MULTI_NODE=true)且集群驱动是 Redis 时,市场 install-local 的安装(POST)和卸载(DELETE)直接拒绝,返回 409MULTI_REPLICA_PACKAGE_CHANGE_REFUSED,提示在维护窗口里跑安装脚本、再重启所有副本;不写账本、不热加载、不撤包。OS_HOME下的账本和它自己的内核),其他副本永远看不到,而且每个副本启动时只读自己的账本,所以分叉是永久的。维护者 R6 裁决「多副本时拒绝」。packages/cloud-connection/src/marketplace-install-local-plugin.ts的refuseMultiReplicaPackageChange及两个门里的调用点;packages/services/service-cluster/src/multi-replica.ts(共享谓词);error-code-ledger.zod.ts新增的一行和一条 provenance 豁免。pnpm --filter @objectstack/cloud-connection exec vitest run src/marketplace-install-local-register-refusal.test.ts—— 预期 27 passed,其中 R6 一组 8 个(4 个拒绝、4 个对照)。What changes
packages/services/service-cluster/src/multi-replica.ts(new) — the one condition every cloud#3814 card keys on:declaresMultiReplicaOnRedis(env, clusterDriver)=declaresMultiNode(env)(the split-brain guard's own reading, untouched) AND the driver isMULTI_REPLICA_CLUSTER_DRIVER('redis').composedClusterDriver(services)reads the composedclusterservice'sdriver(theIClusterService.drivercontract field) and never throws.MULTI_REPLICA_PACKAGE_CHANGE_REFUSEDspells the code once, so every door refusing a package change under the condition answers the same code. Exported from the package root; unit pins inmulti-replica.test.ts(new file: no harness exists for this module).packages/cloud-connection/src/marketplace-install-local-plugin.ts—refuseMultiReplicaPackageChange(c, ctx, subject)answers409with the code and the recipe ("run the install script, then restart every replica"). Called inhandleInstallright afterrequireInstallCapability(before the body is read, so before the cloud fetch, the ledger,manifest.registerandsyncSchemas) and inhandleUninstallright after admission (before the ledger lookup, the guards and the withdrawal). The driver is read per request, where it is used. The grant path (installForGrant) callshandleInstall, so it is covered too.packages/cloud-connection/src/connection-credential-ledger.ts—sharesCloudBindingCredentialnow delegates todeclaresMultiReplicaOnRedisandCLOUD_BINDING_SHARED_CLUSTER_DRIVERaliasesMULTI_REPLICA_CLUSTER_DRIVER: same answers (its suite is green unchanged), one predicate for the epic.packages/spec/src/api/error-code-ledger.zod.ts—MULTI_REPLICA_PACKAGE_CHANGE_REFUSEDregistered under@objectstack/cloud-connection(the door), plus onePROVENANCE_WAIVERSentry for@objectstack/service-cluster(the shared constant one package over, theUNIQUE_SCOPE_CONFIRMATION_REQUIREDprecedent). The claim's surface says "one row"; the waiver is the provenance gate's required companion for a constant defined one package over the door.content/docs/references/api/{contract,automation-api,error-code-ledger}.mdx— regenerated (gen:schema && gen:docs) for the new enum member.packages/cloud-connection/src/marketplace-install-local-register-refusal.test.ts— the shared real-engine install-local harness (AGENTS.md shared-harness rule):bootPlugintakes an optionalclusterDriverthat composes aclusterservice; a new top-leveldescribepins the refusal. No existing test was changed..changeset/31602-install-local-multi-replica-refusal.md—patchfor@objectstack/cloud-connection,@objectstack/service-cluster,@objectstack/spec; both declaration lines;adr-0087: not-required (no-migration-prescription); who sees it.Tests
The new describe, on a real
ObjectKernel+ObjectQLPluginand a real on-disk ledger:OS_CLUSTER_REPLICAS=3,OS_EXPECT_MULTI_NODE=true) on theredisdriver:POST(inline branch and cloud branch) answers409 MULTI_REPLICA_PACKAGE_CHANGE_REFUSEDin the declared envelope, the ledger stays empty, the registry holds neither package, and the cloud leg is never fetched;DELETEof a package installed on a single node and rehydrated after a restart with replicas declared answers the same409, the ledger still holds it and the registry still serves it;200with the ledger and registry moving as before: a single node onredis,OS_CLUSTER_REPLICAS=1onredis, declared replicas on the in-process driver (with the split-brain guard's escape hatch), declared replicas with no cluster service composed.Acceptance notes
refuseMultiReplicaPackageChange.POSTwithdryRun: truewrites nothing, but the guard sits before the body is read, so it is refused like any install: its plan reads the serving replica's own ledger, which is the per-replica state the refusal is about.POST …/:manifestId/reseedand…/purge-sample-datawrite rows to the shared database (every replica sees them) and are not refused. The runtime package doors (create/ensure customization, enable, disable, runtime install/uninstall) are feat(runtime)!: refuse runtime package operations when multi-replica is declared (#3814 F3c, D1) #31599, which imports this predicate.@objectstack/service-cache(cache-service-plugin.ts) readsdeclaresMultiNode()plus its own driver check for the shared Redis cache; it is not moved onto the new predicate here.Verification
All on
6f4c42d9unless stated (the feature commits were cut on5d1382a5;origin/mainmerged once at03fed7a5, 5 commits, none in these packages;6f4c42d9adds only the regenerated references; head485e8f99changes only the changeset's prose, after the contract review: theClause-②:line now readsyes (narrowing)and names both halves, and the Now bullet says a dry run is refused too. On485e8f99the changeset gates were re-run, each exit 0:check-adr-0087-registration,check-changeset-no-major,check-empty-changeset,check:changeset-gate-self-tests,check:nul-bytes):Suites (os-verify-lock, every VERDICT command-exit 0)
pnpm --filter @objectstack/service-cluster test+typecheck: 9 files / 120 tests (03fed7a5).pnpm --filter @objectstack/cloud-connection test: 80 files / 1116 tests;typecheckexit 0 (03fed7a5).pnpm --filter @objectstack/spec test: 822 files / 26034 passed, 1 todo;typecheckexit 0 (03fed7a5).pnpm --filter @objectstack/dogfood test(full battery, narrowing arm): 440 passed, 3 skipped files / 3652 passed, 41 skipped tests (03fed7a5).eslint --no-inline-config) onservice-cluster,cloud-connection,specsources: exit 0 each.Ablation (negative pins)
scripts/ablation-replace.mjson51cac0fe(fix committed first), markerABLATED_31602: the guard's condition|| 'ABLATED_31602', sorefuseMultiReplicaPackageChangealways returnsnull(the base behaviour). The test file imports the plugin fromsrc, so no rebuild leg. Result: 4 of 27 red — exactly the four refusal cases (POST and DELETE, both declarations), eachexpected 200 to be 409with the base answer in the message ({"success":true,"data":{"manifestId":"com.acme.dispatch",…,"hotLoaded":true,…}}for POST; the withdrawal answer for DELETE); the four CONTROLs and the 19 existing cases green. Restored: blob4f8e111f== HEAD,git diff HEADempty.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon6f4c42d9: 120 families, each run and recorded with its exit code;--ranreconciliation: "120 derived famil(ies) accounted for — 120 run, 0 NOT-MEASURED". All 120 exit 0, among themcheck:error-code-provenance,check:error-code-casing,check:dispatcher-error-vocabulary,check:error-status-conformance,check:route-envelope,check:startup-registry-verdict,check:api-surface,check:generatedandcheck:docs. A first pass on03fed7a5hadcheck:docsred (the three references above were stale, now regenerated) and two exit-3 prerequisites (check:plugin-teardown-shape --self-testneeded its pinned fixture commit fetched;check:dual-build-cjs-loadsneeded every package's dist, built withturbo run build --filter='./packages/**'); both are green on6f4c42d9.pnpm --filter @objectstack/spec check:generated: exit 0.Generated by Claude Code