Skip to content

feat(mcp): the open draft door saves and discards drafts, and each save answers with its publish verdict - #35103

Merged
objectstack-fleet[bot] merged 34 commits into
mainfrom
claude/issue-34766-mcp-draft-door-write
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 34 commits into
mainfrom
claude/issue-34766-mcp-draft-door-write

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #34766

Claim on the card naming this branch: 6974854210 (PR-a #35059 merged as 78f3ab2; this PR carries the rest).

Requested by Yibo Wang · project thread

The read half (#35059) is on main; this PR is the write half and completes the card.

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:开放 MCP 草稿门新增 save_metadata_draft、delete_metadata_draft 两个写工具;list_drafts 每条草稿附带发布裁决。metadata-protocol 的 draftPublishJudgement 改为公开方法,可直接读已存草稿。写入与裁决同 /meta 一样先过类型级读写准入。读工具一半已在 main 上,本 PR 只含写的一半。
  • 为什么改:AI 通过 OAuth 写元数据时只落草稿,同一次回复里就能看到"发布会被拒在哪条规则、哪个路径、下一步怎么做",由人在 Studio 审核发布。
  • 风险与回滚:新增写面但只写草稿,无发布工具、无 force;受令牌授权范围与用户元数据管理能力双重门禁、/meta 类型级准入和 walled 租户拒写约束。回滚即 revert 本 PR,读的一半不受影响。
  • 先看:packages/runtime/src/domains/mcp-authoring.ts(save/delete 分支、typeAdmission、list_drafts 的逐条裁决,每个包的发布闭包每次调用只收集一次)、packages/metadata-protocol/src/protocol-authoring-gate.ts(无 body 时读已存草稿)、packages/mcp/src/mcp-server-runtime.ts(initialize 文案)。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run --project local --maxWorkers=2 src/domains/mcp-authoring.test.ts,预期 37/37 通过,其中 done-when 用例返回 flow-trigger-unroutable 及其路径与 hint。
  • 需要你做的:无,席位落地。

What changes

  • D2, the public verdict. ObjectStackProtocolImplementation.draftPublishJudgement is now public. The facade line stays at its ceiling: the change is in place, with a delta of 0 lines. With no body, the gate reads the stored draft at type/name/packageId (and member for a bundled type), and an absent draft answers 404 NO_DRAFT. It is the same judgement the draft read and the publish gate run; there is no second routine.
  • save_metadata_draft({ type, name, item, package, ifMatch? }) calls saveMetaItem with mode: 'draft', surface: 'mcp' and client.id set to the token's OAuth client, plus writeFace: 'meta-dispatch'; ifMatch maps to parentVersion. The reply holds three parts:
    • saved: type, name, package, state and version.
    • verdict: publishable, plus refusals and advisories, each with rule, path, message, hint and severity.
    • review: the Studio routes /studio/PKG/interfaces?changes=review and /studio/PKG/metadata/TYPE/NAME?review=1.
    • If the judgement throws, the reply says verdict: null plus verdictError. The draft stays saved and the save is not reported as refused.
  • D4. A save with no package is refused 400 VALIDATION_ERROR, naming the writable packages (capped at 20). package is deliberately left out of the JSON schema's required list: the SDK enforces required, so listing it there would make this named refusal unreachable.
  • delete_metadata_draft({ type, name, package? }) calls deleteMetaItem with state: 'draft'.
  • list_drafts. Each draft carries its verdict, gated per item with the read half's item read gate. A draft the human may not read gets verdict: null plus verdictWithheld, so no finding derived from its body leaks. The list itself stays ungated, matching /meta/_drafts, and state draft keeps the overlaid getMetaItems read.
  • One closure per package per list_drafts call (contract review S1). A draft's publish closure, the package's other drafts that a package publish judges it against, depends on the package alone. draftPublishJudgement takes an optional packageClosures map: list_drafts hands one map to every judgement of the call, so each package's closure is collected once, on its first draft. A call without the map collects per call, as before; the save's judgement passes none. The loop's comment states why each per-draft read remains. The strict draft read is the item gate's own read, and like every /meta draft read it folds a verdict into _diagnostics. The judgement reads the row as stored, which the served copy is not, and returns each finding whole, with its hint. Per package of N drafts, closure collections go from 2N to N + 1.
  • Gates. The same D1 gate covers every tool. Both writes then ask the /meta type-level write admission (metaTypeWriteRefusal, the save as PUT, the discard as DELETE) with the human as the caller, and then walledCatalogWriteVerdict with the envelope's tenancy posture, before anything is written: a metadata type the caller may not write is refused 403, a walled tenant is refused 403, and a platform admin is admitted. A failed posture read answers 503 and nothing is written. The authoring admission alone does not cover a type whose own write door requires more.
  • Verdicts and the type-level read admission. A verdict is a read of the stored draft's body, so the save's verdict and each listed draft's verdict are told only where metaTypeReadRefusal admits the human; elsewhere the reply carries verdict: null and verdictWithheld. The reads keep the read half's rule as landed on main: both read tools ask the same admission before any read, now through the one helper the writes share.
  • Type fold. type is folded to its canonical singular before any gate, verdict, refusal or write, through the read half's one module helper canonicalTypeOf, as landed on main; there is no second copy, and list_drafts' per-draft fold goes through the same helper.
  • initialize. When the authoring tools are listed, the open server's default instructions add one paragraph: these tools save drafts only, and a person publishes them in Studio. The paragraph is absent when the tools are not served.
  • Refusals carry their findings. A coded protocol refusal keeps its code, status and message and now also relays the thrown issues[]: the save states the meta-dispatch face, which trims a spec-validation refusal's message to a headline because that face declares a structured channel, so the findings travel beside it.
  • Registry-question producers. The save is recorded in REGISTRY_QUESTION_PRODUCERS (packages/metadata-protocol/src/registry-question.ts), by face: meta-dispatch and always mode: 'draft', so the body-only question. The face set's note now says meta-dispatch is stated at a second door. The runtime repo tier's producer census (metadata-registry-question-producers.test.ts) reads that ledger.
  • check:system-context-census. openWriter reads the envelope's isSystem for the walled verdict, so row 55b of content/docs/permissions/system-context.mdx now lists the draft save and discard among its doors and names openWriter; the generated site register was rewritten by --write.
  • check:durability-log-level. The tool switch's outer catch guards saveMetaItem and returns refusalFromThrown on its only path, an isError tool result carrying the error envelope. That hands the failure to the caller, so the site is declared in FAILURE_PROPAGATION_SITES (packages/runtime/src/domains/mcp-authoring.ts::execute, callee refusalFromThrown, via: 'return'), the remedy the gate's own text and AGENTS.md name for this shape; no log was added.

Tests

At 50b2d84512 (the S1 fix round; tree 98ddc83bd2, which the runs below measured):

  • Runtime src/domains/mcp-authoring.test.ts: 37/37. The new pin: three flow drafts in one package, real protocol, real SQL store. One list_drafts makes N + 1 closure collections (spy on collectBatchPendingDeclarations): one per strict draft read and one shared by the door's judgements. Each listed verdict equals the same draft judged alone.
  • metadata-protocol protocol.draft-publish-verdict.test.ts: 62/62. The new pin: one map for a pass of three judgements collects once, and the answers equal three calls without the map, which collect three times.
  • mcp full suite: 71 files, 1269/1269.
  • Typecheck exits 0 for metadata-protocol, runtime (with check:test-typecheck) and mcp.
S1 ablations

Both ran through scripts/ablation-replace.mjs under the verify lock. Each anchor went 1 -> 0, and each restore read the blob equal to HEAD's with git diff HEAD empty.

  • Runtime: a fresh map per draft (gatedDraftVerdict(protocol, draft, new Map())) gives collections 6, where the pin expects 4: 1 failed. The runtime module is imported from src/.
  • metadata-protocol: removing the map's set, so nothing is shared, gives collections 3, where the pin expects 1: 1 failed. The suite imports ./protocol.js from src/.

Earlier rounds, at 8709c889fe (the merge of origin/main at 99a0e4fbfc, which carries the read half's squash 78f3ab2aa3):

  • Runtime src/domains/mcp-authoring.test.ts: 36/36. This includes the done-when end-to-end test on the app-crm shape, run against a real SqlDriver (better-sqlite3) store with crm_opportunity:
    • An unnamed save is refused 400, naming the authored package.
    • The save answers flow-trigger-unroutable with its path and hint.
    • list_drafts lists the draft with the same verdict.
    • The delete empties the list.
  • Runtime repo tier src/metadata-registry-question-producers.test.ts: 3/3.
  • metadata-protocol protocol.draft-publish-verdict.test.ts, sys-metadata-repository.draft-drain.test.ts (it reads the durability script), protocol.invalid-metadata-422-face-inventory.test.ts and protocol.destructive-409-face-inventory.test.ts: 4 files, 132/132.
  • mcp full suite: 71 files, 1269/1269.
  • Typecheck exits 0 for runtime, mcp and metadata-protocol.
  • Pins this half adds:
    • On the real protocol, a save the schema refuses answers 422 INVALID_METADATA with its structured findings beside the headline, and writes nothing.
    • A type the caller may not write is refused on the save and the discard before anything is written; a holder of the type's capability writes it.
    • A save of a type the caller may not read lands, and its verdict is withheld rather than read.
    • list_drafts withholds the verdict of a draft whose type the caller may not read, without reading its body.
    • On the real protocol, an inherited member's name as type (constructor, toString), which the fold keeps as sent, is refused on save and discard and leaves no draft.
Ablations

Each ran through scripts/ablation-replace.mjs under the verify lock. The suite imports the module relatively from src/, so no dist/ is on the subject's path. Every restore read the blob equal to HEAD's, with git diff HEAD empty.

At 8709c889fe, re-run after the merge (restored blob == HEAD 647fb95516d8):

  • Dropping the one fold (canonicalTypeOf returns the type as sent): anchor 1 -> 0; 3 failed / 33 passed — the read half's plural-fold pin, its folded-type pin and this half's save/verdict/discard fold pin.
  • Dropping the type-level read admission (typeAdmission admits every read): anchor 1 -> 0; 3 failed / 33 passed — the read half's type-admission pin, the save-verdict pin and the list_drafts pin.

Recorded earlier, at 1294fe181c (restored blob == HEAD 04e3fe15e4fc) and 7cbb4252a9 (restored blob == HEAD 647fb95516d8); no file they mutate has moved since 7cbb4252a9:

  • Dropping verdict from the save reply: 2 failed / 33 passed (the save-shape pin and the done-when pin).
  • Dropping the package requirement: 2 failed / 33 passed (the D4 pin and the done-when pin).
  • Dropping the type-level write admission: 1 failed / 34 passed (the write-admission pin).
  • At 7cbb4252a9, dropping the relayed issues: 1 failed / 35 passed (the structured-findings pin).

Acceptance notes

Verification

At 50b2d84512 (tree 98ddc83bd2):

  • dispatch-gates --commands derived 125 families (14 paths vs merge base 99a0e4fbf). Each one ran with its exit code captured before any pipe. 123 exited 0 on the first pass. check:skill-examples and check:dual-build-cjs-loads exited 3, a prerequisite failure: some packages were not built. Both exited 0 after turbo run build --filter='./packages/**' (81/81 tasks). dispatch-gates --ran with the exit codes recorded: "125 derived, 125 run, 0 NOT-MEASURED, 0 UNRUN", a derived zero.
  • check-governed-merges --branch HEAD: NOT governed, 1175 changed lines (+1115 / -60) over 14 files.
  • overlap-check --branch=HEAD: VERDICT clean against origin/main 910306b632 and fix(audit): a search the server widens never names a column the caller may not query #34817.
  • check-nul-bytes: exit 0. No exported symbol is renamed or removed.

Earlier rounds:

  • Merged origin/main at 99a0e4fbfc into 7cbb4252a9, as 8709c889fe. The read half's squash gave an add/add conflict on packages/runtime/src/domains/mcp-authoring.ts and its test, and a content conflict on packages/mcp/src/skill-md-surface-guard.test.ts. This branch had merged the read half's final head c2fa38c8b4, whose blobs equal main's for all seven of that half's files, so each conflicted path takes this branch's side: main's landed content plus this half only.
  • How the delta was checked: git diff --name-only origin/main...HEAD and the two-dot form name the same 14 files, and none of the read half's four other files (its changeset, the design note, mcp.ts, check-route-envelope.mjs). Per file, the patch origin/main..HEAD is byte-identical to this half's own patch before the merge: 78f3ab2aa3..7cbb4252a9 for the three conflicted files, and merge base aef42cba4e..7cbb4252a9 for the other eleven. The read half's changeset is main's, unchanged and out of the diff; this half carries only its own two.
  • overlap-check --branch=HEAD: VERDICT clean against origin/main 99a0e4fbfc, fix(analytics): a grouping or time word with only a near dimension does not stop a matched measure #35156 (shares packages/mcp/src/initialize-selection-rule-34686.test.ts and packages/mcp/src/mcp-server-runtime.ts) and fix(audit): a search the server widens never names a column the caller may not query #34817 (shares content/docs/permissions/system-context.mdx).
  • check-governed-merges --branch HEAD: NOT governed, 1088 changed lines (+1032 / -56) over 14 files, under 3000. dispatch-gates --tier exit 0.
  • dispatch-gates --commands derived 125 families (14 paths vs merge base 99a0e4fbf); each ran with its exit captured before any pipe. 123 exited 0 on the first pass; check:skill-examples and check:dual-build-cjs-loads exited 3 (prerequisite: unbuilt packages), and both exited 0 after a workspace build (pnpm build, 120/120 tasks). dispatch-gates --ran: "125 derived, 125 run, 0 NOT-MEASURED, 0 UNRUN", a derived zero. check-platform-checklist --changed-from origin/main: 0 anchors lost. check-nul-bytes exit 0. Every family CI runs is read from this PR's check-runs.

Generated by Claude Code

…design note and changeset

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…ard VALIDATION_ERROR

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…during collection

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…he dispatcher domains

The route-envelope census enumerates every module in packages/runtime/src/domains;
mcp-authoring.ts builds MCP tool results and no REST body, so it declares handBuilt 0.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…th the human as the caller

get_metadata_item and list_metadata_items now judge every item through the
gates @objectstack/rest exports (createMetaItemReadGate under the stored-version
door policy, createMetaListReadGate), with a caller built from the human's own
grants. A dashboard, list view or app whose requiredPermissions the human lacks,
and a book or doc outside their audience, are refused or left out as every
/meta door does; a gate that cannot evaluate refuses. The draft-state list keeps
the overlaid read because the list gate judges item bodies, which draft rows do
not carry. The changeset declares Clause-② yes (widening).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…ding the stored draft when no body is handed

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…ow reference as the publish door does

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…wers each save and draft with its publish verdict

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
… done-when; the open server says authoring lands as drafts

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…to its canonical singular before any verdict, gate or write

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…te pins; the default-text pins read the drafts line

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…icts and the drafts line

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
@github-actions github-actions Bot added size/xl 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 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/mcp, @objectstack/metadata-protocol, @objectstack/runtime, touching 29 documentable anchor(s).

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

  • content/docs/automation/connectors.mdx (via clientId (symbol, a field of interface OpenAuthoringWriter))
  • content/docs/concepts/metadata-lifecycle.mdx (via ObjectStackProtocolImplementation (symbol, a top-level class), getMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in createOpenAuthoringRegistry), getMetaItems (literal, a string literal in OpenAuthoringProtocol), saveMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in REGISTRY_QUESTION_PRODUCERS))
  • content/docs/data-modeling/drivers.mdx (via getMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in createOpenAuthoringRegistry))
  • content/docs/deployment/environment-variables.mdx (via getMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in createOpenAuthoringRegistry), getMetaItems (literal, a string literal in OpenAuthoringProtocol))
  • content/docs/deployment/validating-metadata.mdx (via saveMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in REGISTRY_QUESTION_PRODUCERS))
  • content/docs/kernel/cluster.mdx (via ObjectStackProtocolImplementation (symbol, a top-level class), saveMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in REGISTRY_QUESTION_PRODUCERS))
  • content/docs/kernel/contracts/auth-service.mdx (via clientId (symbol, a field of interface OpenAuthoringWriter))
  • content/docs/kernel/services-checklist.mdx (via deleteMetaItem (literal, a string literal in OpenAuthoringProtocol), getMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in createOpenAuthoringRegistry), getMetaItems (literal, a string literal in OpenAuthoringProtocol), getMetaTypes (literal, a string literal in OpenAuthoringProtocol), saveMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in REGISTRY_QUESTION_PRODUCERS))
  • content/docs/permissions/authentication.mdx (via clientId (symbol, a field of interface OpenAuthoringWriter))
  • content/docs/permissions/authorization.mdx (via saveMetaItem (literal, a string literal in OpenAuthoringProtocol; a string literal in REGISTRY_QUESTION_PRODUCERS))
  • content/docs/permissions/sso.mdx (via clientId (symbol, a field of interface OpenAuthoringWriter))
  • content/docs/permissions/system-context.mdx (via openWriter (symbol, a top-level function), delete_metadata_draft (literal, a string literal in OPEN_AUTHORING_WRITE_TOOL_NAMES; a string literal in WRITE_TOOLS; a string literal in createOpenAuthoringRegistry), save_metadata_draft (literal, a string literal in OPEN_AUTHORING_WRITE_TOOL_NAMES; a string literal in WRITE_TOOLS; a string literal in createOpenAuthoringRegistry))
  • content/docs/plugins/adding-a-metadata-type.mdx (via getMetaTypes (literal, a string literal in OpenAuthoringProtocol))
  • content/docs/plugins/index.mdx (via clientId (symbol, a field of interface OpenAuthoringWriter))

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

  • content/docs/releases/v16.mdx (via ObjectStackProtocolImplementation (symbol, a top-level class))
  • content/docs/releases/v17/17-0.mdx (via ObjectStackProtocolImplementation (symbol, a top-level class))

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
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 42 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 ba6556c617bc201f1d4b635c609b28b589583c36 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 9b6b14649149d36f09dab245c0962f00ff109e1f — the merge of head 2d6a72269b60b270ca669ea19da843d0ec6b3ddf into base ba6556c617bc201f1d4b635c609b28b589583c36, 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 9b6b14649149d36f09dab245c0962f00ff109e1f && git checkout 9b6b14649149d36f09dab245c0962f00ff109e1f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ba6556c617bc201f1d4b635c609b28b589583c36 2d6a72269b60b270ca669ea19da843d0ec6b3ddf && git checkout -B drift-repro ba6556c617bc201f1d4b635c609b28b589583c36 && git merge --no-ff 2d6a72269b60b270ca669ea19da843d0ec6b3ddf

