Repository navigation
fix(metadata-protocol): the per-item publish of an object_extension draft asks the follow door its published save asks - #35656
Conversation
…raft asks the follow door its published save asks publishMetaItem promoted an object_extension draft without asking the registry's record-currency follow door, so a draft adding a record-mode amount whose currencyField the served object cannot satisfy was answered published and every later write of the amount was refused (or stored a currency nobody declared). promoteDraftForPublish now asks the save door's question on the against-registry publish, before repo.promoteDraft writes: 422 INVALID_METADATA with the registry's sentence, the draft stays a draft. Claude-Session: https://claude.ai/code/session_01L6bhgVLY5efsfaT3UG2zwH Co-authored-by: Claude <noreply@anthropic.com>
…les in the engine-double ledger Generated by `node scripts/check-engine-double-contract.mjs --write`: three additive rows for the new test file's pinned delete, findOne and update doubles, nothing else moved. Claude-Session: https://claude.ai/code/session_01L6bhgVLY5efsfaT3UG2zwH Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 10 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 91e2fa7b995f3f260f4946d6f41f954252045e2d && git checkout 91e2fa7b995f3f260f4946d6f41f954252045e2d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d96c878e33b1f131cc62f50f6e9f9e3340bae0fe d2b00426ed717ad6ef777184b71b6bf1a2ac4e3e && git checkout -B drift-repro d96c878e33b1f131cc62f50f6e9f9e3340bae0fe && git merge --no-ff d2b00426ed717ad6ef777184b71b6bf1a2ac4e3e
node scripts/docs-audit/affected-docs.mjs --json d96c878e33b1f131cc62f50f6e9f9e3340bae0fe |
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgVLY5efsfaT3UG2zwH Landing (area b1-C, card thread of #35566) · 2026-11-19T21:48Z: L1-a ACCEPT 7023140169 on head |
Requested by Sales · project thread
Fixes #35566
Clause-②: no
Metadata-protocol: none
repo:objectstack#1 · os-sales · session_01L6bhgVLY5efsfaT3UG2zwH. Branch
claude/project-thread-nbjebois the harness-assigned name for this card (notclaude/issue-35566-…), noted here for the Duplicate Fix Guard.维护者速读
What changes
promoteDraftForPublish(packages/metadata-protocol/src/protocol-history-and-publish.ts) now asks the registry's record-currency follow door for anobject_extensiondraft on the per-item publish (POST /api/v1/meta/object_extension/NAME/publish, the against-registry question), with exactly the call the published save asks inprotocol-save.ts(the ADR-0144 D2/D6-amended, #33593 ruling R1 block):registry.objectRegistrationRefusal({ ...contribution, name: extend }, promoteInto, 'extend', { againstRegistry: true }), the body read throughregistrableObjectExtension. The refusal is thrown beforerepo.promoteDraftwrites, so the answer is the registry's own422 INVALID_METADATAwith the save door's sentence and the draft stays a draft.publishPackageDraftsis unchanged (it statesbody-onlyand is never reached by the new block); measured below, it already refused both shapes.Also:
scripts/engine-double-contract.pinned.jsongains three generated rows (fromnode scripts/check-engine-double-contract.mjs --write) for the new test file's pinned engine doubles. This is outside the claim's declared file surface; it is the generated consequence of the new test file the claim names, and nothing else in the ledger moved.Why
Measured before the fix (commit
eca20d22, real kernel + realSchemaRegistry+ real protocol, in-memory driver: the rig ofpackages/objectql/src/protocol-batch-object-registration.test.ts, callingpublishMetaItem, the method the REST route calls). A packagecom.qa.mzwithmz_invoice(titletext,currency_codetext holding an ISO 4217 code) andmz_line(invoicemaster_detail tomz_invoice); each draft adds a record-mode amountfee:fee(before)zz_missingonmz_invoice(one segment)INVALID_METADATAsuccess: true, promoted, registeredERR_CURRENCY_CODE_REQUIREDinvoice.titleonmz_line(pair (a))INVALID_METADATAsuccess: true, promoted, registeredtitleread as the currencyinvoice.nothingonmz_line(pair (a))INVALID_METADATAsuccess: true, promoted, registeredERR_CURRENCY_CODE_REQUIREDcurrency_code/invoice.currency_code(controls)success: truepublishPackageDraftsof the same drafts answeredoutcome: 'refused'with the refused row infailed[](codeINVALID_METADATA) and promoted nothing, so the batch door has no such hole.After the fix, the same rig: each refused shape's per-item publish answers
422 INVALID_METADATAwith the byte-identical message the published save answers, no active row, the draft row still there, and the amount is not served (a write namingfeeanswers400 INVALID_FIELD). Both controls still publish and write.Metadata-protocol
none: nothing an author can save changes. The published save already refused these bodies; only the per-item publish of a draft (which the draft save accepts, body-only, as before) now refuses them, matching that save.Tests
packages/metadata-protocol/src/protocol.extension-publish-follow-door-35566.test.ts(4 cases): for both shapes, the draft save answers 200, the per-item publish is refused422 INVALID_METADATA(RecordCurrencyFollowRefusedError) with the message the published save answers for the same body, the draft stays a draft with no active row, and the question asked is the save door's (target asname, noextend/priority, the package promoted into,'extend',againstRegistry: true); CONTROL: a one-segment and a master_detail-led pointer the served object satisfies publish and are promoted. The registry there is a double that records the question and judges a pointer against the objects it serves (this package cannot import@objectstack/objectql); the real registry's judgement of the same shapes is the measurement above and the existing save-door pins inpackages/objectql/src/protocol-batch-object-registration.test.ts.Readings at head d2b0042
pnpm --filter @objectstack/metadata-protocol typecheck && pnpm --filter @objectstack/metadata-protocol test: VERDICT command-exit 0 · Test Files 362 passed, 9 skipped (371) · Tests 23289 passed, 45 skipped.packages/objectqlprotocol-batch-object-registration.test.ts+record-currency-guards.test.tsagainst the rebuiltmetadata-protocoldist: Test Files 2 passed, Tests 104 passed.c82e8370first;node scripts/ablation-replace.mjsreplaced the newif (followRefusal) throw followRefusal;with a no-op, anchor 1 to 0, marker 0 to 1, blob32d7db9ato32f0f490): Tests 2 failed, 2 passed (4) — both refusal cases red (expected { code: undefined, status: undefined } to deeply equal { code: 'INVALID_METADATA', … }), both controls green. Restored: blob after restore32d7db9a== HEAD blob,git diff HEADempty. The test imports./protocol.jsfrom source, so no build sat between mutation and run.Acceptance notes
scripts/engine-double-contract.pinned.json(three generated rows) is a declared file-surface addition, explained above.protocol-save.tsand the new one here are two spellings of one question; folding them into one helper inprotocol-object-extension-item.tswould touch files outside this card's surface (andprotocol-save.tsis held for the next card in series), so it is left as is.Verification
Read first: (1)
protocol-history-and-publish.ts, the new block after theobjectExtensionItemRefusalcall (the only behaviour change; risk: it must stay on the against-registry question only); (2) the new test file; (3) the changeset.Two-minute check:
pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.extension-publish-follow-door-35566.test.tsshould printTests 4 passed (4).Local gates (dispatch-gates derivation at head d2b0042: 77 families)
node scripts/pm/dispatch-gates.mjs --ran: 77 derived, 74 run, 3 NOT MEASURED, 0 UNRUN. Every run family exited 0 except:pnpm check:engine-double-contract: exit 1 before the ledger rows, exit 0 after (d2b00426).node scripts/check-plugin-teardown-shape.mjs --self-test(shallow clone cannot reach its pinned fixture commit),pnpm check:dual-build-cjs-loadsandpnpm check:lean-entry-closure(built output of packages outside this diff absent in this worktree). CI runs all three.node scripts/pm/overlap-check.mjs: VERDICT clean exit 0.node scripts/check-nul-bytes.mjs: exit 0.Human Minimum
packages/specholds no runtime logic.pnpm lintis the CI-owned run, not run locally.main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgVLY5efsfaT3UG2zwH