Skip to content

fix(metadata-protocol)!: publish judges an object draft by the current ObjectSchema - #38299

Merged
os-zhuang merged 7 commits into
mainfrom
claude/issue-35924-publish-draft-refinement
Nov 28, 2026
Merged

os-zhuang merged 7 commits into
mainfrom
claude/issue-35924-publish-draft-refinement

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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

维护者速读

  • 用户能看到什么变化:在 Studio 里发布对象草稿时,若草稿是在某条更严格的对象校验规则上线之前保存的,发布现在会像保存一样拒绝它,草稿原样保留;正常草稿照旧发布。
  • 为什么做:替数据域把保存与发布两道门对齐,避免旧草稿绕过新校验规则直接上线(例如封存审计对象缺少组织链列)。
  • 出错会怎样:升级时仍有待发布旧草稿的环境,这些草稿发布会被拒(已标为破坏性变更并写入升级指南);作者按提示修正后重新保存即可;改动可直接撤回,不涉及数据迁移。
  • 要你做什么:无

What changes

ProtocolHistoryAndPublish.promoteDraftForPublish now asks the save door's spec parse of an object draft before repo.promoteDraft writes. This is the one save-door judge the promotion did not re-run. Before this change, an object draft saved before a narrowing ObjectSchema refinement landed went live at publish without that refinement judging it.

  • New module packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts: promotedObjectDraftSpecRefusal(name, body) parses the draft against resolveOverlaySchema('object'), the save door's own resolver (it resolves to getMetadataTypeSchema('object')). It refuses with the save door's envelope: INVALID_METADATA / 422, issues[] from zodIssuesToMetadataIssues(..., { refusalParams: true }), and the save door's default-face sentence (object/NAME failed spec validation: ...).
  • The body judged is the body the publish serves. A stored row is read and registered through the ADR-0087 chain (applyConversionsToStoredItem), so the parse judges convertStoredItemDetailed('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).
  • Placement: in the object block of the promotion, after the package-mismatch refusal and before the registry's objectRegistrationRefusal. That is the order the save door uses, so a body both refuse keeps the structured issues[] (元数据保存的 422 也丢掉 union 分支处方:一个 view 保存失败只回一条 path:"" message:"Invalid input",Studio 无字段可高亮 #5364). The block already skips sealed managed items, which the store refuses NOT_OVERRIDABLE anyway. The refusal is thrown before the judgeOnly return, 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 by node scripts/check-engine-double-contract.mjs --write as the gate prescribes. It adds no other row.
  • .changeset/35924-publish-reparses-object-draft.md: @objectstack/metadata-protocol minor, @objectstack/spec patch, Metadata-protocol: narrowed, a BREAKING banner and a FROM → TO section with the author's fix, and the ADR-0087 disposition registered 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 landed 19.publish-refuses-views-and-dashboards-that-save-and-do-not-work.ts.

Why

The card's Done-when items:

  1. Reach measured once on main. It reproduces. On origin/main at e3bdc748, the harness below saved a valid sealed audit object draft and rewrote its stored row to the pre-ADR-0154-D10 body (no tenant_id chain column, the checksum the store would write). The save door refuses that body 422 INVALID_METADATA. Then:
    • per-item publish answered {"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"}];
    • package publish answered {"success":true,"outcome":"published","publishedCount":1,"failedCount":0,...} with the same active row.
  2. The promotion parses an object draft against the current ObjectSchema and refuses it before repo.promoteDraft writes: the per-item publish answers the save door's 422 INVALID_METADATA with its issues[], and the package publish answers outcome: 'refused' with the draft in failed[] under code: 'INVALID_METADATA' and the same issues[]. Judge-only batches judge it too.
  3. Pins: a pre-refinement draft is refused at publish (per item, per package, and in the judge-only pass), with CONTROLs where a valid draft still publishes.
  4. Declaration: a narrowing, by the seat's ruling below. A pending object draft that published before is refused at publish now.

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 answered outcome: 'published' on main and outcome: 'refused' with the fix), so the dev reported the fork rather than shipping it under none. The seat (repo:objectstack#8, session session_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:

  • PREMISE: the two fixtures straddle the refinement (one parses, the other does not).
  • The save door refuses the pre-refinement body INVALID_METADATA / 422, and nothing is stored.
  • The per-item publish refuses the pre-refinement draft with code: 'INVALID_METADATA' and status: 422. Its lifecycle.seal issues equal the save door's for the same body, and the draft stays a draft.
  • The package publish refuses it into failed[] (outcome: 'refused', code: 'INVALID_METADATA'), and nothing is promoted.
  • The package publish on a store that cannot roll back (judge-only pass) refuses it, and neither it nor a valid sibling draft goes live.
  • CONTROL: a fresh valid draft publishes per item, per package, and per package on a store that cannot roll back.
  • CONTROL: a draft stored with the tombstoned externalSharingModel, which the chain strips (object-external-sharing-model-removed), still publishes.
Run readings (local, at the head named)
  • New file, with the fix: Tests 9 passed (9), lock VERDICT command-exit 0.
  • Package suite at c3c5411f, run as pnpm --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 --listFiles lists both new files, so the test is type-checked.
  • Ablation 1 (scripts/ablation-replace.mjs, anchor if (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.
  • Ablation 2 (the converted body replaced by the raw stored body, 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).
  • The subject is imported as ./protocol.js, a relative source specifier, so neither ablation needed a dist/ 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.
  • Dogfood battery at f7534a646 (the title carries !), run as CI runs it: the closure was built with pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build (VERDICT command-exit 0), then pnpm --filter @objectstack/dogfood test was 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=2 into the CLI's build script and broke it, so the test step ran against a partial closure. I stopped that run.

Acceptance notes

  • Other types (read only, not measured): the save door parses every type with a registered schema, but the promotion now re-parses only 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: a flow is judged through storedFlowVerdictBody, and a view stores its parsed projection. carrier: none.
  • File surface: beyond the claimed publish path, co-located test and changeset, the diff writes two more files. (1) The three scripts/engine-double-contract.pinned.json rows 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 under packages/spec/src/migrations/entries/semantic/, the ledger entry check:adr-0087-registration requires for a declared narrowing, written on the seat's order ("whatever ADR-0087 registration check:adr-0087-registration then demands (ledger entry under semantic/19.*)"). No other file in packages/spec/src/** is touched, and no ObjectSchema refinement.
  • overlap-check.mjs before each push: VERDICT clean exit 0. At the last run it merges cleanly with origin/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:

  1. packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts: the parse, the conversion step and the envelope.
  2. The new block in packages/metadata-protocol/src/protocol-history-and-publish.ts, right after the overlayPackageMismatchError throw in promoteDraftForPublish.
  3. packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts: the rewriteStoredDraft setup and the CONTROLs.

Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.publish-draft-schema-reparse.test.ts should show 9 passed. Delete the if (specRefusal) throw specRefusal; line and run it again: the three refusal pins go red.

Local gates: the full dispatch-gates.mjs --commands list for this diff, 102 families at f7534a646, was run and reconciled (--ran: 102 derived famil(ies) accounted for). The 25 families the spec ledger entry added all exit 0, among them check:spec-changes, check:upgrade-guide, check:api-surface (unchanged), check:authorable-surface, check:docs, check:liveness and the CLI's migrate-meta-engine-guidance test (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-test exits 3 because it needs an unshallow clone. check:dual-build-cjs-loads and check:lean-entry-closure first exited 3 (no dist/); after the dogfood closure build they exit 0 at f7534a646. check:engine-double-contract went red until its ledger rows were written, then exited 0.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (The only packages/spec change is one data-only upgrade-guide entry.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is left to CI.
  • 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 (one migration-ledger entry): spec rebuilt and check:generated reports all 14 artifacts up to date, so there is nothing to regenerate. The registry it feeds is gitignored.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English, except the Chinese maintainer summary the repo requires.

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC


Generated by Claude Code

… 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>
…upgrade-guide entry

Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC
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 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/metadata-protocol, @objectstack/spec, touching 7 documentable anchor(s).

12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/error-catalog.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/automation/email-templates.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/data-modeling/currency.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/data-modeling/external-datasources.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/data-modeling/field-types.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/deployment/cli.mdx (via /api/v1/packages/:id/publish-drafts (route, a path literal in surface))
  • content/docs/deployment/install-modes.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/deployment/validating-metadata.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/permissions/authorization.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/permissions/capabilities.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/protocol/kernel/error-handling.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/ui/forms.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))

⛔ 7 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/releases/v17/17-5.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/releases/v17/17-6.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/releases/v17/17-7.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/releases/v18/18-0.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/releases/v18/18-1.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal))
  • content/docs/releases/v18/18-2.mdx (via INVALID_METADATA (literal, a string literal in PromotedDraftSpecRefusal; a string literal in promotedObjectDraftSpecRefusal), /api/v1/packages/:id/publish-drafts (route, a path literal in surface))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 253 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 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; 125 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 — 178 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 81f2ff8bc3c7d99a5517e07ed90b0ebfc7c9f1d7 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from cfb3400511f6d4dabab17530a78df1bb0b7ccfba — the merge of head b78754ebcd1186193e9ff67217c909be7e056673 into base 81f2ff8bc3c7d99a5517e07ed90b0ebfc7c9f1d7, 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 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

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 81f2ff8bc3c7d99a5517e07ed90b0ebfc7c9f1d7 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

