Skip to content

fix(metadata-protocol): a list_drafts verdict no longer re-collects its package closure per draft - #39048

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-39001-strict-read-closure
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-39001-strict-read-closure

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread
Fixes #39001
Claim for this branch: #39001 comment 7334650660
Clause-②: yes (widening: the exported ObjectStackProtocolImplementation#getMetaItem request type gains one optional in-process member, packageClosures; a caller that omits it behaves exactly as before)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:助手调用「列出草稿」时,每份草稿的发布检查不再把整个应用包的草稿重读一遍;包越大省得越多,同样 20 秒内能检查完的草稿更多(见下表)。检查结论与改动前完全一样。
  • 为什么做:云端搭建能力的「列出草稿」第二阶段修复,替在一个包里积累了大量草稿的客户去掉查询数随包大小成平方增长的问题;上一轮已给检查加了数量与时间上限,这一轮去掉上限之下的重复读取。
  • 出错会怎样:最坏情况是列出草稿时的检查结论与单独打开草稿时不一致;测试已逐份比对两者相同。改动只在服务端,撤回这个合并即可恢复原样。
  • 要你做什么:无。
包内草稿数 改动前查询数 改动后查询数 每份草稿(前 → 后)
10 352 242 35.2 → 24.2
50 3752 1202 75.0 → 24.0
100(上限只检查 50 份) 6302 1252 126.0 → 25.0

What changes

list_drafts judges each draft with gatedDraftVerdict: type admission, a strict draft read (getMetaItem with state: 'draft'), the item gate, then draftPublishJudgement. The judgement already took the door's per-call packageClosures map, so the package's publish closure (one listDrafts plus one repo.get per closure-relevant draft) was collected once for the judgements. The strict read did not: its serveDraft folds its own publish verdict into _diagnostics by calling draftPublishJudgement with no map, so it collected the closure again for every draft. One verdict cost about 25 + P queries.

  • packages/metadata-protocol: getMetaItem (the public method, and the getMetaItem / readMetaItem bodies in protocol-meta-item-reads.ts) takes an optional in-process packageClosures map, the same type draftPublishJudgement takes. serveDraft hands it to its folded judgement. Only a Map instance is taken. Absent, the read collects its own closure, as before.
  • packages/runtime (gatedDraftVerdict only): the strict draft read gets the same map the judgement gets.

Design points

  1. Route: (a). The strict read takes the caller's map. (b), reusing the read's folded verdict instead of judging twice, would need the read to hand back the raw judgement: _diagnostics holds the refusals as diagnostics without their hint, and the door answers each finding whole (verdictOf). That means a new key on the read's answer (an output widening on a wire-served method) or parsing _diagnostics back, so (b) and (c) are out. What remains per verdict, traced on the driver for one draft: 1 served-row read for the strict read, 1 write-head read plus 1 stored-row read (repo.get) for the door's body-less judgement, and 10 stored-collection reads for each of the two judgements (foldStoredCollection: object, permission, book, dataset, flow, each in singular and plural spelling): about 23 per draft. Plus, once per call, the list read and the closure (1 + P). None of the per-draft part depends on P.
  2. Reach. No wire door can state the key. Every /meta read (packages/rest meta-item-read-routes.ts, rest-server.ts, meta-qualified-item-route.ts; packages/runtime domains/meta.ts) and the MCP get_metadata_item read builds its getMetaItem request from named keys; none spreads a query or body into it (checked with git grep over packages/**). On top of that, serveDraft takes the value only when it is a Map, which no JSON body or query string decodes to; a test pins that {} and a string are not taken. No tool or route input changes. The exported TypeScript request type of getMetaItem does gain the optional member, so Clause-② reads yes (widening) (L1 review 7335931058).
  3. Staleness. The map is created inside one list_drafts call and dropped with it, as before. The strict draft read is never served from the compiled-answer cache (cacheableRequest refuses any request with state), and a read with no map collects on every read (pinned: three reads, three collections).
  4. Ordering with fix(runtime): get_metadata_item without state answers the version a following save takes #39022. overlap-check.mjs on this head: the branch merges textually clean with origin/main and with fix(runtime): get_metadata_item without state answers the version a following save takes #39022's head (they share mcp-authoring.ts and mcp-authoring.test.ts; this branch edits only gatedDraftVerdict and the closure-count pin, fix(runtime): get_metadata_item without state answers the version a following save takes #39022 the get_metadata_item description and branch). I expect no conflict. The branch merges origin/main again once fix(runtime): get_metadata_item without state answers the version a following save takes #39022 lands, before it leaves draft.

Read first (by risk)

  1. packages/metadata-protocol/src/protocol-meta-item-reads.ts: the packageClosures guard and the serveDraft judgement call. The risky part is the read-path change for every strict draft read; with no map the call is byte-for-byte the old one.
  2. packages/runtime/src/domains/mcp-authoring.ts: gatedDraftVerdict's getMetaItem call now carries the map.
  3. packages/runtime/src/domains/mcp-authoring-39001-strict-read-closure.test.ts: the per-draft query pin and the single-read pins.

Two-minute check

pnpm --filter @objectstack/metadata-protocol build && pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/mcp-authoring-39001-strict-read-closure.test.ts, expected: 4 passed. On origin/main the first case fails with 4 → 118, 8 → 266, 16 → 658 queries: expected 392 to be 296.

Tests

  • New packages/runtime/src/domains/mcp-authoring-39001-strict-read-closure.test.ts, the real ObjectStackProtocolImplementation over better-sqlite3, through createOpenAuthoringRegistry, counting the driver's find / findOne / count:
    • the per-draft cost is constant: going from 8 to 16 drafts costs exactly twice what going from 4 to 8 costs, and the closure is collected once per call. On origin/main: 4 → 118, 8 → 266, 16 → 658 (red). On this branch: green.
    • a single /meta draft read with no map: a view draft bound to an object that exists only as a sibling draft folds { valid: true }; one bound to an object nowhere folds list-view-object-outside-closure on object; each read collects its own closure (3 reads, 3 collections). Green on origin/main and on this branch: the verdict did not change.
    • a read handed a map folds the same _diagnostics as without one, and a second read takes the closure the first collected.
    • a packageClosures value that is not a Map is not taken.
  • mcp-authoring.test.ts: the existing closure-count pin goes from names.length + 1 collections to 1. Its other half, each listed verdict equal to the draft judged alone, still holds.
Ablation (fix removed from the protocol, rebuilt)
  • Mutation: node scripts/ablation-replace.mjs --delete --hold on the ...(packageClosures ? { packageClosures } : {}), line of serveDraft (anchor 1 → 0, blob ecce0fb16d93 → e48c568c5204); pnpm --filter @objectstack/metadata-protocol build; ablation-dist-preflight.mjs --absent passed (the runtime suite reads metadata-protocol through dist/).
  • Result: 2 failed, 2 passed. 4 → 118, 8 → 266, 16 → 658 queries: expected 392 to be 296 and expected "collectBatchPendingDeclarations" to be called 1 times, but got 2 times. The two single-read pins stayed green, as they should.
  • Restore: ablation-replace.mjs --restore: blob == HEAD (ecce0fb16d93c2f83a661f692985207accc76127), git diff HEAD empty; rebuilt; ablation-dist-preflight.mjs found the marker present in 2 built files.
Measurement (P object drafts in one authored package, one list_drafts call)
P judged queries before queries after per verdict before per verdict after closure collections before → after
10 10 352 242 35.2 24.2 11 → 1
50 50 3752 1202 75.0 24.0 51 → 1
100 50 (door cap) 6302 1252 126.0 25.0 51 → 1

After: total = 1 (list) + (1 + P) (closure, once) + 23 × judged.

Verification

Readings on 926ce2d055 unless noted (the test and gate runs were taken on 66622c7a64; the one commit merged since then is origin/main's c748e7dfd6, which changes two gate scripts and no package).

Package tests and typecheck
  • pnpm --filter @objectstack/metadata-protocol typecheck: exit 0.
  • pnpm --filter @objectstack/metadata-protocol test: 381 files passed, 9 skipped; 23940 tests passed, 45 skipped; exit 0.
  • pnpm --filter @objectstack/runtime typecheck (tsc plus check:test-typecheck): exit 0.
  • pnpm --filter @objectstack/runtime exec vitest run --project local --maxWorkers=2 src/domains/mcp-authoring: 3 files, 86 tests passed.
  • NOT MEASURED: the full @objectstack/runtime local suite. It did not finish inside the container's 10-minute foreground limit. Test Core runs it.
Derived gate families (dispatch-gates --commands, 76)
  • 75 run, exit 0. check:closed-ceremony-text exited 1 on the first run (ENOBUFS: its git ls-files read past the 1 MiB default buffer; origin/main lists 1048565 bytes, 11 under the limit, and this diff's two new files pushed it over). origin/main's c748e7dfd6 fixed that script; re-run after the merge: exit 0.
  • NOT MEASURED: check:dual-build-cjs-loads (PREREQUISITE NOT MET: it reads every package's dist/, and 41 packages outside this diff are not built here). CI runs it.
  • dispatch-gates --ran: 76 derived, 75 run, 1 NOT-MEASURED, 0 UNRUN.

Acceptance notes

  • The list branch's comment in list_drafts ("one map collects it once per package for the judgements") is now incomplete: the reads take the map too. It sits outside gatedDraftVerdict, so this PR leaves it alone.
  • The 20 per-draft stored-collection reads (two judgements, 10 each) read environment-wide active rows that do not change during one list_drafts call. They do not grow with P; sharing them across a pass would be a separate change.

Generated by Claude Code

…age closures

list_drafts judged each draft with a strict draft read and a publish
judgement. The door shared one package closure between its judgements,
but the strict read folded its own publish verdict into _diagnostics
without the map, so it collected the package closure again on every
draft: about 25 + P queries per verdict.

getMetaItem now takes an in-process packageClosures map (only a Map is
honoured; no wire door states the key), threaded into the strict draft
read's folded judgement. gatedDraftVerdict hands the read the same map
its judgement uses, so the closure is collected once per package per
list_drafts call. A read naming no map collects its own closure on every
read, as before, and folds the same verdict.

Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ
Co-authored-by: Claude <noreply@anthropic.com>
…read's shared closure

Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

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

  • content/docs/concepts/metadata-lifecycle.mdx (via getMetaItem (symbol, a method of class ObjectStackProtocolImplementation; a top-level function))
  • content/docs/data-modeling/drivers.mdx (via getMetaItem (symbol, a method of class ObjectStackProtocolImplementation; a top-level function))
  • content/docs/deployment/environment-variables.mdx (via getMetaItem (symbol, a method of class ObjectStackProtocolImplementation; a top-level function), /app/:appId/bundle (route, bridged from symbol getMetaItem — its route source's handler names it))
  • content/docs/frontend/data-objectstack.mdx (via /app/:appId/bundle (route, bridged from symbol getMetaItem — its route source's handler names it))
  • content/docs/kernel/services-checklist.mdx (via getMetaItem (symbol, a method of class ObjectStackProtocolImplementation; a top-level function))
  • content/docs/protocol/objectql/state-machine.mdx (via /object/:name/state/:field (route, bridged from symbol getMetaItem — its route source's handler names it))

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

  • content/docs/releases/v17/17-0.mdx (via getLegalNextStates (sdk, the bare tail of client method meta.getLegalNextStates, bound to GET /api/v1/meta/object/:name/state/:field; the bare tail of client method meta.getLegalNextStates, bound to GET /meta/object/:name/state/:field), meta.getLegalNextStates (sdk, the route ledger binds it to GET /api/v1/meta/object/:name/state/:field, selected by route anchor /object/:name/state/:field; the route ledger binds it to GET /meta/object/:name/state/:field, selected by route anchor /object/:name/state/:field))
  • content/docs/releases/v17/17-2.mdx (via getLegalNextStates (sdk, the bare tail of client method meta.getLegalNextStates, bound to GET /api/v1/meta/object/:name/state/:field; the bare tail of client method meta.getLegalNextStates, bound to GET /meta/object/:name/state/:field), meta.getLegalNextStates (sdk, the route ledger binds it to GET /api/v1/meta/object/:name/state/:field, selected by route anchor /object/:name/state/:field; the route ledger binds it to GET /meta/object/:name/state/:field, selected by route anchor /object/:name/state/:field))
  • content/docs/releases/v18/18-3.mdx (via /app/:appId/bundle (route, bridged from symbol getMetaItem — its route source's handler names it))

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
  • the SDK route bridge reached 71 of 254 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 35 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 4a3b5321ed7f7fefc7363cba17cc4feb4174371a → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 4a3b5321ed7f7fefc7363cba17cc4feb4174371a

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

@github-actions github-actions Bot added 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 Dec 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 review · PR #39048 (#39001) · head 926ce2d · 2026-12-02T05:25Z

REWORK. One must-fix, in the declaration only. The code reads right, and CI was still running at my read (13 success, 23 pending).

Must-fix

  1. Clause-② is no, but the diff widens the public type of a published package. @objectstack/metadata-protocol is published, and its index exports ObjectStackProtocolImplementation. That class's getMetaItem request type gains an optional packageClosures member. The changeset itself says the method "now takes" it. A new optional member on an exported type of a published package is a public-surface widening, on the same precedent applied to fix(console): the record edit dialog opens locked with the closed sentence on a closed record (ADR-0162) #39019 and to .changeset/pre/36149 / 35707. Being in-process only means no wire caller can reach it, but it does not keep it off the TypeScript surface a consumer compiles against. Change the declaration to Clause-②: yes (widening) in the changeset and the PR body, naming the member. patch and Metadata-protocol: none stay. It owes a TIER_DEFAULT declaration review on the fix head, which I run.

Read and right (pending CI)

  • (1) Wire reachability: readMetaItem honours the key only if it is instanceof Map, and no JSON body or query string decodes to a Map. The pin for {} and a string being ignored matches. A /meta read names no map and collects per read as before.
  • (2) Acceptance 2: serveDraft passes the map into the same draftPublishJudgement call that already folds into _diagnostics. The closure depends on the package alone, so a single read's _diagnostics is unchanged. The list_drafts door passes the map its judgements already use, so the pin moves from names.length + 1 to 1 collection.
  • (3) The declared deviation, where intermediate face types pass the key without declaring it, is fine: it stays behind the instanceof Map guard.
  • The map lives for one list_drafts call, with nothing kept between calls, so staleness is the same as the judgements' today.

Next: fix the declaration lines. Once CI is green on the fix head, I run the declaration review and post an L1 delta. Landing then follows #39022 and a merge of main.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

Contract-review-claim: session_01WGufzhGA3zoCFquQgku4pm · head d8c2d8c · 2026-12-02T06:15Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

Contract review

Served-tier: TIER_DEFAULT
Head-sha: d8c2d8cb2ee3306b50e77c9e016e01e7eee2eefb
Local-runs: none

Declaration review of PR #39048 (card #39001). Inputs: the card body and every comment on it (triage, claim, dev report), the PR body and its comments, the six-file net diff origin/main...d8c2d8cb, and the check-runs on this head. All of them completed success or skipped (opt-in and UI-only lanes): Build Core, Test Core 1-12, every Type Check job including consumer gates, every Lint job including PM dispatch-gates, Check Changeset, PR-body guards, Governed Surface Queue Guard and Dogfood Regression Gate. The head is the dev commits plus a clean merge of main (4a3b5321, #39022). The net diff holds only the six files the claim fenced. Hits: packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/protocol-meta-item-reads.ts, packages/runtime/src/domains/mcp-authoring.ts.

① Derived judgments

  • Accept-set: none moves. No packages/spec file, no zod schema, no route and no MCP tool input or answer changes. GetMetaItemRequest (spec protocol.zod.ts) is untouched, and so is the MetadataProtocol contract the class implements. An optional extra parameter member on the implementation is assignable to it. Right.
  • Public surface, @objectstack/metadata-protocol: one widening. The index exports ObjectStackProtocolImplementation (index.ts:3). Its getMetaItem request type gains the optional packageClosures member, a Map from package id to a promise of RuntimePendingDeclarations or undefined (protocol.ts:4171). The member is optional and a caller that omits it is unchanged: serveDraft spreads the key only when it holds a Map. The changeset and PR body name it as the widening. Right.
  • RuntimePendingDeclarations reach: not new, and no emit problem. The type is not exported from the index, on main or on this head. But on main it is already reachable from the same exported class, with the identical member type, through the public draftPublishJudgement (main protocol.ts:1909-1912, the same optional packageClosures member of the same Map type). This PR adds a second path to a type that was already reached. It does not create the first one. The package's tsup dts bundle emits a non-exported referenced type as a local declaration, and build runs check-dts-emitted. Build Core and Type Check · consumer gates are green on this head. A consumer can pass a map typed through Parameters of the method, or a structural map of unknown promises, as the runtime door already does for draftPublishJudgement. No declaration-emit or consumer-typing finding.
  • Module-level getMetaItem / readMetaItem in protocol-meta-item-reads.ts gain the same key. The index does not re-export them, so they are internal and add no surface.
  • Public surface, @objectstack/runtime: none. OpenAuthoringProtocol and createOpenAuthoringRegistry keep their exported types. The door hands the key through the existing as Parameters cast on the OpenAuthoringProtocol getMetaItem request, which was already on main (the diff shows it as a context line). Right.
  • Wire reach: none. readMetaItem honours the value only when request.packageClosures instanceof Map (reads.ts:939), and no JSON body or query string decodes to a Map. I read every non-test getMetaItem( caller under packages/** on this head. Each /meta and MCP request is built from named keys: meta-item-read-routes.ts:1103, rest-server.ts:2770/3855/3989, runtime/domains/meta.ts:602/905/984/2437/2506, and the get_metadata_item read at mcp-authoring.ts:918. The two spreading call sites spread values the code builds itself, not a decoded body or query. They are the _env qualified-route judges meta-qualified-item-route.ts:136 and runtime/domains/meta.ts:1253, which spread { type, name, member } from route params plus { state, previewDrafts } switches. The compiled-answer cache never serves a request that carries state (cacheableRequest, meta-compile-cache.ts:349-356), so a strict draft read is never answered from cache whatever map it holds. Right.

② Semver level

  • @objectstack/metadata-protocol: patch and @objectstack/runtime: patch. AGENTS.md Post-Task Checklist 3: a non-protocol change, widening or breaking, ships patch. Right for both. Runtime publishes a behaviour fix and no surface. Metadata-protocol publishes the fix plus the type widening above.
  • Clause-②: yes (widening …) is right. An optional member on an exported type of a published package is a public-surface widening. It names exactly the member that moves. The changeset and the PR body carry the same line-initial spelling. The L1 REWORK item on head 926ce2d0 asked for this declaration (Clause-②: no then), and it holds on this head. The claim comment still reads Clause-②: no. That line was not edited, but the PR body and the changeset govern.
  • Metadata-protocol: none is right. A metadata author can write nothing new: no key, value, type or default changes.
  • The changeset, sentence by sentence, against the tree:
    1. The title ("no longer re-collects its package for every draft"): true. With the map, draftPublishJudgement takes the cached closure (protocol-authoring-gate.ts:995-998), keyed by package id alone.
    2. The Clause-② parenthesis ("a caller that omits it behaves exactly as before"): true. With no map, the serveDraft call is the old one, byte for byte.
    3. "judges each draft with a strict draft read and a publish judgement": true (gatedDraftVerdict, mcp-authoring.ts:1167-1214).
    4. "The judgements already shared one publish closure per package … but the strict draft read folded its own publish verdict … without it": true of main (the serveDraft call there passes no map).
    5. "about 25 + P … a whole list P × (25 + P)": matches the card's evidence table.
    6. "now takes an in-process packageClosures map, the one draftPublishJudgement already takes, and hands it to the strict draft read's folded judgement": true. The type is identical, and it is passed at reads.ts:949.
    7. "The door passes the map its judgements use": true. The same packageClosures reaches both calls (mcp-authoring.ts:1191 and 1212), created once per list_drafts call (mcp-authoring.ts:983).
    8. The measured numbers come from the dev's run and the tests own them (the L1's scope). They are consistent with the per-draft pin's shape.
    9. "Nothing a caller can send over the wire changes. The key is not read from any HTTP or MCP request, and only a Map is taken": true, as read in ①.
    10. "A /meta draft read names no map: it collects its own closure on every read and folds the same _diagnostics": true. With no map, the cache lookup misses and collects, as on main.
    11. "A map lives for one list_drafts call": true (mcp-authoring.ts:983, a local constant).

③ Boundary flags

  • open_questions: empty.
  • Dev deviations, each answered:
    1. protocol-authoring-gate.ts is not edited. Right: draftPublishJudgement already consumes the map.
    2. The intermediate face types (readMetaItemFace, the private readMetaItem signature) carry the key without declaring it. Accepted. The request object travels by reference and spread: canonicalizeMetaRequestType, then readMetaItemFace(canonical), then readMetaItem({ ...request, packageId }) (protocol-meta-item-face.ts:47). So the key arrives, and the per-draft pin would go red if a refactor dropped it. See N2.
    3. The full runtime suite was not measured locally. Answered by Test Core 1-12, green on this head.
    4. check:dual-build-cjs-loads was NOT-MEASURED locally. Answered by the head's green Build Core and Lint jobs.
    5. check:closed-ceremony-text ENOBUFS. Fixed on main (fix(scripts): tree-scaled git listings in two gate scripts read past the 1 MiB default buffer #39027) and merged in. Lint is green.
  • Out-of-scope findings in the dev report: the stale list_drafts comment is N1. The shared foldStoredCollection reads are a performance idea with no defect class, constant in P, and no record item.
  • SQL push-down: no finding. The diff adds no id materialisation and no in-app join. It memoises an existing per-package listDrafts plus collection for the length of one call, so queries drop: per verdict, from 25 + P to a constant.
  • Docs drift advisory: the six listed pages name getMetaItem. The new member is in-process only and never documented as a wire key, so no page goes wrong.
  • Design, for the hits files (brief):
    • protocol.ts: the declaration and its jsdoc ("In-process only, never a wire key") agree with the guard.
    • protocol-meta-item-reads.ts: the closure is a function of the package alone. listDrafts({ packageId }) is keyed on row.package_id in the strict read and on draft.packageId in the door, which name the same package for one draft. So a mapped verdict equals an unmapped one, and acceptance 2 holds. A package-unbound draft collects nothing either way.
    • mcp-authoring.ts: the change stays inside the gatedDraftVerdict region the seat fenced.
    • I tried to break it two ways. A rejected first collection would be reused across the pass. That is the same exposure the judgements had on main, and verdictErrorOf answers it per draft. A map handed to an active, cacheable read is ignored, because only serveDraft reads it.
  • N1 (nit): the list_drafts comment at mcp-authoring.ts:981-982 ("one map collects it once per package for the judgements") is now incomplete. The strict reads share the map too. It sits outside the fenced region and has no effect on correctness. Follow-up or accepted deviation; editing it here would move the head.
  • N2 (nit): nothing in the types carries packageClosures from the public getMetaItem to readMetaItem. It rides undeclared through readMetaItemFace's request type and through the runtime's MetadataProtocol-picked getMetaItem type and its cast. Only the per-draft query pin guards the path. Accepted as declared; declaring it on the face type would be a later tidy-up.

No must-fix, no should-fix.

Implemented-by: claude/issue-39001-strict-read-closure
Reviewed-by: session_01WGufzhGA3zoCFquQgku4pm

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 delta · PR #39048 (#39001) · head d8c2d8c · 2026-12-02T06:20Z

ACCEPT, on head d8c2d8cb2ee3306b50e77c9e016e01e7eee2eefb. This closes must-fix 1 of the L1 on 926ce2d.

  • The fix. 2fef9a96 changes only the changeset. It now reads Clause-②: yes (widening: … packageClosures …), and the PR body carries the same line. No code moved.
  • Pure merge. d8c2d8cb merges 2fef9a96 with main 4a3b5321, which includes fix(runtime): get_metadata_item without state answers the version a following save takes #39022. git merge-tree --write-tree gives tree e07d86b2, identical to the head's tree, so no hunk in mcp-authoring.ts was resolved by hand.
  • Declaration review. The review at TIER_DEFAULT on this head is a PASS, with no must-fix and no should-fix and two nits (comment 7336910403). It finds the declaration right. RuntimePendingDeclarations was already reachable from an exported signature on main, and the member cannot be reached from the wire: every caller builds named keys, and the value is honoured only behind instanceof Map. N1 (a stale list_drafts comment) and N2 (the declared undeclared-key path) stand as accepted deviations.
  • Code. The code read in my L1 on 926ce2d stands unchanged.
  • Face. l1-face CLEAN: 39 checks succeeded, 18 skips were expected, 0 failed, 0 pending, and mergeable_state is clean.

Next: zone landing. The merge closes #39001.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzeatqKfTRUzTJVa9jQ

落地

reading value
check-governed-merges.mjs --pr 39048 (head fetched) NOT governed — 6 files, 256 changed lines ≤ 3000
reviews on d8c2d8cb Contract review at TIER_DEFAULT 7336910403: PASS, no must-fix, no should-fix, nits N1–N2. L1 delta ACCEPT 7336919873 (osa-L1-a), closing the L1 must-fix of 7335931058 (Clause-② now yes (widening)). No graded finding open.
check-runs on d8c2d8cb 39 success · 18 expected skip · 0 failed · 0 pending; mergeable_state clean
K landing-k.mjs --pr 39048: K = 5 < 15, no new locale pack, no shared book moved
serial order #39022 (#38982, same file, region split ruled by the seat) merged first; d8c2d8cb is a pure merge of main over it

State change: ready for review + auto-merge, by zone osa-ai (2026-12-02T06:21Z). Fixes #39001: the merge closes the card. Accepted nits N1 (the stale list_drafts comment at mcp-authoring.ts:981-982) and N2 (the key rides undeclared through the face types) stand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

metadata-protocol: each strict draft read re-collects its package closure, so list_drafts verdicts cost P×(P+25) queries

2 participants