node scripts/docs-audit/affected-docs.mjs --json ba6556c617bc201f1d4b635c609b28b589583c36

⚠️ 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 ba6556c617bc201f1d4b635c609b28b589583c36 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…every spelling meets the /meta read gates

The protocol's reads fold `type` (`dashboards` reads the dashboard), and the
/meta read gates judge the singular type only, leaving the fold to their
caller. The door handed the raw argument to both, so a plural or alias
spelling was read by the protocol and judged by no gate. It now folds once
with `canonicalMetaUrlType`, the protocol's own fold, and hands the folded
type to the protocol read, the unknown-type refusal and both gates. A name the
fold answers no string for (an inherited member such as `constructor`) goes on
unfolded and is refused as an undeclared type.

The pins' protocol double folds as the real one does; `dashboards` and `docs`
are refused on the item read and left out of the list.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
…ol as the string sent

The fold answers a function for `constructor` or `toString`; the door keeps the
agent's string then, the spelling every /meta door hands the protocol.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
The conflict in packages/runtime/src/domains/mcp-authoring.ts is resolved to
ONE fold helper: PR-a's module helper canonicalTypeOf (which keeps the agent's
string when the fold answers a non-string for an inherited member's name)
replaces this branch's local copy, and list_drafts' per-draft fold now goes
through it too.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
The one conflict, packages/mcp/src/initialize-selection-rule-34686.test.ts, is
two describes added at the same place: this branch's drafts-line pins and
main's nextStep/sourceLine pins. Both are kept, in that order.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
… save catch delivers the failure