… from the retirement kit's fixture

Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8627792974c5ca88f4c6e1682ed3feec7a5cd66b
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.publish-refuses-object-draft-the-current-schema-refuses.ts + packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts, scripts/engine-double-contract.pinned.json

Face: the schema face, as record-recognisers.mjs --template --paths decides it from the one hits file. The PR also declares Clause-②: no (narrowing) and Metadata-protocol: narrowed, so the narrowing face's floor (every path of the diff outside the prose faces) and its question (does the narrowing take a declared capability away, or make the spec's own refusal real) are applied to the whole diff. The changeset is read for ② only.

Inputs read: card #35924 with all five comments (triage 7049063373, claim 7235625763, both os-dev-report comments 7238787161 and 7240218943), PR #38299's body, file list and net diff against main, and the check-runs on the head. Code outside the diff was read at the head to judge it: protocol-save.ts, protocol-meta-type-schema.ts, protocol-stored-item-conversion.ts, protocol-write-face.ts, metadata-diagnostics.ts, protocol-meta-item-reads.ts, packages/spec/src/conversions/stored.ts, packages/spec/src/api/protocol.zod.ts, packages/spec/src/kernel/protocol-version.ts, packages/spec/src/migrations/types.ts and packages/runtime/src/domains/packages.ts.

