Skip to content

fix(metadata-protocol): the per-item publish of an object_extension draft asks the follow door its published save asks - #35656

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-nbjebo
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-nbjebo

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread
Fixes #35566

Clause-②: no
Metadata-protocol: none

repo:objectstack#1 · os-sales · session_01L6bhgVLY5efsfaT3UG2zwH. Branch claude/project-thread-nbjebo is the harness-assigned name for this card (not claude/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 an object_extension draft 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 in protocol-save.ts (the ADR-0144 D2/D6-amended, #33593 ruling R1 block): registry.objectRegistrationRefusal({ ...contribution, name: extend }, promoteInto, 'extend', { againstRegistry: true }), the body read through registrableObjectExtension. The refusal is thrown before repo.promoteDraft writes, so the answer is the registry's own 422 INVALID_METADATA with the save door's sentence and the draft stays a draft. publishPackageDrafts is unchanged (it states body-only and is never reached by the new block); measured below, it already refused both shapes.

Also: scripts/engine-double-contract.pinned.json gains three generated rows (from node 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 + real SchemaRegistry + real protocol, in-memory driver: the rig of packages/objectql/src/protocol-batch-object-registration.test.ts, calling publishMetaItem, the method the REST route calls). A package com.qa.mz with mz_invoice (title text, currency_code text holding an ISO 4217 code) and mz_line (invoice master_detail to mz_invoice); each draft adds a record-mode amount fee:

Draft pointer Published save Draft save Per-item publish (before) First write of fee (before)
zz_missing on mz_invoice (one segment) 422 INVALID_METADATA ok success: true, promoted, registered 400 ERR_CURRENCY_CODE_REQUIRED
invoice.title on mz_line (pair (a)) 422 INVALID_METADATA ok success: true, promoted, registered written, with title read as the currency
invoice.nothing on mz_line (pair (a)) 422 INVALID_METADATA ok success: true, promoted, registered 400 ERR_CURRENCY_CODE_REQUIRED
currency_code / invoice.currency_code (controls) ok ok success: true ok