The tool switch's outer catch in packages/runtime/src/domains/mcp-authoring.ts
guards saveMetaItem and returns refusalFromThrown on its only path: an
isError tool result carrying the ADR-0112 envelope built from the caught
error. The failure is handed to the agent that asked, so the gate's remedy is
a FAILURE_PROPAGATION_SITES declaration scoped to that one function, not a
log.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
…' type is refused and writes nothing

Against the real protocol on a SqlDriver store: save_metadata_draft and
delete_metadata_draft with type `constructor` or `toString` (which the door's
fold keeps as sent) answer an error and leave no draft.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
…system-context page

The open MCP server's draft save and discard ask walledCatalogWriteVerdict
with the envelope's isSystem in openWriter; row 55b now lists that door and
names the symbol, and the generated site register carries its read.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot changed the title WIP: feat(mcp): the open draft door saves and discards drafts, and each save answers with its publish verdict feat(mcp): the open draft door saves and discards drafts, and each save answers with its publish verdict Nov 18, 2026
…e registry-question producers, and relay a refusal's structured findings

The runtime repo tier's producer census (metadata-registry-question-producers)
went red: the open MCP draft door's save_metadata_draft is a request-carrying
saveMetaItem call no ledger row recorded. REGISTRY_QUESTION_PRODUCERS now
records it, by face: face meta-dispatch, always mode draft, so the body-only
question. The face set's note says meta-dispatch is stated at a second door.