① Derived judgments

  • Accept set at the publish doors: narrowed, and declared so. A pending object draft whose stored body the current ObjectSchema refuses after the ADR-0087 chain published before and is refused now. Right, and it matches the card's Done-when 4 as measured (200 on main, 422 with the fix).
  • The narrowing makes the spec's own refusal real at a second door; it takes no declared capability away. The schema asked is the save door's own (resolveOverlaySchema('object', …), which answers getMetadataTypeSchema('object')), so every body the promotion refuses is one a save refuses today. The reverse direction was read for a regression: a body the save door admits is stored as parsed-and-grafted canonical text (operator graft, translated-echo restore, credential carry-forward; none adds a key ObjectSchema refuses), and the chain is the one every read of that row already applies, so a draft saved today parses at promotion. The three fresh-draft CONTROLs pin it on the per-item door, the package door and the judge-first package door.
  • Published surface of @objectstack/spec: one migration-ledger entry is added; no schema, no accept set, no API export moves. Right. ObjectSchema itself is untouched.
  • Published surface of @objectstack/metadata-protocol: promotedObjectDraftSpecRefusal and PromotedDraftSpecRefusal are module exports of a new internal file; nothing re-exports them from the package entry in this diff, and check:api-surface is carried by the green Lint gates. Right.
  • Wire envelope: the per-item publish answers the thrown INVALID_METADATA / 422 with issues[] (registered refusal params included), and the sentence is the save door's default-face sentence because the publish request declares no write face (no writeFace is read anywhere in protocol-history-and-publish.ts). Right. The package publish answers it as it answers every promotion refusal: outcome: 'refused', the causal item in failed[] with code: 'INVALID_METADATA' and its issues[], on a 200. Right in the code; see S1 for how the ledger entry words it.
  • Order in promoteDraftForPublish: after the D9.9 package-mismatch refusal, ahead of objectRegistrationRefusal, inside the block that skips sealed managed items, and ahead of the judgeOnly return. Right against the save door for the pair the comment names (spec parse at protocol-save.ts 1666, registry refusal at 1720), so a body both refuse keeps the structured issues[]. See N1 for the rows the comment does not name.
  • Judge-only: the judgeOnly return sits after every refusal, so the judge pass of publishPackageDrafts on a store that cannot roll back raises the new refusal before any promotion. Right, and pinned with a valid sibling that stays a draft.
  • Drafts the chain converts: the body parsed is convertStoredItemDetailed('object', body).item, the full chain with retired entries (applyConversionsToStoredItem pins includeRetired: true), which is the body the draft read (readMetaItem, convertStoredItem) and the boot loader (loadMetaFromDb) serve. knownDatasources is not passed and need not be: it feeds only the TODO listing, never the converted item. Right, and the legacy-spelling CONTROL pins it with a key taken from the retirement kit's own fixture, asserts the key set is non-empty and that the raw body is refused by ObjectSchema, so the CONTROL cannot pass vacuously.
  • Reach: repo.promoteDraft has one non-test call site in the tree, inside promoteDraftForPublish, so no promotion path goes round the new check.
  • scripts/engine-double-contract.pinned.json: three rows (delete, findOne, update) for the new test file, which is exactly the three dispatch assertions its stub engine calls. Right.