publishPackageDrafts of the same drafts answered outcome: 'refused' with the refused row in failed[] (code INVALID_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_METADATA with the byte-identical message the published save answers, no active row, the draft row still there, and the amount is not served (a write naming fee answers 400 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

  • New 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 refused 422 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 as name, no extend/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 in packages/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.
  • New file alone: Tests 4 passed (4).
  • packages/objectql protocol-batch-object-registration.test.ts + record-currency-guards.test.ts against the rebuilt metadata-protocol dist: Test Files 2 passed, Tests 104 passed.
  • Ablation (fix committed at c82e8370 first; node scripts/ablation-replace.mjs replaced the new if (followRefusal) throw followRefusal; with a no-op, anchor 1 to 0, marker 0 to 1, blob 32d7db9a to 32f0f490): 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 restore 32d7db9a == HEAD blob, git diff HEAD empty. The test imports ./protocol.js from source, so no build sat between mutation and run.
  • Real-registry before/after: the table above; the scratch rig file was not committed.

Acceptance notes

  • scripts/engine-double-contract.pinned.json (three generated rows) is a declared file-surface addition, explained above.
  • The published-save follow-door call in protocol-save.ts and the new one here are two spellings of one question; folding them into one helper in protocol-object-extension-item.ts would touch files outside this card's surface (and protocol-save.ts is 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 the objectExtensionItemRefusal call (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.ts should print Tests 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).
  • NOT MEASURED, exit 3 PREREQUISITE NOT MET: node scripts/check-plugin-teardown-shape.mjs --self-test (shallow clone cannot reach its pinned fixture commit), pnpm check:dual-build-cjs-loads and pnpm 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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is the CI-owned run, not run locally.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgVLY5efsfaT3UG2zwH

…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>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 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
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d96c878e33b1f131cc62f50f6e9f9e3340bae0fe → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 91e2fa7b995f3f260f4946d6f41f954252045e2d — the merge of head d2b00426ed717ad6ef777184b71b6bf1a2ac4e3e into base d96c878e33b1f131cc62f50f6e9f9e3340bae0fe, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

维护者速读

  • 用户能看到什么变化:对象扩展先存成草稿、再单项发布时,如果货币字段指向的地方给不出币种,以前发布照样成功,之后每次写入都会被拒;现在发布当场就被拒,提示和直接保存时一样,草稿仍是草稿。
  • 出错会怎样:最坏的情况是某个本该能发布的扩展被拒。只影响单项发布这一个入口,整包发布和直接保存都不变。
  • 要你做什么:不需要你做任何事。CI 全绿后由区域落地。

席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head d2b00426ed717ad6ef777184b71b6bf1a2ac4e3e · 2026-11-19T21:47Z

  • Shape — draft, base main, 2 commits, 4 files, +354/−0 (source +27 in protocol-history-and-publish.ts). Merge-base eca20d22. check-governed-merges.mjs --pr 35656: NOT governed, 0 of 4 paths, 354 lines. Fixes #35566, Clause-②: no, Metadata-protocol: none, @objectstack/metadata-protocol patch.
  • The new block is the save door's question, asked at the publish door. Read side by side with the R1 block in protocol-save.ts (beside objectExtensionItemRefusal):
    • It makes the same call: registry.objectRegistrationRefusal({ ...contribution, name: extend }, <package>, 'extend', { againstRegistry: true }), with the body read through registrableObjectExtension and extend and priority stripped.
    • The package is promoteInto, the one repo.promoteDraft writes under. That is the same package the objectExtensionItemRefusal call directly above it judges against, and the publish door's counterpart of the save door's saveWriteBinding. A promotion into no package is not asked, just as the save door skips a null binding.
    • The order is the same as the save door's: the address refusal first, then the follow door.
    • The question is gated on request.registryQuestion === 'against-registry'. Only the per-item publish states that (PROMOTION_REGISTRY_QUESTION['item-publish'], line 541). publishPackageDrafts states package-publish, so it is not reached, and it already refused both shapes, as measured. The REGISTRY_QUESTION_PRODUCERS census is unchanged, because no new promoteDraftForPublish caller is added.
    • The block throws before repo.promoteDraft, so the draft stays a draft. Pinned: a draft|… row, and no active row.
  • The envelope is the save door's. The pin asserts 422 INVALID_METADATA, RecordCurrencyFollowRefusedError, and err.message === fromSave.message for the same body. That makes the refusal byte-identical to the save door's, not merely the same family.
  • Contract reading — this adds no new door, code or envelope. Both the save door and the package publish already refuse these bodies, and the per-item publish now matches them. What used to be accepted served an amount whose every write was refused, or one stored with an undeclared currency (invoice.title). That makes Clause-②: no and Metadata-protocol: none hold by my reading, so I see no L2 face. If the seat reads the per-item publish's new 422 as a narrowing, that is the seat's call to route.
  • Pins
    • The new file has 4 cases: two refusal cases (one-segment zz_missing, and a master_detail-led parent pointer) and two controls that publish and promote. The question each case records is checked to the argument: name = target, no extend or priority, the package promoted into, 'extend', and againstRegistry: true.
    • The registry here is a double, because metadata-protocol cannot import objectql (a cycle). The real-registry before/after is a scratch measurement whose rows are in the PR body, and the save door's real-registry pins in objectql still pass: 104 cases against the rebuilt dist.
    • The ablation of throw followRefusal turns both refusal cases red and leaves both controls green. The restored blob equals HEAD.
    • The package suite is 23289 passed, and the type-check passes. Not re-measured here: no node_modules.
  • Accepted deviations
    • scripts/engine-double-contract.pinned.json gains three generated rows for the new pin file, which was declared. Nothing else in the ledger moved.
    • 3 gate families are NOT MEASURED (exit 3), all on prerequisites outside this diff: the teardown-shape fixture commit, and the built output of other packages.
    • The first push went out before overlap-check, which then answered clean.
  • Out of scope — the save door and the per-item publish now spell one question twice. A drift between them would bring back exactly this hole. The fold, one helper in protocol-object-extension-item.ts used by both, should ride An unchanged owner object re-save may answer 409 DESTRUCTIVE_CHANGE while an extension adds a column, reading the extension column as dropped #35589, which holds protocol-save.ts, or a p3 card filed by the area. Per Sales's merge-cards rule, I recommend An unchanged owner object re-save may answer 409 DESTRUCTIVE_CHANGE while an extension adds a column, reading the extension column as dropped #35589. It is not blocking: today the two calls differ only in the package argument, and each argument is correct for its own door.
  • Gates — at reading time on this head: 11 success, 16 skipped, 23 in progress, 0 failure. Mergeable blocked (required checks pending). This ACCEPT holds when this head finishes with 0 red. A red, or any new push other than a clean main merge, needs a fresh L1.
  • Landing terms — not governed, and no L2 face by my reading. b1-C lands this head once it is green.

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 d2b00426, conditioned on zero red at that head. Not governed (check-governed-merges.mjs read in the ACCEPT: 0 of 4 paths, 354 lines), Clause-②: no, no L2 face. This stroke marks the PR ready and arms auto-merge, so the queue takes it only once the required checks are green; a red check or any new commit other than a clean main merge sends it back to L1. The dogfood battery is not owed (no !, no narrowing arm).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 21:49
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 986a0f2 Nov 19, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-nbjebo branch November 19, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing an object_extension draft per item may skip the record-currency follow door that a published save asks

2 participants