The meta-dispatch face trims a spec-validation refusal's message to a headline
because the face declares a structured issues channel. The door's coded
refusal now relays the thrown issues beside the message, so the finding that
names the key reaches the agent.

Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
Co-authored-by: Claude <noreply@anthropic.com>
… write half

The read half landed on main as one squash commit, so its three files
arrived as an add/add (and one content) conflict against this branch,
which had merged that half's final head. That head's blobs equal main's
for all seven of its files; each conflicted path is resolved to this
branch's side, which is main's landed content plus the write half only.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Final green head · 2026-11-18T10:08Z: 8709c889fe206ee7e612fe3970fe86e87a30cf2c (merge of origin/main 99a0e4f after PR-a #35059 squash-merged as 78f3ab2; dev report on #34766). CI: 44 success, 19 skipped, 0 red on the latest run of each check (the PR-body guard's 09:40Z red was the missing branch claim, fixed by claim 6974854210 on #34766; its 09:46Z re-run is green). Not governed (check-governed-merges), +1032/-56 over 14 files. This PR now carries the rest of the card: Fixes #34766. Owed: full L1-b, then the seat contract review at this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Contract-review-claim: session_01JQwxbWDsbbJizuYnDwBxT8 · head 8709c889fe206ee7e612fe3970fe86e87a30cf2c · 2026-11-18T10:08Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXr9wLAH24MEgxaLud

席位核对

L1 full · ACCEPT · Head-sha: 8709c889fe206ee7e612fe3970fe86e87a30cf2c · card #34766 (Fixes #34766, PR-b) · read 2026-11-18T10:13Z

Net diff against merge base 99a0e4fbfc: 14 files, +1032 / -56. It adds the write half of the MCP draft door: two write tools, a publish verdict in the same reply, and verdicts on list_drafts.

Against the card

  • Fixes is right. PR-a (the read half) is merged. This PR carries the rest of the card's done-when, so the merge should close the card.
  • Done when, each item.
    • A draft whose stored form fails a publish rule gets that finding in the save reply. The test runs the card's own example, the app-crm flow with no routable trigger.
    • The saved draft is a normal mode: 'draft' write, so it shows in Studio's Changes review. The reply links both the Changes view and the item review.
    • A caller the D1 gate does not admit sees none of the five tools. That gate is on main and unchanged here, and the initialize drafts line is served only when the tools are.
  • File surface. The card says the PR reads packages/metadata-protocol, but it changes protocol source: draftPublishJudgement becomes public and can read the stored draft itself. Claim 6974854210 names this PR's 14 files at this head, so the change is inside the claimed surface. I note the gap between card and claim for the seat.

Read at the head

  • Gate order on the write doors, at rule level.
    • The type name is folded through the one canonical helper on every path, so an alias cannot pass a gate under one spelling and be written under another.
    • Save and discard each run the type-level write admission for their own verb, then the walled-catalog verdict, then the write. A refusal at any step writes nothing.
    • Save needs a package. A missing one is a 400 that names the packages the caller can write, capped. Writability itself stays with the repository.
    • There is no publish tool and no force flag. Every save is mode: 'draft' on the MCP surface with the client recorded, and ifMatch maps to the parent version.
  • Verdicts are gated, at rule level.
    • The save reply runs the type-level read admission before any verdict. When it refuses, the draft is still saved and the reply carries verdict: null with the refusal in verdictWithheld.
    • list_drafts runs the type-level read admission, then the item read gate under the stored-version door policy, then the judgement. A withheld or failed verdict is null, never a partial one.
    • A judgement that throws becomes verdictError, not a failed save.
  • draftPublishJudgement. It is public now and takes an optional body. With no body it reads the stored draft for that package (and member, when one is given), and a missing draft is a 404 NO_DRAFT. Callers that pass a body behave as before.
  • Wiring rows. REGISTRY_QUESTION_PRODUCERS has the new producer (by face, always draft). The durability gate has the new failure-propagation site. system-context.mdx row 55b and its register row name both doors and the writer. The skills surface guard checks all five tool names against the native tools, and I found no hosted tool with the same name.
  • Tests. There are 36 runtime cases. They cover the save verdict, the fold, a write-admission refusal, a withheld verdict, a walled save and a walled discard, a verdict error, no writer, the item gate on list_drafts, the card's app-crm case, a schema refusal relaying issues[], and an inherited member name. There are also the protocol cases for the body-less read and the 404, and the initialize cases for the drafts line.
  • Changesets, read sentence by sentence. There are two: the runtime and MCP one, and the metadata-protocol one. Both are patch, Clause-②: yes (widening) (new tools and a new public method, and no reply loses a key) and Metadata-protocol: none (what an author can write is unchanged). These are the right levels. No changeset already on main is edited.
  • Merges cleanly onto origin/main 7d8dcf693a.
  • Check-runs at this head: 63 in total, all success or skipped. One PR-body guards run failed and was replaced by a green run on the same head.

Should-check (for L2, does not block L1)

  • The save reply runs only the type-level read admission before its verdict, while list_drafts also runs the item read gate. On save the caller just wrote the draft, so that difference looks right. L2 should still confirm that no finding in the verdict carries text from another item the caller could not read on its own.

Nits (none blocks)

  • A type value that is not a plain metadata type name can reach a 5xx instead of a 4xx. The dev report flags this out of scope with no carrier. It belongs in a small follow-up card.
  • The write-tools changeset names an example and the admission it needs, in the same words as the read-half changeset already on main. The seat weighs this under the card's disclosure rule.
  • The PR's assignee and its body's attribution lines do not follow the lane's usual shape. The seat can tidy these before landing.

Not mine, still owed before landing

  • Contract review at this head (the seat's run is in progress).
  • Landing after that, through the seat.

@objectstack-fleet

objectstack-fleet Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 8709c889fe206ee7e612fe3970fe86e87a30cf2c
Local-runs: none

Full review of PR #35103 (PR-b of card #34766, the write half of the open draft door), declaration face. Read: the card body and all fourteen comments (the claims, the dev reports, and the PR-b hand-off 6968071928 among them); the PR body, its 14-file list, and the net diff against main (merge base 99a0e4fbfc, +1032/-56); every PR comment, including L1-b's ACCEPT 6975500299; the four records on #35059 (6967316983, 6969515963, 6971674038, 6971726027); and the check-runs on the head. Code outside the diff was read at the head to judge the diff's claims, and was not reviewed. There is no must-fix and one should-fix (S1, the cost of the per-draft verdicts, Prime Directive 5). The verdict is PASS.

Check-runs on the head, taking the latest run of each name: 55 names, 38 success, 17 skipped, none red and none in progress. All ten Test Core shards, Type Check · workspace, Type Check · consumer gates, Type Check · source gates, Type Check · debt ledger, TypeScript Type Check, Build Core, Check Changeset, Spec property liveness, Governed Surface Queue Guard, every Lint run and the PR-body guards re-run at 09:46Z concluded success. The PR-body guard's 09:40Z red was the missing branch claim, and the re-run on the same head supersedes it.

① Derived judgments

  1. Only the write half is in the diff. RIGHT.
    • None of the read half's four other files is in the diff: its changeset, the design note, mcp.ts and the route-envelope table.
    • For the three files with merge conflicts (the module, its test and the mcp surface guard), the net patch against the merge base is byte-identical to 78f3ab2aa3..7cbb4252a9. That range is the write half's own delta on top of the landed read half. At the merge base, those files equal the landed squash 78f3ab2aa3.
    • I checked this by reading git objects; nothing was run. No read-half hunk is re-added or reverted.
    • The hunks that touch read-tool code change nothing a read tool answers:
      • the item gate is factored into one local itemGate;
      • typeReadRefusal now goes through the shared typeAdmission, with the same predicate and the same caller;
      • two refusal texts are reworded.
    • The one exception is list_drafts, which now needs the verdict method (nit N3).
  2. (a) The folded type, through the one helper, with the human as the caller. RIGHT.
    • The save and the discard each call canonicalTypeOf(input.type) once. The save hands that one value to the type-level write admission, the walled verdict, saveMetaItem, the type-level read admission, draftPublishJudgement and the review route. The discard hands it to the write admission, the walled verdict and deleteMetaItem.
    • list_drafts folds each row through the same helper before it asks any admission, gate or judgement.
    • The module defines the helper once, with no second copy.
    • The admissions read readGate(...).resolveCaller(). That is the caller built from the human's own grants, never the agent envelope's ceiling.
    • The walled verdict reads posture and isSystem off the request envelope, as every /meta write door and the MCP import door do. The envelope assembly takes posture from the human's own resolution for an agent principal and sets isSystem: false, so this is also the human's value.
    • The inherited-member fallback is unchanged from the read half (carried nit). On the real protocol it is refused and writes nothing; that is pinned.
  3. (b) The type-level write admission before anything is written, and refusal of a type the human may not write. RIGHT.
    • The save asks metaTypeWriteRefusal as PUT, and the discard asks it as DELETE. Each does this before the walled verdict and before the protocol write, so a refusal writes nothing.
    • The verbs match the ones the /meta entry judges. /meta's save path asks no other per-type write gate: after the type-level write admission come the authoring admission (D1 here), the walled verdict and the closed query set, and this door states no query.
    • A registry with no writer refuses both writes. A failed posture read answers 503 and writes nothing.
    • Pinned: both spellings are refused on both tools with no write call made, and a holder of the capability writes.
  4. (c) A verdict is told only where the type-level read admission admits the human. RIGHT.
    • The save asks metaTypeReadRefusal after the save lands and before the judgement. If the human is refused, the reply carries verdict: null with verdictWithheld, and no judgement runs (pinned: the judgement is not called).
    • Each listed draft asks the same admission before any read of its body. Then come the strict draft read, the /meta item gate under STORED_VERSION_DOOR_POLICY, and the judgement.
    • A refusal or a fault at any step gives null plus the reason, never a partial verdict. For an unread type this is pinned: no protocol call names that type.
    • L1-b's should-check on the save, which runs no item gate: settled in ③ at rule level, with the detail in the reviewer's local note.
  5. (d) list_drafts stays at parity with the /meta drafts listing. RIGHT.
    • The rows follow the /meta drafts listing's rule unchanged. Only the new verdict member is gated.
    • This PR does not widen into the listing's own admission.
  6. (e) No publish tool. RIGHT.
    • The registry serves the three reads and the two writes, and nothing else. The default arm refuses any other name.
    • Every save is mode: 'draft', surface: 'mcp', with the write face of a door that has no force.
    • The request is built field by field, so nothing in item becomes a channel.
    • The discard is state: 'draft' only.
  7. (f) D4, the package requirement, and its named refusal. RIGHT.
    • A save that names no package is refused 400 VALIDATION_ERROR before any write. The refusal names up to 20 writable packages, taken from the protocol's own writability verdict, and it degrades to a pointer when they cannot be listed.
    • package is kept out of the schema's required list on purpose, so the named refusal can be reached. That is right.
    • Pinned on the fake protocol and on the real one: only a writable package is named, and nothing is written.
    • The discard takes package as optional. D4 names the save only.
  8. The public verdict method (D2). RIGHT.
    • draftPublishJudgement is made public in place, with a facade delta of 0 lines.
    • With no body, it reads the stored draft at its address, including the member, and an empty address is refused 404 NO_DRAFT, the strict draft read's own refusal. With a body, it behaves as before.
    • It is one judgement, not a second routine. The protocol pins check that its answer equals the body-handed call and that its refusals equal the per-item publish's 422 issues.
  9. Reply shapes and fail paths. RIGHT.
    • A judgement that throws after the save landed is reported as verdictError beside the saved identity, never as a refused save. A coded refusal below 500 keeps its code; a fault is named without its text, and one warning is logged.
    • A coded protocol refusal now relays issues[]. That matches the meta-dispatch face, which trims the message to a headline. It is pinned on the real protocol with no write.
    • The refusalFromThrown declaration in FAILURE_PROPAGATION_SITES is the remedy that gate prescribes for a catch that returns the failure to its caller.
  10. Wiring and the drafts line. RIGHT.
    • The REGISTRY_QUESTION_PRODUCERS row (by face, always draft, so the body-only question) is right. So are the face note and row 55b of the system-context page with its generated register row.
    • The surface guard now checks all five names against the native tools.
    • The initialize paragraph is added only where authoringToolsServed holds, which is the same gate that registers the tools. A host's or the configured instructions still replace the default text whole. The paragraph's presence and absence are pinned.
  11. Done when. RIGHT.
    • On a real protocol and a real SQL store, through the real domain, with the real identity door's envelope:
      • an unnamed save is refused with the writable package named;
      • the save answers the card's finding with its rule id, path and hint;
      • list_drafts lists the draft with an equal verdict;
      • the discard empties the list.
    • The second done-when cell, that a token without the authoring scope and an API key see no tool, is the D1 gate, which landed with the read half and is unchanged.
  12. Nits (no effect on correctness or the contract).
    • N1. The D4 refusal, including its protocol read of the package list, comes before the type-level write admission. /meta asks that admission before it resolves the protocol. Nothing is disclosed, because the same human can list packages through the read tool. Moving the admission above D4 would mirror /meta exactly.
    • N2. The module header's read section still says list_drafts "runs no item gate". That is true of the rows, and the write section now gates each verdict. One clause would reconcile the two.
    • N3. list_drafts now answers 503 on a host whose protocol has no verdict method, where it used to list. Listing the rows with the verdict withheld would keep the read tool's old reach.
    • N4. The walled refusal is pinned for both writes. Its admit arm, the platform operator under a walled posture, is not pinned here. The predicate is the shared one.
    • Carried from the read half and unchanged: the inherited-member fallback answers 5xx rather than 4xx, the second gate-port builder, and a gate fault answering 500 rather than 503.

② Semver level

  • .changeset/34766-mcp-draft-door-write-tools.md: @objectstack/runtime patch and @objectstack/mcp patch. RIGHT.
    • The runtime serves two new tools with new input schemas, and list_drafts gains a reply member.
    • mcp adds an initialize paragraph where the authoring tools are served.
    • No reply loses a member. The new exports of the module are not on the runtime's package entry.
  • .changeset/34766-mcp-draft-door-write.md: @objectstack/metadata-protocol patch. RIGHT. A private method of an exported class becomes public, and its body becomes optional, which widens what it accepts. The REGISTRY_QUESTION_PRODUCERS row is a ledger row with no behaviour.
  • Metadata-protocol: none in both changesets is RIGHT. The save runs the same saveMetaItem, schema and surface value that already exist, so nothing an author can write changes. A non-protocol widening ships patch, and no BREAKING banner or ADR-0087 disposition is owed.
  • Every sentence of both changesets agrees with the code read in ①. No changeset already on main is edited. Check Changeset concluded success.
  • Disclosure check: clean. The changesets, the PR body, the commit messages unique to this branch and the new test names state rules. The one example they give, and the capability names they use, are words the landed read-half changeset already carries. None of them names a type the type-level admissions list, the capability such a type requires, or a field or returned content tied to those admissions.
  • Clause-②: yes (widening). RIGHT in both changesets and in the PR body.

③ Boundary flags

  • L1-b should-check 6975500299 (verdict text and the item gate): settled. The save's verdict and the listed verdicts meet the same read rules as the /meta draft read gives the same human for the same stored draft: no widening over /meta. A /meta-wide question it raised went to the seat privately (security-findings §6); it does not block this head.
  • S1 (should-fix) — Prime Directive 5: list_drafts computes its verdicts one draft at a time with no stated reason.
    • Each listed draft costs a strict draft read, a second stored-row read inside the judgement, and a fresh listing of the package's drafts to build the publish closure.
    • So a package with N drafts makes about 3N reads and N closure collections over the same N rows, where one listing and one closure per package would serve them all.
    • The item gate's need for the strict read is a reason for that one read. It is not a reason for re-collecting the closure per draft, and the code states neither.
    • Fix: state the bound and the reason at the loop, or collect the package closure once and hand it to the judgement. Not blocking.
  • Hand-off 6968071928, every left item, answered.
    • The local fold copy is gone (① item 2).
    • The durability site is declared (① item 9).
    • The final-head gates are answered by the check-runs.
    • check:dual-build-cjs-loads is answered by Build Core and the type-check runs on the head.
    • The overlap with the expected neighbour is resolved: the dev's last report finds no conflicting head.
    • The WIP prefix is dropped, and the body says Fixes #34766.
  • Report 6967114632 open_questions. Q1, wait or build on the old read head: superseded, because the read half is landed and merged in. Q2, the protocol-file neighbour: accepted as a clean neighbour, as the PR body records. Neither is open.
  • Report 6971531844: security_findings: "withheld". This concerned the write path's type-level admission. The rule it concerns is met at this head (① items 3 and 4). Nothing is left open on this PR.
  • Reports 6971531844 and 6974765046: the inherited member name answers 5xx, out of scope, with no carrier. From this door the reach is nil: both writes are refused and nothing is written, as pinned on the real protocol. It stays the spec-lane filing recommendation of 6969515963 ③. The seat decides.
  • Report 6971531844, deviation: the file surface was widened by two gate-driven edits (the durability site row and row 55b of the system-context page). Each is the remedy its gate prescribes, and both fall within claim 6974854210's file list.
  • L1-b's note on the card's file surface (it reads the protocol package; this PR changes it). The claim names the changed files, and the change is D2, which the seat ruled. Answered.
  • L1-b nit on the changeset's example. Answered in ②: it adds no detail beyond the landed changeset.
  • PR body notes. The optional list-cost note from L1-c is not folded: a nit, carried. A spec version parameter is not accepted: RIGHT, because it is another card's contract and would be inert here.
  • open_questions: none open. The last three reports carry [].
  • Escalated to the seat: the /meta-wide questions above, privately (security-findings §6), and the upstream inherited-name card.
    None blocks this head.

Two passages of ③ were shortened by the seat before posting, under security-findings §6 (rule-level disclosure); the reviewer's full text is kept locally.

Implemented-by: claude/issue-34766-mcp-draft-door-write
Reviewed-by: area o1-C isolated reviewer (sub-agent of session_01JQwxbWDsbbJizuYnDwBxT8)

VERDICT: PASS

…s publish closure once per pass

A draft's publish closure is a function of its package alone, so a caller
judging several drafts in one answer hands the judgement one map for the pass
and each package's closure is collected on its first draft. Without the map
the judgement collects per call, as before. The per-draft strict read stays:
the item gate judges the served body, and the judgement reads the row as
stored, which the served read is not, and answers each finding whole.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Final green head · 2026-11-18T12:52Z: 50b2d84512dc152c4dc384385f475ba46915475c (fix round for contract review S1 6975604920: one package closure per list_drafts call, handed to every judgement of that call; the save path unchanged; dev report on #34766). CI: 38 success, 17 skipped, 0 red. Not governed. Owed: L1-b delta and the seat contract review delta on 8709c889..50b2d845, then landing.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Contract-review-claim: session_01JQwxbWDsbbJizuYnDwBxT8 · head 50b2d84512dc152c4dc384385f475ba46915475c · 2026-11-18T12:53Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXr9wLAH24MEgxaLud

席位核对

L1 delta · ACCEPT · Head-sha: 50b2d84512dc152c4dc384385f475ba46915475c · card #34766 (Fixes #34766, PR-b) · read 2026-11-18T12:55Z

I read the delta only, from 8709c889fe (my ACCEPT 6975500299) to this head: one commit, 6 files, +85 / -6. It answers contract review S1 (6975604920).

  • The change.
    • draftPublishJudgement takes an optional packageClosures map. A package's closure (its other drafts, collected for the package publish judgement) is collected on the first call of a pass and reused by the rest of the pass.
    • The cache key is the package alone, and the collection reads exactly what each call read before: the same listDrafts({ packageId }) through collectBatchPendingDeclarations. So reusing it changes no answer and reads nothing a call did not read before.
    • list_drafts makes one map per call. The save path passes none and is unchanged.
  • The gates are unchanged. Each draft's verdict is still behind the type-level read admission and the item read gate, in the same order, and a withheld or failed verdict is still null. The only text added on that path is the cost comment and the clearer module-header bullet (N2).
  • Pins.
    • Protocol: three drafts judged alone collect three times; with one map they collect once, and the answers are deep-equal.
    • Door: list_drafts over three drafts in one package collects one more time than there are drafts. That is the strict reads' own folds plus one shared collection. Each listed verdict equals the same draft judged alone, including a routable draft between two unroutable ones.
    • The dev report records two ablations.
  • Changeset. One added paragraph on the metadata-protocol changeset. It describes the new optional member, what the map is reused for, and that the answers are the same and nothing changes without the map. It is an optional parameter on a method this PR makes public, so it stays inside Clause-②: yes (widening) and patch.
  • Check-runs at this head: 59 in total, all completed, none failed (42 success, 17 skipped).
  • Merges cleanly onto origin/main ba6556c617.

Nits (none blocks)

  • A rejected closure promise stays in the map. Within one list_drafts pass, a failed collection for a package gives every later draft of that package a verdictError without a retry, where before each call collected again. That is still fail-closed (no verdict, never a wrong one) and lasts only one call.
  • Both pins use one package. A pass over drafts of two packages, showing that the key keeps their closures apart, is not pinned.

Not mine, still owed before landing

  • Contract review delta at this head (running).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 50b2d84512dc152c4dc384385f475ba46915475c
Local-runs: none

This is a delta review of 8709c889fe..50b2d84512 on PR #35103, PR-b of card #34766, on the declaration face. It follows record 6975604920.

What I read:

  • the delta, which is one commit touching six files (+85/-6);
  • the commit message;
  • the dev report 6978277919 on the card;
  • the head note 6979117673;
  • the PR body, re-read through REST;
  • the check-runs on the head.

I read code outside the delta at the head only to judge the delta's claims; I did not review it.

Results by id:

  • S1 is closed.
  • N2 is closed.
  • Rules (a) to (f) still hold.

There is no new must-fix and no new should-fix, so the verdict is PASS.

Check-runs on the head (the latest run of each name): 55 names, 38 success, 17 skipped, none red and none in progress.

① Derived judgments

  1. S1: closed.
    • One closure per package for each list_drafts call.
      • The list_drafts branch creates one packageClosures map per call and passes it to every gatedDraftVerdict, which forwards it to the judgement.
      • The judgement keys the map by package id. It stores the closure's promise on the package's first draft and awaits the stored promise for the rest.
      • A draft bound to no package collects no closure, as before.
      • The map lives only for that call, so nothing is shared across calls or across callers.
    • The save path is unchanged. The save's judgement call passes no map, so it collects once per call, as before.
    • The verdicts equal a solo judgement. A package's closure depends only on its package: it comes from the package's draft listing, never from the draft being judged. Sharing it changes no input to any rule. Two pins show this:
      • In the protocol suite, three judgements that share one map make one collection, and their answers toEqual three calls without a map.
      • In the runtime suite, on the real protocol and SQL store, each listed verdict toEqual the same draft judged alone. One of those drafts passes and two are refused, so the equality is checked on both outcomes.
    • Ablations. Two were reported, each with its anchor and with the restored blob equal to HEAD:
      • A fresh map for each draft gives 6 collections where the pin expects 4.
      • Removing the map's set gives 3 where the pin expects 1.
        Both agree with the code as read. Following the brief, I did not re-run them.
    • The remaining per-draft cost has its reason stated at the loop, as S1 asked. Each draft still costs:
      • the strict draft read, which the item gate needs and which, like every /meta draft read, runs its own judgement for its diagnostics;
      • the judgement's own read of the row as stored, which is needed because only that read returns each finding whole.
        Closure collections per package of N drafts drop from 2N to N + 1. The remaining N belong to the /meta draft read itself. The dev reports that as a cost observation with no carrier, and it is not this door's to remove.
  2. N2: closed. The module header's read section now says that list_drafts runs no item gate on its rows, and that each row's verdict is gated as described below. The two sections agree.
  3. Rules (a) to (f): unchanged and still met.
    • The delta changes only how the closure reaches the judgement.
    • The fold, the type-level read and write admissions with the human as the caller, the walled verdict, the gating of the verdict before the judgement, the ungated rows, the missing publish tool and the package requirement are all byte-unchanged.
    • In list_drafts, the map is passed only after the type admission and the item gate have admitted the draft. So a verdict withheld before is still withheld, and the map affects no gate.
    • If a closure fault happens once in a pass, every later draft of that package in the pass gets the same fault, caught as verdictError. Before the delta, each draft would have retried. It is still a fault and never a partial verdict.
  4. Public surface: the protocol method's new optional parameter. RIGHT, with one nit.
    • draftPublishJudgement accepts an optional packageClosures map.
    • Calls that omit it behave exactly as before.
    • No member is removed and no reply changes.
    • The door's structural type mirrors the parameter with an opaque value type.
    • Nit N5.
      • The map's value type names a declaration that the package entry does not export. A consumer can pass an inferred new Map(), but cannot spell that type.
      • A caller that pre-fills the map makes its own verdicts judge the closure it supplied. The publish gate collects its own closure, so no publish is affected.
      • One clause in the docstring ("hand an empty map; its entries are the judgement's own") would make the contract exact.
  5. Nothing else moved.
    • The delta is one commit on top of 8709c889fe with no merge, so the net diff against main still contains only the write half.
    • The dev reports one deviation: four unpublished commits were recombined into one under a trailer without the model name. There was no force-push, and it does not touch the contract.
  6. Nits carried from 6975604920 and unchanged: N1 (the package requirement is checked before the type-level write admission), N3 and N4, and the carried read-half nits.

② Semver level

  • .changeset/34766-mcp-draft-door-write.md gains one sentence about the map. It is true: an empty map handed to every call of a pass collects each package's closure once, the answers are the same, and without the map each call collects as before.
  • The level stays RIGHT:
    • @objectstack/metadata-protocol patch: an optional parameter widens what a public method accepts.
    • Clause-②: yes (widening).
    • Metadata-protocol: none, because nothing an author can write changes.
  • The runtime and MCP changeset is untouched. The runtime change is internal to the door and changes no reply.
  • Check Changeset concluded success.
  • Disclosure check: clean. The new changeset sentence, the commit message and the new PR body text state rules and counts. They name nothing the earlier text did not already name.

③ Boundary flags

  • Dev report 6978277919: open_questions is [] and security_findings is none.
  • Its out-of-scope note says the /meta strict draft read runs a full judgement, including a closure collection, for its diagnostics. Answered: this is a cost of the /meta read, its reason is stated at the loop, and it is not this PR's. The note has no carrier, and whether to file it is up to the seat.
  • Deviation: the commits were recombined before the first push. Answered: the tree is unchanged from the measured one, there was no force-push, and it has no effect on the contract.
  • SQL push-down (Prime Directive 5). The delta removes repeated collections and adds no query, no id materialisation and no in-app join. S1 is answered as stated in ① item 1.
  • Escalations carried from 6975604920: with the seat privately (security-findings §6); none blocks this head.

Implemented-by: claude/issue-34766-mcp-draft-door-write
Reviewed-by: area o1-C isolated reviewer (sub-agent of session_01JQwxbWDsbbJizuYnDwBxT8)

VERDICT: PASS

Merge-main only, no authored change: the branch was 16 first-parent
commits behind main ahead of landing. The PR patch is unchanged
(git patch-id --stable 7a56550f8475e7a11875203af3a42cdbf7a7a6dd before
and after); main touched two of the PR's files outside the PR's hunks.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWDsbbJizuYnDwBxT8
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Head hop (merge-main only), posted 2026-11-18T13:15Z.

  • Old head: 50b2d84512dc152c4dc384385f475ba46915475c
  • New head: 2d6a72269b60b270ca669ea19da843d0ec6b3ddf (merge of origin/main at ba6556c617bc201f1d4b635c609b28b589583c36; parents 50b2d84512 + ba6556c617), fast-forward push.
  • Why: the branch was K = 16 first-parent commits behind main (old merge-base 99a0e4fbfc), at or over the 15 threshold before landing.
  • No authored change: the merge commit only, clean (no conflicts, no regen paths).
  • Patch unchanged: git patch-id --stable of the pre-merge PR patch (git diff 99a0e4fbfc...50b2d84512) = 7a56550f8475e7a11875203af3a42cdbf7a7a6dd; of git diff origin/main...HEAD after the merge = 7a56550f8475e7a11875203af3a42cdbf7a7a6dd. Same 14-file list. Blobs identical to the old head for 12 of the 14 files; the other two (packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/initialize-selection-rule-34686.test.ts) were also touched by main outside the PR's hunks, so the patch did not move.
  • Local re-runs on 2d6a72269b: runtime src/domains/mcp-authoring.test.ts 37/37 pass; metadata-protocol src/protocol.draft-publish-verdict.test.ts 62/62 pass; runtime + metadata-protocol typecheck exit 0; check-governed-merges --branch HEAD NOT governed, exit 0; overlap-check --branch=HEAD VERDICT clean exit 0.
  • Carried records: L1 6979171194 and contract reviews 6975604920 / 6979194459 judge the same patch (same patch-id) and carry to this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbWDsbbJizuYnDwBxT8

Landing · 2026-11-18T13:54Z · head 2d6a72269b60b270ca669ea19da843d0ec6b3ddf (merge of origin/main into 50b2d84; patch-id 7a56550f8475 equal on both, hop 6979665058, so the reviews below carry)

Probe Reading
L1 ACCEPT 6975500299 (full), delta ACCEPT 6979171194 (S1 fix); patch-id re-checked by L1-b on this head
Contract review PASS 6975604920 (S1 should-fix), delta PASS 6979194459 (S1 and N2 closed)
CI on head 40 success, 15 skipped, 0 red
check-governed-merges NOT governed, +1115/-60
K (first-parent behind main) 2

Status: ready + auto-merge. Fixes #34766: with PR-a #35059 merged, this PR carries the rest of the card.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 18, 2026 13:54
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 2d33205 Nov 18, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34766-mcp-draft-door-write branch November 18, 2026 14:22
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/xl 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.

mcp: the open-source draft door — list, read, save and discard metadata drafts, each save answered with the publish verdict

3 participants