② Semver level

  • @objectstack/metadata-protocol minor: right. A declared narrowing of a published door's accept set ships minor in the launch window, and Metadata-protocol: narrowed requires at least one moved package at minor or above.
  • @objectstack/spec patch: right. The package gains one data-only ledger entry and no accept-set or type change; the landed precedent of the same shape (fix(lint)!: publish-time checks for views, dashboards and the app shell that save and do not work #38107, 19.publish-refuses-views-and-dashboards-that-save-and-do-not-work) shipped spec patch beside the minor of the package that narrows.
  • Clause-②: no (narrowing) is right and now agrees on the changeset and the PR body (line 3). Metadata-protocol: narrowed agrees on both. The title carries !, the changeset carries the BREAKING banner, a FROM → TO section and the ADR-0087 disposition registered publish-refuses-object-draft-the-current-schema-refuses, whose id is the entry's id.
  • Gate conclusions on this head: Check Changeset has two runs. The run started 12:54Z concluded red against the unpatched PR body; the run started 13:51Z, after the seat applied the dev's pr_body_patch, concluded success and is the newest. Every other completed check-run on the head is success or skipped, among them Test Core (all 12 shards), Lint & Repo Gates, TypeScript Type Check, Spec property liveness, Dogfood Regression Gate and Governed Surface Queue Guard.

③ Boundary flags

  • open_questions: empty in both reports. Nothing to answer.
  • Dev flag, first report: the claim's Metadata-protocol: none against Done-when 4. Answered by the seat's ruling quoted in the PR body (Q2 = A, narrowed); the tree follows it and ① agrees with it.
  • Dev flag, first report: file surface beyond the claim (the packages/spec/src/** ledger entry the claim forbade, and three pinned-ledger rows). Answered: the entry is the one file check:adr-0087-registration demands of a declared narrowing and was written on the seat's order; the rows are gate-generated. No other packages/spec/src file is in the diff.
  • Dev out-of-scope note: only object is re-parsed at promotion, other types read-only and unmeasured, carrier: none. Answered: the scope is right for this card, whose title and Done-when 2 name the object draft and getMetadataTypeSchema('object'), and the reasons given for not widening hold in the tree (convertStoredItemDetailed skips flow, which is judged through storedFlowVerdictBody; a view is stored as its parsed projection). The residual question is the same latent gap for every other type with a registered schema, and a note with no carrier is not a carrier. Escalated to the lane seat to file as a follow-up card with reach measured first, as this card's own Done-when 1 did; it is not a finding on this head.
  • Second report: dogfood battery not re-run locally at this head. Answered by the check-run: Dogfood Regression Gate is success on the head.
  • PR author is objectstack-fleet[bot]; no off-relay author to name.
  • SQL push-down: the diff adds no query, no id materialisation and no in-app join. The new check is a pure parse of a row the promotion had already read.

④ Design judgment

19.publish-refuses-object-draft-the-current-schema-refuses.ts (hits), against the tree it describes:

  • Major: 19. is right; PROTOCOL_VERSION is '19.0.0' and the entry sits beside the nineteen landed 19.* entries. Shape is the SemanticMigration shape, notice only, no conversionIds (it judges no mechanical edit) and no relevance (the surface is stored drafts, which no stack-declared question can prove absent). Right.
  • reason: every sentence holds. Nothing is rewritten or refused at boot, an active row is untouched (the only edit is on the promotion path), the draft stays a draft, and a package publish refuses its whole batch.
  • acceptanceCriteria: holds. The draft read serves the converted body and its _diagnostics.valid is a parse against the same registry schema, with only read decorations, resolved picklist options and injected _sync_ columns set aside, none of which a stored draft body carries. So valid: true on the read and a pass at promotion are the same parse.
  • replacement: holds; a save of the same body answers the same refusal until it parses.

S1 (should-fix) — the entry's surface states that both doors refuse the draft 422 INVALID_METADATA, and the package door does not answer that on the wire. POST /api/v1/packages/:id/publish-drafts returns HTTP 200 with success: false, outcome: 'refused' and the draft in failed[] carrying code: 'INVALID_METADATA' and issues[]; publishPackageDrafts catches the thrown 422 and reports it there, the route answers through deps.success(result), and PublishPackageDraftsResponseSchema in the same package says in terms that a refusal answers false on a 200 and that consumers read outcome, not the HTTP status. An upgrader who scripts the package publish against this entry and watches for a 422 reads a refused batch as published. Only the per-item door answers 422. Fix in the entry: say the per-item publish is refused 422 INVALID_METADATA with the save door's issues[], and the package publish answers outcome: 'refused' with the draft in failed[] under code: 'INVALID_METADATA' and the same issues[]. The changeset's sentence "They refuse it with the same 422 INVALID_METADATA" carries the same wording and should move with it.

protocol-promoted-draft-spec-refusal.ts, sentence by sentence against the code it cites: the save-door parse it describes is the one at protocol-save.ts 1661–1694 (same resolver, same zodIssuesToMetadataIssues(…, { refusalParams: true }), same sentence stem, same code and status); the "read warns once" claim holds (convertStoredItem owns the warn-once set, and this module calls the detailed form with no notice sink); the undefined return when no schema is registered matches the save door, which then parses nothing; the object-only paragraph says what it does not answer. It agrees with the contract. Tried and not broken: a non-object body (passes through the chain unchanged and is refused by the parse, as a save refuses it), a sealed managed item (never reaches the check; the store's NOT_OVERRIDABLE stays that row's one answer), and a stale draft riding a batch with valid siblings (the whole batch is refused, which the entry's reason states).

protocol-history-and-publish.ts: twelve lines, one import and one guarded throw. The comment's claims hold as read in ①.

N1 (nit) — the save door refuses the namespace prefix, the namespace/object-name clash and a divergent name before its spec parse (protocol-save.ts 1101, 1112, 1389, then 1666); the per-item promotion now answers the spec parse before those three. A draft that breaks both rules is told INVALID_METADATA at publish where a save tells it NAMESPACE_PREFIX. Both are 422 refusals with nothing written, the registry refusal already sat ahead of the same three on main, and the comment claims the save door's order only for the spec-and-registry pair, which is true. Accepted as a deviation; no change asked on this head.

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 lifecycle.seal issues against). The package pins assert outcome: 'refused' and failed[].code, which is the wire shape S1 asks the entry to state.

S1 is open on this head and earns a delta review of its fix; N1 does not move the head.

Implemented-by: claude/issue-35924-publish-draft-refinement
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head b78754e · 2026-11-28T14:47Z

The lane seat runs the owed CONTRACT_REVIEW_TIER delta review (S1 of the record on 8627792) through an isolated at-tier subagent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b78754ebcd1186193e9ff67217c909be7e056673
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.publish-refuses-object-draft-the-current-schema-refuses.ts + packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts, scripts/engine-double-contract.pinned.json

Delta round on the record of head 86277929 (comment 7240328990), which left S1 open and N1 accepted. This is a full record of the whole PR at b78754eb.

Face: the schema face, as record-recognisers.mjs --template --paths decides it from the one hits file. The PR declares Clause-②: no (narrowing) and Metadata-protocol: narrowed, so the narrowing face's floor (every path of the diff outside the prose faces) and its question (does the narrowing take a declared capability away, or make the spec's own refusal real) are applied to the whole diff, as the previous record did. The changeset is read for ② and for the S1 wording.

Inputs read: card #35924 with all seven comments (triage 7049063373, claim 7235625763, the three os-dev-report comments 7238787161, 7240218943 and 7240392585, the claim amendment 7240342599), PR #38299's body, file list, net diff against main and its comments, the commit 86277929..b78754eb, and the check-runs on the head. Code outside the diff was read at the head for the two doors' answers: protocol-history-and-publish.ts (the batch's failed[] builder), packages/spec/src/api/protocol.zod.ts (PublishPackageDraftsResponseSchema) and packages/runtime/src/domains/packages.ts.

What moved since 86277929: two files, 4 insertions and 2 deletions. One sentence group in .changeset/35924-publish-reparses-object-draft.md and the surface string of the ledger entry. No file under packages/metadata-protocol/**, no test, no pinned-ledger row and no other packages/spec/src file is in that commit, so no code moved. The entry's id, replacement, reason and acceptanceCriteria are byte-identical to the reviewed head.

① Derived judgments

  • Accept set at the publish doors: narrowed, and declared so. A pending object draft whose stored body the current ObjectSchema refuses after the ADR-0087 chain published before and is refused now. Right, unchanged since 86277929.
  • The narrowing makes the spec's own refusal real at a second door and takes no declared capability away: the schema asked is the save door's own (resolveOverlaySchema('object', …)), so every body the promotion refuses is one a save refuses today, and a body a save admits today parses at promotion. The fresh-draft CONTROLs pin it on the per-item door, the package door and the judge-first package door. Unchanged.
  • Published surface of @objectstack/spec: one migration-ledger entry, data only; no schema, accept set or API export moves. The delta changes that entry's surface text alone. Right.
  • Published surface of @objectstack/metadata-protocol: unchanged by the delta; the new module's exports are not re-exported from the package entry.
  • Wire envelope, the subject of S1, re-read in the tree at this head. Per-item publish: the thrown INVALID_METADATA / 422 with issues[] reaches the caller. Package publish: publishPackageDrafts catches the same throw and answers success: false, outcome: 'refused', with the causal draft in failed[] carrying code (from clientFacingFailureCode(e)) and issues (from e.issues), on a 200; PublishPackageDraftsResponseSchema tells consumers to read outcome, not the boolean or the HTTP status. The test pins outcome: 'refused' and failed[].code: 'INVALID_METADATA' on both package paths. The entry and the changeset now say exactly this.
  • Order in promoteDraftForPublish, the judge-only return, the chain-converted body, the single repo.promoteDraft call site and the three pinned-ledger rows: as judged on 86277929; none of those files moved.

② Semver level

  • @objectstack/metadata-protocol minor and @objectstack/spec patch: right, and the frontmatter is untouched by the delta. A declared narrowing ships minor in the launch window; spec gains one data-only ledger entry, as the landed precedent fix(lint)!: publish-time checks for views, dashboards and the app shell that save and do not work #38107 did.
  • Clause-②: no (narrowing) and Metadata-protocol: narrowed agree on the changeset and the PR body. The title carries !; the changeset keeps the BREAKING banner, the FROM → TO section and the ADR-0087 disposition registered publish-refuses-object-draft-the-current-schema-refuses, whose id is the entry's id.
  • Gate conclusions on b78754eb: every completed check-run is success or skipped. Among them Check Changeset, Test Core (all 12 shards), Test UI (all 16), Lint & Repo Gates, TypeScript Type Check, Spec property liveness, Dogfood Regression Gate, PR-body guards and Governed Surface Queue Guard. No red run on this head.

③ Boundary flags

  • open_questions: empty in all three reports. Nothing to answer.
  • Third report, dogfood battery not re-run locally at b78754eb. Answered by the check-run: Dogfood Regression Gate is success on this head.
  • Third report, pr_body_patch with two before/after pairs, not applied by the dev. Answered under N2 below; it is the seat's edit on a prose face.
  • Claim amendment 7240342599 names the six files the PR touches. The diff against main is exactly those six. Right.
  • Flags answered on 86277929 stand as answered: the Metadata-protocol: none claim against Done-when 4 (the seat's ruling, narrowed), the file surface beyond the first claim, and the object-only scope, whose residual question for other types stays escalated to the lane seat as a follow-up card and is not a finding on this head.
  • SQL push-down: the diff adds no query, no id materialisation and no in-app join. The delta adds no code at all.

④ Design judgment

S1: closed

19.publish-refuses-object-draft-the-current-schema-refuses.ts (hits), every published sentence against the tree:

  • surface: now two statements, one per door. "The per-item publish refuses it 422 INVALID_METADATA with the save door's issues[]" holds. "The package publish answers outcome: 'refused', with the draft in failed[] under code: 'INVALID_METADATA' and the same issues[]" holds: it is the shape publishPackageDrafts builds for the causal item and the shape the test asserts. The sentence no longer names an HTTP status for the package door, so an upgrader scripting that door against the entry is pointed at outcome. The string concatenation and the escaped quotes are well formed; TypeScript Type Check and the spec gates are green on the head.
  • replacement: "Fix the keys the refusal's issues[] names, save the draft again … then publish". Door-neutral and true of both: each door's refusal carries issues[]. Holds.
  • reason: names no status code. "The next publish of such a draft is refused, the draft stays a draft, and a package publish refuses its whole batch with nothing promoted" is true of both doors. Holds.
  • acceptanceCriteria: "a publish of every object draft the package carries succeeds". Names no refusal shape. Holds, as judged on 86277929.

.changeset/35924-publish-reparses-object-draft.md, the sentence S1 asked to move with the entry: it now reads per door. "The per-item publish answers 422 INVALID_METADATA with the same issues[] a save of that body gets" holds. "The package publish answers outcome: 'refused' (read outcome, not the HTTP status), with the draft in failed[] under code: 'INVALID_METADATA' and the same issues[], and its whole batch is refused with nothing promoted" holds, and its parenthesis repeats the response schema's own instruction. "Each answers with the save door's refusal before anything is written" and "Either way the draft stays a draft" hold for both doors, the judge-first pass included. The one remaining 422 earlier in the changeset describes a save, which is right. The FROM → TO section names no status code.

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 promoteDraftForPublish throws, which is the 422 envelope on both paths, and the second is the per-item measurement; the body's own Tests section states the package door correctly (outcome: 'refused', code: 'INVALID_METADATA' in failed[]). The body is not a published surface of either package, so nothing an upgrader reads is wrong. The dev's third report carries both exact before/after pairs as pr_body_patch; the seat can apply them to the PR body, which moves no head. Left to the seat.

protocol-promoted-draft-spec-refusal.ts, protocol-history-and-publish.ts, the test file and the pinned ledger: byte-identical to 86277929, where each was read sentence by sentence against the code it cites and found to agree. That judgment carries to this head. N1 stays an accepted deviation, as recorded there.

No must-fix, no should-fix.

Implemented-by: claude/issue-35924-publish-draft-refinement
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

维护者速读

  • 用户能看到什么变化:在 Studio 发布对象草稿时,若草稿是在某条更严格的对象校验规则上线前保存的,发布现在会像保存一样拒绝它(单项发布返回 422;按包发布返回「已拒绝」并列出原因),草稿原样保留;正常草稿照旧发布。
  • 为什么做:保存与发布两道门对齐,避免旧草稿绕过新校验直接上线。
  • 出错会怎样:升级时仍有待发布旧草稿的环境,这些草稿发布会被拒(已标为破坏性变更并写入升级指南);按提示修正后重新保存即可;不涉及数据迁移,可直接撤回。
  • 要你做什么:这是一处「收窄」(以前能发布的现在会被拒),按规则要你批准才能合并:请在 PR 上点 Approve 或入队,之后由席位落地。

席位意见:建议批准。合同审查(CONTRACT_REVIEW_TIER)两轮:首轮 PASS 留 S1(升级指南把包发布门写成 422,实际是 200 + outcome)→ 修正后本 head 上 PASS(记录 7240999573,S1 已关闭),守卫读取器读通。

席位核对 · ACCEPT · head b78754ebcd1186193e9ff67217c909be7e056673 · 2026-11-28T14:53Z · card #35924

  1. Shape: first line Fixes #35924, title fix(metadata-protocol)!:. Clause-②: no (narrowing) · Metadata-protocol: narrowed appear on the body and the changeset, with the BREAKING banner, the FROM → TO, and the ADR-0087 disposition registered publish-refuses-object-draft-the-current-schema-refuses (its id matches the ledger entry's id). Fixes is right: Done-when 1–4 are met, and the declaration follows the seat's ruling, narrowed.
  2. Contract review: the record on 8627792 was PASS with S1 open. The delta record on this head, 7240999573, is PASS with S1: closed and nits N1 and N2. N2 (PR-body shorthand) is applied by the seat from the dev's pr_body_patch: 2 hunks, read back identical.
  3. Evidence: the per-item, package and judge-only refusal pins plus 4 CONTROLs pass 9/9. The legacy-spelling CONTROL takes its key from the retirement kit's fixture. Ablations were red, then restored. The dogfood battery at f7534a6 passed (491 files), and the Dogfood Regression Gate passes on this head.
  4. Out of scope: only object drafts are re-parsed at promotion. Whether other types with a registered schema have the same latent gap is a follow-up, to be filed with its reach measured first (escalated by the record).
  5. Gates at this head: every completed check-run is success or skipped, Check Changeset included. NOT governed by path. The claim was narrowed to the six files (amendment 7240342599), per the ruling on pm-dispatch: a claim's File surface names the files a card will touch, and the in-flight check reconciles each claim against its PR #38333.
  6. Landing: a declared narrowing is Tier H by the queue guard's narrowed leg. It is handed to the approver with pm:awaiting-merge. After an authorized approval the seat lands it, or the approver may enqueue it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Request: approval · PR #38299 declares a narrowing (Clause-②: no (narrowing)), so the queue guard lands it only with an authorized approval. The seat ACCEPT and the maintainer brief are on the thread. CONTRACT_REVIEW_TIER PASS on head b78754eb (S1 closed). Please approve or enqueue.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 28, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 28, 2026 14:57
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit ad3d04f Nov 28, 2026
80 of 81 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-35924-publish-draft-refinement branch November 28, 2026 15:27
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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue 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.

metadata publish: a draft saved before an ObjectSchema refinement landed is promoted without being parsed again

3 participants