Repository navigation
fix(metadata-protocol)!: publish judges an object draft by the current ObjectSchema - #38299
Conversation
… ObjectSchema The draft promotion re-ran the save door's refusals on a stored draft but never its spec parse, so an object draft saved before a narrowing ObjectSchema refinement landed went live unjudged by it. The promotion now asks the parse of the draft as the publish serves it (ADR-0087 chain applied), with the save door's 422 INVALID_METADATA envelope, before anything is written; judge-only batches raise it too. Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
…refinement object draft Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
… pinned ledger Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
…upgrade-guide entry Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 178 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 cfb3400511f6d4dabab17530a78df1bb0b7ccfba && git checkout cfb3400511f6d4dabab17530a78df1bb0b7ccfba
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 81f2ff8bc3c7d99a5517e07ed90b0ebfc7c9f1d7 b78754ebcd1186193e9ff67217c909be7e056673 && git checkout -B drift-repro 81f2ff8bc3c7d99a5517e07ed90b0ebfc7c9f1d7 && git merge --no-ff b78754ebcd1186193e9ff67217c909be7e056673
node scripts/docs-audit/affected-docs.mjs --json 81f2ff8bc3c7d99a5517e07ed90b0ebfc7c9f1d7
|
… from the retirement kit's fixture Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head 8627792 · 2026-11-28T13:51Z The lane seat runs the owed CONTRACT_REVIEW_TIER review (narrowing face) through an isolated at-tier subagent. |
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 Contract reviewServed-tier: Face: the schema face, as Inputs read: card #35924 with all five comments (triage 7049063373, claim 7235625763, both ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
S1 (should-fix) — the entry's
N1 (nit) — the save door refuses the namespace prefix, the namespace/object-name clash and a divergent Test file and pinned ledger: the pins are the card's Done-when 3 (three refusal pins, four CONTROLs, a PREMISE that the two fixtures straddle the refinement, and a save-door pin the per-item pin compares its S1 is open on this head and earns a delta review of its fix; N1 does not move the head. Implemented-by: VERDICT: PASS |
…bject draft Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 Contract reviewServed-tier: Delta round on the record of head Face: the schema face, as Inputs read: card #35924 with all seven comments (triage 7049063373, claim 7235625763, the three What moved since ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentS1: closed
N2 (nit) — the PR body still carries the pre-fix shorthand in two places: Done-when 2 says the promotion "refuses with the save door's envelope (422)", and the seat-ruling paragraph says "200 on main, 422 with the fix". Neither is false as written: the first describes what
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 维护者速读
席位意见:建议批准。合同审查(CONTRACT_REVIEW_TIER)两轮:首轮 PASS 留 S1(升级指南把包发布门写成 422,实际是 200 + outcome)→ 修正后本 head 上 PASS(记录 7240999573,S1 已关闭),守卫读取器读通。 席位核对 · ACCEPT · head
|
|
repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8 Request: approval · PR #38299 declares a narrowing ( |
Fixes #35924
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — every body this refuses at publish is one a save of the same body already refuses; the published skills' procedure (fix what the refusal names, save the item again) is unchanged and is the remedy
维护者速读
What changes
ProtocolHistoryAndPublish.promoteDraftForPublishnow asks the save door's spec parse of an object draft beforerepo.promoteDraftwrites. This is the one save-door judge the promotion did not re-run. Before this change, an object draft saved before a narrowingObjectSchemarefinement landed went live at publish without that refinement judging it.packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts:promotedObjectDraftSpecRefusal(name, body)parses the draft againstresolveOverlaySchema('object'), the save door's own resolver (it resolves togetMetadataTypeSchema('object')). It refuses with the save door's envelope:INVALID_METADATA/422,issues[]fromzodIssuesToMetadataIssues(..., { refusalParams: true }), and the save door's default-face sentence (object/NAME failed spec validation: ...).applyConversionsToStoredItem), so the parse judgesconvertStoredItemDetailed('object', body).item, not the raw stored bytes. A draft stored in a spelling a later release retired, which the chain converts, still publishes exactly as before. Without this step the fix would falsely refuse such drafts (ablation 2 below shows it).objectRegistrationRefusal. That is the order the save door uses, so a body both refuse keeps the structuredissues[](元数据保存的 422 也丢掉 union 分支处方:一个 view 保存失败只回一条path:"" message:"Invalid input",Studio 无字段可高亮 #5364). The block already skips sealed managed items, which the store refusesNOT_OVERRIDABLEanyway. The refusal is thrown before thejudgeOnlyreturn, so the judge pass of a package publish on a store that cannot roll back raises it too.scripts/engine-double-contract.pinned.json: three rows recording the new test's engine-double pins, written bynode scripts/check-engine-double-contract.mjs --writeas the gate prescribes. It adds no other row..changeset/35924-publish-reparses-object-draft.md:@objectstack/metadata-protocolminor,@objectstack/specpatch,Metadata-protocol: narrowed, a BREAKING banner and aFROM → TOsection with the author's fix, and the ADR-0087 dispositionregistered publish-refuses-object-draft-the-current-schema-refuses.packages/spec/src/migrations/entries/semantic/19.publish-refuses-object-draft-the-current-schema-refuses.ts: the upgrade-guide entry that disposition names. It is notice only: no key is removed and no D2 conversion is added, because the fix is the author's choice. This is the shape of the landed19.publish-refuses-views-and-dashboards-that-save-and-do-not-work.ts.Why
The card's Done-when items:
origin/mainate3bdc748, the harness below saved a valid sealed audit object draft and rewrote its stored row to the pre-ADR-0154-D10 body (notenant_idchain column, the checksum the store would write). The save door refuses that body422 INVALID_METADATA. Then:{"success":true,"version":"hmac-sha256:a77d...","seq":1,"message":"Published draft — type=object, name=crm_ledger [seq=1]"}, and the stored rows became[{"state":"active","package_id":"com.acme.alpha"}];{"success":true,"outcome":"published","publishedCount":1,"failedCount":0,...}with the same active row.ObjectSchemaand refuses it beforerepo.promoteDraftwrites: the per-item publish answers the save door's422 INVALID_METADATAwith itsissues[], and the package publish answersoutcome: 'refused'with the draft infailed[]undercode: 'INVALID_METADATA'and the sameissues[]. Judge-only batches judge it too.The card's triage comment (7049063373), verbatim: "Triage: lands in
domain:server(metadata publish) ·pm:queue; rationale: area:data · Bug · a draft saved before an ObjectSchema refinement landed is promoted at publish without being parsed again; latent for every schema narrowing; no wrong answer measured → p3 as filed · size S." The card has no ruling comment.Seat ruling — the declaration
The claim carried
Metadata-protocol: none. The card's Done-when 4 says: "Declare it as a narrowing if a body that published before is now refused at publish." That condition holds as measured (the per-item publish answered 200 on main and 422 with the fix; the package publish answeredoutcome: 'published'on main andoutcome: 'refused'with the fix), so the dev reported the fork rather than shipping it undernone. The seat (repo:objectstack#8, sessionsession_017xRBcSAaBEfQpU2yJexSJ8, 2026-11-28T10:00Z) ruled, verbatim: "Q2 = A — narrowed (the card's own Done-when 4 criterion is met as measured)." The declaration lines above, the changeset, the!in the title and the upgrade-guide entry follow that ruling.Tests
New file
packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts(9 cases). The harness is the real save, publish and repository paths over a stub engine whose write verbs are held to ObjectQL's own dispatch decisions:INVALID_METADATA/422, and nothing is stored.code: 'INVALID_METADATA'andstatus: 422. Itslifecycle.sealissues equal the save door's for the same body, and the draft stays a draft.failed[](outcome: 'refused',code: 'INVALID_METADATA'), and nothing is promoted.externalSharingModel, which the chain strips (object-external-sharing-model-removed), still publishes.Run readings (local, at the head named)
Tests 9 passed (9), lockVERDICT command-exit 0.c3c5411f, run aspnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2(the following commit only adds three JSON ledger rows):Test Files 373 passed | 9 skipped (382)·Tests 23614 passed | 45 skipped (23659)·VERDICT command-exit 0.pnpm --filter @objectstack/metadata-protocol typecheck:VERDICT command-exit 0.tsc --listFileslists both new files, so the test is type-checked.scripts/ablation-replace.mjs, anchorif (specRefusal) throw specRefusal;deleted;anchor 1 -> 0, blob 9f79c4ba1d1c -> e7959dfad426):Tests 3 failed | 6 passed (9). The three failures are the per-item, package and judge-only refusal pins. The premise, the save-door pin and all four CONTROLs stay green. Restored:blob == HEAD (9f79c4ba1d1c) and git diff HEAD is empty.const served = body;;anchor 1 -> 0, blob 3528de18409b -> 0c1293f4f03d):Tests 1 failed | 6 passed (7). The one failure is the legacy-spelling CONTROL. This run is from before the judge-only pins were added. Restored:blob == HEAD (3528de18409b)../protocol.js, a relative source specifier, so neither ablation needed adist/rebuild.pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/migrations(the new ledger entry):Test Files 5 passed (5)·Tests 207 passed (207)·VERDICT command-exit 0.f7534a646(the title carries!), run as CI runs it: the closure was built withpnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build(VERDICT command-exit 0), thenpnpm --filter @objectstack/dogfood testwas run under the lock with no shard and no path. Result:Test Files 491 passed | 3 skipped (494)·Tests 4148 passed | 68 skipped (4216)·VERDICT command-exit 0, with no failures. A first attempt is void and not counted: I mis-spelled the concurrency flag, which forwarded--concurrency=2into the CLI's build script and broke it, so the test step ran against a partial closure. I stopped that run.Acceptance notes
object, the type this card names. Whether every type's stored draft should be re-parsed at promotion is not asked here. The stored-draft populations differ: aflowis judged throughstoredFlowVerdictBody, and aviewstores its parsed projection. carrier: none.scripts/engine-double-contract.pinned.jsonrows the gate requires for any new pinned engine double, generated by the gate's own--write; the diff adds no other row. (2) One file underpackages/spec/src/migrations/entries/semantic/, the ledger entrycheck:adr-0087-registrationrequires for a declared narrowing, written on the seat's order ("whatever ADR-0087 registrationcheck:adr-0087-registrationthen demands (ledger entry under semantic/19.*)"). No other file inpackages/spec/src/**is touched, and noObjectSchemarefinement.overlap-check.mjsbefore each push:VERDICT clean exit 0. At the last run it merges cleanly withorigin/main(e2a0e9002); an earlier run also showed it merging cleanly with feat(spec)!: retire the ask_ai action type (ADR-0160 D7) #37924, which shares the engine-double ledger file.Verification
Read first, by risk:
packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts: the parse, the conversion step and the envelope.packages/metadata-protocol/src/protocol-history-and-publish.ts, right after theoverlayPackageMismatchErrorthrow inpromoteDraftForPublish.packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts: therewriteStoredDraftsetup and the CONTROLs.Two-minute check:
pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.publish-draft-schema-reparse.test.tsshould show9 passed. Delete theif (specRefusal) throw specRefusal;line and run it again: the three refusal pins go red.Local gates: the full
dispatch-gates.mjs --commandslist for this diff, 102 families atf7534a646, was run and reconciled (--ran:102 derived famil(ies) accounted for). The 25 families the spec ledger entry added all exit 0, among themcheck:spec-changes,check:upgrade-guide,check:api-surface(unchanged),check:authorable-surface,check:docs,check:livenessand the CLI'smigrate-meta-engine-guidancetest (3/3).spec check:generated: all 14 artifacts are up to date after a spec build.check:adr-0087-registration:1 declared-breaking changeset(s), each carrying an ADR-0087 disposition … registered publish-refuses-object-draft-the-current-schema-refuses (new here …). All exit 0 except one that is NOT MEASURED locally and is carried by CI:check-plugin-teardown-shape --self-testexits 3 because it needs an unshallow clone.check:dual-build-cjs-loadsandcheck:lean-entry-closurefirst exited 3 (nodist/); after the dogfood closure build they exit 0 atf7534a646.check:engine-double-contractwent red until its ledger rows were written, then exited 0.Human Minimum
packages/specholds no runtime logic. (The onlypackages/specchange is one data-only upgrade-guide entry.)pnpm lintis left to CI.main, one pull request.packages/spectouched (one migration-ledger entry): spec rebuilt andcheck:generatedreports all 14 artifacts up to date, so there is nothing to regenerate. The registry it feeds is gitignored.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC
Generated by Claude Code