Skip to content

fix(metadata-protocol, rest)!: the layered read of a name two packages hold refuses as the plain read does, naming the holders as details.candidates (ADR-0150 D3/D5) - #33885

Merged
objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/area-E1-32622
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/area-E1-32622

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #32622
Fixes #32914

Clause-②: no (narrowing) — narrowed: a layered read naming no package, of a name two or more served packages register in code, no longer serves the holder that registered first. The REST /layers door on a host that wires no engine for its door chain goes from 200 to 409 naming the holders, and the in-process getMetaItemLayered goes from resolving to throwing PackageScopedNameRefusedError. The REST /published door on a host with no objectQLProvider goes to 409 without details.candidates. Before, it served the name's package-unbound active row (200) when one stands, and otherwise its published exit (the metadata service's getPublished answer, or 501 when the host resolves none). The dispatcher's /published swallows the refusal. With no such row it serves its snapshot as before; with one, it moves from that row to the code snapshot (read from the tree). A name one package holds, and every read naming the package, answer as before.
Metadata-protocol: none
Skills-docs: none — no skill under skills/ names the layered or published door, and the docs that do (content/docs/ui/apps.mdx, content/docs/references/api/rest-server.mdx, content/docs/concepts/metadata-lifecycle.mdx, content/docs/plugins/adding-a-metadata-type.mdx) name the routes without teaching how a name two packages hold is answered there, so no sentence there turns false; the generated content/docs/references/api/protocol.mdx describes packageId as scoping a same-name collision, which still holds.

维护者速读

  • 改了什么:按名字读元数据的分层视图(GET /meta/TYPE/NAME/layers,以及进程内的 getMetaItemLayered),遇到两个包都持有同名项、又没指定包时,现在和普通读一样答 409,并在 details.candidates 里列出两个包;以前 REST 在某些部署形态下、以及进程内调用,会悄悄返回先注册的那个包。
  • 为什么改:同一个名字,普通读答 409 点名两包,分层读却按注册顺序挑一个(或只给一句话不给结构化候选),调用方无法知道该选哪个包,违反 ADR-0150 D3/D5“歧义要报告、不许猜、要列候选”。
  • 风险与回滚:这是收窄(BREAKING):没给 door chain 接引擎的部署上,两包同名、不指定包的 /layers 由 200(先注册包的分层)变为 409;进程内 getMetaItemLayered 由返回先注册包变为抛 PackageScopedNameRefusedError,调用方需改为指定包。只影响“两个包同名且没指定包”的分层读;单一持有者、带 ?package= 的读、存储行持有者在禁用包旁的进程内读都不变;第一方触达 0。回滚即 revert 本 PR。
  • 先看:packages/metadata-protocol/src/protocol-meta-layered-reads.ts(getMetaItemLayered 新增的 resolveItem 判定,和 withPackageCandidates);packages/rest/src/meta-item-read-routes.ts(/layers 路由 catch 加 packageScopedCandidates);packages/rest/src/meta-layers-ambiguous-package.test.ts 新增的 describe。
  • 两分钟验证:pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/meta-layers-ambiguous-package.test.ts,预期 12 个用例全绿(两包同名的 /layers 两种写法答 409 带 details.candidates,进程内读抛同样的拒绝,单持有者照常返回)。
  • 需要你做的:无,席位落地。

What changes

BREAKING (Clause-②: no (narrowing), patch level, Metadata-protocol: none): three answers move, the three bold rows of the table below. FROM 200 with the first-registered holder's layers TO 409 RESOURCE_CONFLICT with details.candidates, on REST /layers where no engine is wired for the door chain; FROM resolving the first-registered holder TO throwing PackageScopedNameRefusedError, in process; FROM the package-unbound active row (200) or the published exit TO 409 without details.candidates, on REST /published where no objectQLProvider is wired (review-b F1 and review#2 S3, measured below). The fix for a caller: name the package. The changeset carries the banner and adr-0087: not-required (no-migration-prescription): no key, stored row, layer or export changes shape.

Measured first on main a557fa38 (real RestServer, real protocol, real SchemaRegistry; two packages registering the dashboard sales, no stored row):

door before after
plain GET /meta/dashboard/sales 409 RESOURCE_CONFLICT with details.candidates unchanged
REST /layers, engine wired for the door chain 409, sentence only (no details) 409 with details.candidates
REST /layers, no engine wired (no service copy, or a service copy of one holder) 200, the first-registered holder's layers 409 with details.candidates
in process getMetaItemLayered({ type, name }) resolves, the first-registered holder's layers throws PackageScopedNameRefusedError (409, refusal.candidates naming both)
REST /published, no objectQLProvider the published exit: the metadata service's getPublished answer, or 501 NOT_IMPLEMENTED when the host resolves no metadata service 409 RESOURCE_CONFLICT, no details
REST /published, no objectQLProvider, the name also has a package-unbound active row 200, that row 409 RESOURCE_CONFLICT, no details
REST /published, engine wired 409 RESOURCE_CONFLICT, no details unchanged
dispatcher /published, engine registry not reachable, no package-unbound row the snapshot (the throw is swallowed) unchanged (not pinned)
dispatcher /published, the same, with a package-unbound active row that row (read from the tree) the code snapshot: the throw is swallowed (read from the tree, not pinned)
?package= of either holder, and a name one package holds served unchanged

Tests

  • packages/rest/src/meta-layers-ambiguous-package.test.ts, new describe [#32622, #32914] a name two packages register, read naming no package: 3 compositions (engine wired; no engine wired; no engine wired with a metadata-service copy of the first holder) x 2 registration orders, both spellings answer 409 RESOURCE_CONFLICT with both holders as details.candidates and serve neither holder; in process the layered read refuses (code + status + refusal.candidates) in every composition and each packageId read still serves its holder; CONTROL: a name one package registers is served in process and on both spellings, and ?package= serves its holder.
  • [#28337] pins on both transports (rest/.../meta-layers-ambiguous-package.test.ts, runtime/.../meta-layers-ambiguous-package.test.ts, RestServer and hono): the envelope is now the writes' envelope plus details, with both holders as details.candidates; the writes' answer is asserted to carry no details.
  • [#32354] ruling-Q2 pins (rest/.../meta-disabled-package-doors.test.ts, runtime/.../meta-disabled-holder-served-stack.test.ts): /layers now asserts details.candidates naming only the served holders.
  • metadata-protocol/.../protocol.packageless-layered-read-refusal.test.ts: the step-1c refusal carries refusal.candidates; the save's refusal carries none.
  • rest/.../meta-qualified-item-route.test.ts, new top-level describe #32622 — the other /layers refusal exits carry details.candidates (review#2 S1). It covers two exits. The bare action read with the platform's item beside A's answers [A, platform]. /layers?package= of a package holding none answers [A]. Each is asserted equal to the item read's candidates. The stale #32365 comment there is corrected: /layers carries the candidates, /published its text. S1 ablation (the /layers catch without packageScopedCandidates, rest source): both new cases red (AssertionError: {"error":"The action \"approve\" is held by 2 holders … and … is not held by package \"com.acme.gamma\" …), 2 failed of 325; restored with blob equal to HEAD and git diff HEAD empty; baseline 325/325.
Ablations (each leg restored; blob == HEAD proven by ablation-replace)

HEAD 6e50dbd5c7. Baseline green: rest 62/62, metadata-protocol 3/3, runtime 367/367 (the three files above per package).

  • A2, the /layers catch without packageScopedCandidates (rest source, read from src): 9 red, e.g. /layers: expected [] to deeply equal [ 'package:app.alpha_demo', …(1) ] and the ruling-Q2 pin expected [] to deeply equal [ Array(2) ]; the in-process and CONTROL cases stay green, as expected.
  • A1, getMetaItemLayered without the resolver judgment (metadata-protocol rebuilt, marker ABLATED_32914 present in 2 built files): 6 red, the no-engine cases /layers: … "label":"app.alpha_demo code" …: expected [ 200, … ] to deeply equal [ 409, 'RESOURCE_CONFLICT' ] and the in-process cases expected [ undefined, undefined ] to deeply equal [ 'RESOURCE_CONFLICT', 409 ]; the engine-wired cases stay green (the door's owner step refuses there), as expected.
  • A3, step 1c's refusal without its candidates (metadata-protocol rebuilt, marker ABLATED_32622 present): metadata-protocol expected undefined to be 'refused'; rest expected [ 'code', 'error' ] to deeply equal [ 'code', 'details', 'error' ]; runtime RestServer and hono twins red the same way (hono: [ 'code', 'httpStatus', 'message' ]). A first A3 attempt was refused by ablation-replace (its replacement contained the anchor, so the anchor count did not drop) and restored at once; its green readings were a no-op and are discarded.
  • Restore leg: metadata-protocol rebuilt, both markers absent from all 24 built files, working tree clean.

Acceptance notes

Verification

REST /published FROM and TO (review-b F1), measured at e516f35

A throwaway probe beside the REST pins, not committed. It used the same real protocol and real SchemaRegistry, with two packages registering the dashboard sales, GET /meta/dashboard/sales/published naming no package, both registration orders. TO is the head as built. FROM is the head with getMetaItemLayered's resolver call ablated (ablation-replace landed, the marker present in 2 built files, then restored: blob equal to HEAD, marker absent from all 24 built files).

composition FROM TO
engine wired (objectQLProvider) 409 RESOURCE_CONFLICT, details null 409 RESOURCE_CONFLICT, details null
no objectQLProvider, no metadata service 501 NOT_IMPLEMENTED ("Nothing is runtime-published for this item, and this kernel has no code/package store …") 409 RESOURCE_CONFLICT, details null
no objectQLProvider, the protocol's service holding a copy of the first holder (two shapes) 501 NOT_IMPLEMENTED (the REST host resolves no metadata service of its own) 409 RESOURCE_CONFLICT, details null

The FROM on a host whose REST metadata service has getPublished (the service's answer, served 200) was NOT MEASURED. The probe shape for it, which stubs the host's resolveMetadataService, never got the verify lock: four 540 s waits behind pid 16926, a pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=1 holding over 60 minutes. That row is read from the tree (meta-item-history-routes.ts, the fallthrough after the overlay read). Each VERDICT command-exit 0.

REST /published with a package-unbound active row (review#2 S3), measured at 9dd398c

A throwaway probe beside the REST pins, deleted and never committed. Same real protocol and SchemaRegistry. A package-less saveMetaItem stores the dashboard sales as a package-unbound active row ([sales, null, active]). Then two packages register sales in code, both registration orders, and the RestServer has no objectQLProvider. TO is the head as built. FROM is the head with the resolver call ablated: the marker was present in 2 built files, then restored, with the blob equal to HEAD and the marker absent from all 24 built files.

door FROM TO
GET /meta/dashboard/sales/published 200, the package-unbound row (env row) 409 RESOURCE_CONFLICT, details null
GET /meta/dashboard/sales (plain read) 409 with details.candidates naming both the same

VERDICT command-exit 0. The dispatcher rows are read from the tree, not measured.

Dogfood battery, on fa7fb66

Built @objectstack/dogfood^... (turbo, VERDICT command-exit 0), then under the lock pnpm --filter @objectstack/dogfood test with no OS_TEST_SHARD and no path: VERDICT command-exit 0, Test Files 467 passed, 3 skipped (470); Tests 3959 passed, 42 skipped (4001). The final head adds only the protocol.ts docblock commit; the emitted JS differs from fa7fb66a7c's in comment lines alone, so the battery reading covers the head's executable bytes. The final head adds a changeset edit and the 4-line @throws docblock, again comment-only.

Packages, on head 6e50dbd (before merging main) and on 02d6109 (after it)

On 6e50dbd5c7, under the verify lock (VERDICT command-exit 0): typecheck and test green for metadata-protocol (22883 passed), rest (8451), runtime (10874), plugin-security (6681), objectql (13110), service-automation (3976), client (812), cloud-connection (1217), plugin-auth (5465), plugin-email (1018), service-messaging (966), service-package (144), plugin-dev tests (89). organizations, plugin-approvals, verify, cli and three typechecks went red there on Cannot find module / Failed to resolve entry for packages this worktree had not built (build state, not this diff).

On 02d6109dde (one merge of origin/main, no conflict, no touched file moved upstream), after building the whole closure of those packages (turbo exit 0), under the lock (VERDICT command-exit 0): the targeted files rest 62/62, metadata-protocol 3/3, runtime 367/367; typecheck green for all 17 packages (metadata-protocol, rest, runtime, plugin-security, objectql, service-automation, client, cloud-connection, organizations, plugin-approvals, plugin-auth, plugin-dev, plugin-email, service-messaging, service-package, verify, cli); tests green for service-automation (3977), organizations (252), plugin-approvals (1652), plugin-dev (89), verify (439), cli unit (6000).

Gates

The derived set (dispatch-gates.mjs --commands, 70 commands) ran on d0a5dbd220: 67 exit 0. check:test-source-alias was red on a runtime pin file this PR edits (a dynamic @objectstack/metadata load in a clocked window); fixed in 6e50dbd5c7 (module-top import), re-run exit 0. check:dual-build-cjs-loads and check:type-check-debt: PREREQUISITE NOT MET locally (no full build; the lock queue), so NOT MEASURED here; CI runs both. PR body gates on this body: closing-keyword-parity, partof-closing-keyword, changeset-no-major and adr-0087-registration exit 0. ESLint on the changed files exit 0. The union on the final head is cited in the report on #32622.

On e516f3534b, re-derived (74 commands, the protocol.ts touch adds check:adr-symbol-anchors, check:facade-delegation-only, check:filter-alias-parity, check:wildcard-fallthrough): 73 exit 0; check:type-check-debt exit 3 PREREQUISITE NOT MET (its build lost the lock queue), NOT MEASURED, CI runs it. dispatch-gates --ran: 74 accounted, 73 run, 1 NOT-MEASURED, 0 UNRUN. check-platform-checklist --changed-from origin/main exit 0. On this body: changeset-no-major (LEVEL AXIS reads no (narrowing) + none at patch), adr-0087-registration (1 declared-breaking changeset, not-required (no-migration-prescription)), closing-keyword-parity and partof-closing-keyword exit 0.

On the final head e57e7c0566 (the /published banner row and the @throws docblock): the 74 derived commands again gave 73 exit 0, with check:type-check-debt exit 3 PREREQUISITE NOT MET, so NOT MEASURED. --ran accounted for 74 (73 run, 1 NOT-MEASURED, 0 UNRUN). check-platform-checklist --changed-from origin/main exit 0. Changeset gates (adr-0087-registration, changeset-no-major, empty-changeset, changeset-fixed, nul-bytes) exit 0. git merge-tree --write-tree --name-only against origin/main e71ecc1b32 exit 0, so it still merges clean now that #33898 is merged; #33889 bdb3a20a71 exit 0. CI Test Core (3/8) on e57e7c0566 failed twice: run 43743965993, job 132903743253, and the lane's one re-run, job 132914286588. Both times the only failed task was packages/qa/scenarios run-date.test.ts, on vitest's 5000 ms timeout. The first run failed 2028-03-31 at 6278 ms. The re-run failed 2028-02-28 at 5619 ms and 2028-02-29 at 6907 ms, while 2028-03-31 passed there at 4615 ms. A different case each time, and no assertion failed. The test imports only @objectstack/spec and the scenarios package's own sources, which this diff does not touch. The same file failed the same way on main without this PR: the merge-queue run of the unrelated objectql-only #33902 (run 43747969462, job 132917233366, Test Core 4/8) failed 2028-02-28 at 5719 ms. main's push run does not run scenarios at all (affected-only shards). Locally, on the branch merged with origin/main at 9dd398cda0, the file passed 3 of 3 runs (34/34 each, about 5.4 s of tests). The scenarios closure is byte-identical to main there (git diff origin/main -- packages/qa/scenarios packages/spec docs/qa is empty). Read: a load timeout that is main's, not this PR's. No rerun from here.

On the final head a2b29893d0, two merges of origin/main landed, both clean. 9dd398cda0 came first. a2b29893d0 contains #34104 (e9fb09871d), the fix for those run-date timeouts (p0 #34081). Under the lock, at that head:

  • build closure exit 0;
  • targeted pins: metadata-protocol 3/3, rest 389/389 (the S1 describe included), runtime 421/421, scenarios run-date.test.ts 35/35;
  • typecheck exit 0 for metadata-protocol, rest and runtime.

Between the two merges, the runtime typecheck went red once, on meta-object-publish-column-changes.test.ts (TursoDriver not assignable to SqlDriver). The cause was build state: @objectstack/driver-turso is a peer dependency, so it is outside runtime^..., and its dist was older than driver-sql's. It went green once driver-turso was built.

Derived gates on that head:

  • 75 commands, 74 exit 0;
  • check:type-check-debt exit 3 PREREQUISITE NOT MET, so NOT MEASURED;
  • --ran exit 0;
  • check-platform-checklist exit 0;
  • changeset gates exit 0;
  • git merge-tree against origin/main bf594ebd72 exit 0.

Generated by Claude Code

🤖 Generated with Claude Code

… packages hold carries details.candidates (ADR-0150 D5)

The REST /meta/:type/:name/layers catch now asks handleRouteError for the
package-scoped candidates, as the plain read's catch does, so the plain
read's refusal the door's owner step answers and the served-holders refusal
of step 1c carry details.candidates on RestServer as on the dispatcher. The
step-1c refusal of a name whose active rows two packages hold (the
package-less writes' sentence, code and status, unchanged) now carries its
holders by shape as a package-scoped refusal, so both transports answer them
as details.candidates. The save and delete doors' answer does not move.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…name two served packages register, as the plain read does (ADR-0150 D3)

getMetaItemLayered now asks the registry's package-scoped resolver for a type
addressed by package, as getMetaItem does, before any layer is read: a name
two or more served packages hold is refused naming each
(PackageScopedNameRefusedError, 409 RESOURCE_CONFLICT), whatever the metadata
service holds. Its code layer used to fall back to the artifact lookup's
first composite, so the read in process, and the REST /layers door on a host
with no engine wired, answered the holder that registered first. A name one
holder holds keeps its layers; stored-row holders stay the door's step 1c.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…s as the plain read does

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
… the layered ambiguity pins

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

18 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json bf594ebd72d2569f25e5c62efb969abb159bc490.

⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

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

Coarse fallback — 26 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 bf594ebd72d2569f25e5c62efb969abb159bc490 → packageMentionDocs.

Which tree this was computed on

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

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

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

The no-engine REST /layers answer (200 with the first holder, now 409
with the holders as candidates) and the in-process getMetaItemLayered
answer (first holder, now PackageScopedNameRefusedError) are narrowings
of what a caller was served, so the changeset carries the narrowing arm,
the BREAKING banner with both moves and the ADR-0087 disposition.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…candidates and the registry judgment

packagelessLayeredReadRefusal's docblock now says its refusal carries the
holders as a package-scoped refusal, and that the in-process readers of
getMetaItemLayered meet the registry's refusal of a name two packages
register in code. Comment only; the emitted JS differs in comment lines
alone.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
@objectstack-fleet objectstack-fleet Bot changed the title fix(metadata-protocol, rest): the layered read of a name two packages hold refuses as the plain read does, naming the holders as details.candidates (ADR-0150 D3/D5) fix(metadata-protocol, rest)!: the layered read of a name two packages hold refuses as the plain read does, naming the holders as details.candidates (ADR-0150 D3/D5) Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

Request: review · PR #33885 · area S4 (E1) · Fixes #32622 #32914 · head e516f35

Tier: CONTRACT_REVIEW_TIER, owed because this is a narrowing declaration (contract-review.md, the 14:45Z face rule). Reviewer: review-b.

Declaration: Clause-②: no (narrowing), Metadata-protocol: none, ! in the title, and a patch changeset under a BREAKING banner. The banner gives FROM→TO for two moves:

  • no-engine REST /layers: 200 with the first holder → 409 with details.candidates;
  • in-process getMetaItemLayered: resolved the first holder → throws PackageScopedNameRefusedError.

The banner also carries adr-0087: not-required (no-migration-prescription), spelled after #33646.

Evidence:

Reports on #32622: the original, plus the rework addendum 6897100983.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review claim · head e516f35 · 2026-11-15T15:49Z

Contract-review-claim: session_01QsR2jTyY9BGjj9WBi7QgH6 · head e516f35 · 2026-11-15T15:49Z

review (review-b, areas S2+S4): the CONTRACT_REVIEW_TIER record (face: narrowing declaration, two served-to-refused moves on the layered read) and the verdict follow on this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e516f3534bd5f0d4eb74c140f8da53b2d4ec31ff
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-meta-layered-reads.ts, packages/metadata-protocol/src/protocol.packageless-layered-read-refusal.test.ts, packages/metadata-protocol/src/protocol.ts, packages/rest/src/meta-disabled-package-doors.test.ts, packages/rest/src/meta-item-read-routes.ts, packages/rest/src/meta-layers-ambiguous-package.test.ts, packages/runtime/src/domains/meta-disabled-holder-served-stack.test.ts, packages/runtime/src/domains/meta-layers-ambiguous-package.test.ts, packages/runtime/src/domains/meta-qualified-item-read.test.ts + read in the cited code, never reviewed: packages/metadata-protocol/src/protocol-meta-item-reads.ts (the plain read's packagelessScopedRead), packages/metadata-protocol/src/protocol-meta-item-face.ts, packages/metadata-protocol/src/protocol-environment-rows.ts, packages/metadata-protocol/src/sys-metadata-repository.ts, packages/objectql/src/registry.ts, packages/objectql/src/package-scoped-read.ts, packages/core/src/package-scoped-resolution.ts, packages/types/src/thrown-http-error.ts, packages/rest/src/error-response.ts, packages/rest/src/rest-server.ts, packages/rest/src/meta-item-history-routes.ts, packages/runtime/src/domains/meta.ts, packages/plugins/plugin-security/src/packaged-permission-set-lock-gate.ts, packages/plugins/plugin-security/src/security-catalog-echo.ts, packages/spec/src/api/protocol.zod.ts, docs/adr/0150 (D3, D5), .changeset/32622-layers-two-holders-candidates.md (for ② only)

Inputs read: cards #32622 (body, 7 comments, the rework addendum 6897100983 included) and #32914 (body, 3 comments); PR #33885 body, file list (10 files) and the net diff against merge base 64807a9c; the check-runs on the head, read at 2026-11-15T15:55Z. PR author login: objectstack-fleet[bot].

Check-runs on the head as read (15:55Z): 25 completed success, among them Lint & Repo Gates, Lint · ESLint, Lint · CI, release & engine gates, Lint · PM dispatch-gates, Check Changeset (2), PR-body guards (2), Governed Surface Queue Guard, Type Check · source gates, Type Check · debt ledger, Dogfood Regression Gate (the aggregate; its shard matrix row reads skipped), Live E2E UI, Test UI. 18 completed skipped (UI lint, type check and build, docs build, opt-in harnesses, queue verdicts). STILL IN PROGRESS, no conclusion: Build Core, Test Core 1/8 to 8/8 and Type Check · workspace (Type Check · consumer gates was still running at 15:53Z and had left the in-progress list by 15:55Z). No check-run failed. The test and build verdicts for this head are therefore not read by this record; nothing below rests on them, and the landing check (every check green) is not met yet.

① Derived judgments

  1. In-process getMetaItemLayered({ type, name }), no packageId, a type the registry reads by package, a name two or more served packages register: resolved the first registered holder, now throws PackageScopedNameRefusedError (RESOURCE_CONFLICT, 409). Accept set narrowed. RIGHT. The added call is registry.resolveItem(type, name, null, member) under !request.packageId && readsByPackage(type) === true, the same call under the same condition as the plain read's packagelessScopedRead (protocol-meta-item-reads.ts:594), after the same canonicalisation and member resolution. One producer (readPackageScopedItem over resolvePackageScopedName), so the layered read can refuse nothing the plain read does not already refuse at that address.
  2. REST GET /meta/:type/:name/layers and ?layers=true, host with no objectQLProvider: 200 with one holder's layers, now 409. Narrowed. RIGHT, a consequence of 1: the door calls getMetaItemLayered before its gate chain (rest-server.ts serveMetaItemLayered).
  3. REST /layers catch now passes packageScopedCandidates: true: the 409 body gains details.candidates. Widened by one optional member on an existing refusal. RIGHT. Same handleRouteError option the plain read's catch passes (meta-item-read-routes.ts:1224), same recogniser (packageScopedRefusalCandidates in @objectstack/types, by shape).
  4. Step 1c's refusal (packagelessLayeredReadRefusal, the package-less writes' sentence) gains refusal: { status: 'refused', reason: 'ambiguous-in-environment', candidates }. Sentence, code and status unchanged; both transports now answer details.candidates. Widened. RIGHT. The candidates are packagelessAddress().candidates, already sorted there ([...bindings].sort()), and are the holders the sentence names. The save and delete doors call packagelessAddressAmbiguityRefusal directly and do not pass through withPackageCandidates, so their answer does not move; pinned (saveRefusal.refusal undefined, and no details on the writes on both transports).
  5. Side effect of 4, read and found harmless: that error now satisfies the by-shape isPackageScopedRefusal readers (runtime meta.ts, plugin-security). It is produced only by the door chain's step 1c and thrown to the layered route's catch, never from getMetaItemLayered, so no in-process reader meets it.
  6. protocol.ts: docblock only. No accept set moves.
  7. Not declared, and it moves (finding F1 in ④): REST GET /meta/:type/:name/published, bare, on the same no-engine host.

The 409 shape against the plain read's, for the two declared moves: identical. Same thrown object class from the same resolver call, so the same code (RESOURCE_CONFLICT), status (409), message, and refusal.candidates in the same order and content; on REST both catches hand it to handleRouteError with the same option, so the body is { error, code, details: { candidates } } on both. On the dispatcher the layered route answers through errorFromThrown and the plain read through packageScopedRefusalAnswer; that pair predates this diff (#32250) and is pinned in meta-qualified-item-read.test.ts. The new REST pins compare candidates sorted, not in order; the order equality holds by construction, not by pin.

② Semver level

  • .changeset/32622-layers-two-holders-candidates.md: @objectstack/metadata-protocol patch, @objectstack/rest patch. Matches what the diff publishes: source moves in those two packages only; packages/runtime carries tests alone.
  • Level: patch is the level AGENTS.md step 3 sets for Metadata-protocol: none ("a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition"). RIGHT.
  • Metadata-protocol: none: RIGHT. No key, accepted value or metadata type an author writes changes; the moved answers are reads.
  • ! in the title and in the changeset summary line; **BREAKING** banner with FROM, TO and the one-line fix ("name the package"). Present.
  • ADR-0087: exactly one marker, not-required (no-migration-prescription). The gate refuses that category only on a declared Metadata-protocol: narrowed (check-adr-0087-registration: a changeset declaring Metadata-protocol: narrowed can still take not-required (no-migration-prescription), so a narrowing ships with no upgrade-guide entry (#32345 item 2) #32601); this changeset declares none with the (narrowing) arm, so it is admissible, and the check-runs that carry check:adr-0087-registration and check-changeset-no-major read success on this head.
  • Both declaration lines are line-initial in the PR body and the changeset body.
  • Defect: the banner says "Two answers move". Three do on the tree (F1). The FROM and TO of the third are not in the changeset or the PR body.

Clause-②: no (narrowing). The arm is the right one: nothing a published schema accepts changes, and two declared answers plus one undeclared go from served to refused.

③ Boundary flags

④ Design judgment

Does the narrowing take a declared capability away, or make the spec's own refusal real? It makes the refusal real.

  • ADR-0150 D3 on main: "A caller with no package ... resolves against the whole environment: the environment item of that name first ..., else the unique package holder, else the refusal with candidates (409 at a door, D5)." Nothing in D3, D5 or the published GetMetaItemLayeredRequestSchema declares "the first registered holder" as an answer; the schema's packageId text describes the collision as something the package id resolves. The first-holder answer was the artifact lookup's fallback, an implementation gap, and the plain read at the same address already refused it. metadata-protocol: the in-process layered read refuses a bare name two served holders hold, for every package-addressed type, and the bare /layers door is pinned with no service copy #32914's constraint ("never answer a bare name by picking one holder", "No relaxation") is met.
  • The remedy stays served: packageId / ?package= reads each holder's layers (pinned in every composition), and a name one package holds is unchanged (CONTROL pin).
  • Tried to break it. (a) A registry with readsByPackage and no resolveItem: refused earlier by refuseUnjudgeableByNameRead, so the new call cannot hit a missing method. (b) One enabled and one disabled registered holder: servedAddressJudgment re-addresses the read to the served holder before the new guard, so packageId is set and the resolver is not asked; the read is served as before. (c) Stored-row holders beside a disabled package (the metadata-protocol: a name held only by stored rows of two packages, one disabled, answers by save order, and /layers takes the first composite when the environment holds its own item (ADR-0150 D3) #32354 Q2 state): the judgment leaves packageId unset and the resolver is asked of the registry only; the dev reports the Q2 in-process pin green, and on this head that rests on Test Core, which has not concluded. (d) An app read by its package-id key: the resolver finds no holder of that name and returns, no new refusal. (e) Draft layer (withDraft): judged before any layer, as the plain read judges before its draft switch.

Every caller of getMetaItemLayered in the tree at this head (grep over the whole repo; ui/** holds no in-process caller, only HTTP readers of /layers, whose default-host answer was already 409):

caller meets the new throw? handled
plugin-security packaged-permission-set-lock-gate.ts:96 yes (permission is read by package) yes: refusedPackageHolders reads refusal.candidates and reads each holder at its package; the lock now judges every holder, not the first
plugin-security security-catalog-echo.ts echoRowAt via echoSecurityCatalogMutation yes, for permission (position is not read by package) yes when the event names no package; see N1 for the package-unbound address
plugin-security echoRowIsServed yes, for an unowned permission slot yes: the throw reaches dropGoneEchoSlots' catch, the slot is kept ("unread is not gone")
rest rest-server.ts:3871 fetchCurrentMetaDocument no: getMetaItem is asked first and already refuses n/a
rest rest-server.ts:4449 /layers, ?layers=true yes yes: the route catch, with candidates (this diff)
rest meta-item-history-routes.ts:1371 /published yes, when no engine is wired (the plain read is asked first only behind the engine's registry) rethrown as 409 by the overlayError.status rule, to a catch that carries no candidates: F1
runtime meta.ts:1005 answerMetaLayered (/layers, ?layers=) yes yes: errorFromThrown, with candidates
runtime meta.ts:1636 /published yes, when the engine's registry is not reachable swallowed (only OBJECT_PACKAGE_DISABLED is answered), falls through to the snapshot: F1

Findings:

  • F1, should-fix. A third REST answer moves and is not declared; its dispatcher twin does not move. GET /meta/:type/:name/published, naming no package, a name two served packages register, on a REST host with no objectQLProvider (the composition the PR's own table calls "no engine wired"). Read on the tree, not measured: the route asks the plain read first only when the engine's registry answers isPackageDisabled (meta-item-history-routes.ts:1337-1349); without it, it calls getMetaItemLayered({ type, name }) and rethrows any error carrying a numeric status (:1404-1424). Before this diff that call returned, and the route went on to its overlay or snapshot exit; now it throws 409, which the route's final catch answers through handleRouteError(res, error) with no details.candidates. That is the right direction (the engine-wired /published already answers the plain read's 409), and it is the spec's own refusal, so it is not a must-fix. But the changeset banner and the PR body's Clause-② line both say two answers move and name /layers and the in-process read only; a breaking changeset owes each FROM and TO (AGENTS.md step 3). The dispatcher's /published in the matching composition catches the same throw and serves the snapshot (runtime meta.ts:1632-1670), so the two transports now differ there, and neither answer is pinned. Fix on the prose faces alone, which keeps this record governing: add the /published FROM and TO to the changeset banner and the PR body (or state there that it was measured not to move). File a follow-up card for the rest: pin both transports' bare /published in the no-engine composition, give the REST answer its details.candidates, and decide the dispatcher twin's swallow. Delta review owed on the wording.
  • N1, nit. echoSecurityCatalogMutation recovers from the refusal only when the event's address is undefined. For a permission event at the package-unbound address (packageId: null) of a name two packages register in code, echoRowAt now throws where it used to read the layers and then skip (the registry serves the name). Reachable through a legacy package-unbound row at boot, where the loop catches and logs a warning that the echo "failed"; a mutation projector is best-effort and warns. No grant, lock or served answer changes. Follow-up card or accepted deviation.
  • N2, nit. The getMetaItemLayered method docblock in protocol.ts, which the body file calls its contract, lists no @throws for the two-holder PackageScopedNameRefusedError (nor for the 501 and exact-qualifier refusals that predate this diff). The new throw is described in the neighbouring packagelessLayeredReadRefusal docblock only. A comment-only edit to a code file moves the head, so: follow-up card.
  • N3, nit. The new REST pins compare details.candidates sorted, so they would not catch an order difference from the plain read. The order is equal by construction (one resolver call). Accepted.

No must-fix. One should-fix (F1), closable on the prose faces plus a follow-up card.

Implemented-by: claude/area-E1-32622
Reviewed-by: session_01QsR2jTyY9BGjj9WBi7QgH6

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — PASS

Head-sha: e516f3534bd5f0d4eb74c140f8da53b2d4ec31ff
Area: S4 / E1 · Fixes #32622 #32914
Contract-review record: #33885 (comment) (CONTRACT_REVIEW_TIER, narrowing face, isolated run). Its verdict is PASS, with no must-fix and one should-fix. A delta review of that fix is owed before landing.

  1. The narrowing. It makes the ADR-0150 D3/D5 refusal real on the layered read, and takes no declared capability away.
    • The added registry.resolveItem(type, name, null, member) call runs under the same condition as the plain read's packagelessScopedRead.
    • The 409 has the plain read's error class, code, status and details.candidates.
    • packageId and ?package= still serve each holder.
  2. F1 · should-fix · a third answer moves and is not declared. Bare GET /meta/:type/:name/published on a REST host with no objectQLProvider reaches getMetaItemLayered without asking the plain read first. It rethrows any error that carries a numeric status: I spot-checked meta-item-history-routes.ts around lines 1400–1424 on the head.
    • So that route now answers 409, with no details.candidates.
    • The dispatcher twin (runtime/src/domains/meta.ts) swallows the same throw and serves the snapshot, so the two transports now differ, and neither is pinned.
    • Fix on the prose faces:
      • Add the /published FROM → TO to the changeset banner and to the PR body's Clause-② line.
      • File a follow-up card for three things: the pins, the candidates on that 409, and the dispatcher swallow.
    • The delta review reads only that prose move.
  3. Nits. These are follow-up material; none of them moves the head.
    • N1: echoSecurityCatalogMutation recovers only on an undefined address. A package-unbound permission event on a two-holder name now throws where it used to skip. It produces a warning only.
    • N2: the getMetaItemLayered docblock has no @throws for the new refusal.
    • N3: the REST pins compare candidates sorted, so order equality holds by construction.
  4. PR-body items for the area to fix with F1.
    • The PR body has no Skills-docs: line, which a (narrowing) arm owes.
    • The claim comments still read Clause-②: no. No gate reads them.
  5. Seat's call. The metadata-protocol + rest: the layered read (/meta/:type/:name/layers) of a name two packages hold answers as the plain read — 409 with details.candidates, never the first holder (ADR-0150 D3/D5; collects #32622 #32624) #32622 claim says "no protocol.ts", but the head edits the protocol.ts docblock under a "seat rule change 14:45Z" that is not on the card. The edit is comment-only, but the seat should confirm the rule.
  6. Semver and declaration.
    • The changeset is patch on @objectstack/metadata-protocol and @objectstack/rest, with Metadata-protocol: none.
    • It has the !, the BREAKING banner, and the ADR-0087 marker not-required (no-migration-prescription).
    • All of this matches the repo rules for a non-protocol narrowing.
    • The dogfood battery (467 passed, 3 skipped) was run at fa7fb66a7c, one comment-only commit below the head.
  7. File surface. 10 files, all of them the protocol, REST and runtime files of this change plus their tests.
  8. Check-runs on the head at review time: 26 success, 18 skipped, and 9 still in progress (Build Core, Test Core 1–8 of 8, Type Check · workspace). None has failed. Arm only once all are green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — FAIL (amended, ACCEPT read per review-checklist.md)

Head-sha: e516f3534bd5f0d4eb74c140f8da53b2d4ec31ff
This amends verdict 6897239914 on the same head. The contract-review record 6897231104 (PASS, with should-fix F1) is unchanged. Read against review-checklist.md, the ordinary review is REWORK on these items:

  1. REWORK: the PR body has no Skills-docs: line. A (narrowing) arm owes it, and review-checklist.md says a missing line is REWORK. This is a PR-body edit.
  2. F1 (should-fix, from the record). Declare the third moved answer: bare GET /meta/:type/:name/published on a REST host with no engine now answers 409 with no candidates. Add its FROM → TO to the changeset banner and to the Clause-② line, and file the follow-up card (pins, candidates, dispatcher swallow).
  3. Lane line. Amend the metadata-protocol + rest: the layered read (/meta/:type/:name/layers) of a name two packages hold answers as the plain read — 409 with details.candidates, never the first holder (ADR-0150 D3/D5; collects #32622 #32624) #32622 claim to name protocol.ts (docblock) before ACCEPT, as the seat ruled.
  4. Dogfood battery: accepted as a recorded deviation. It ran on fa7fb66a7c, one commit below the head. I diffed fa7fb66a7c..e516f353: one file, packages/metadata-protocol/src/protocol.ts, +7/−2, and every changed line is a comment line. So the battery covers the head's executable bytes. A further head move that touches code needs a new battery.
  5. Check-runs: wait for all to be green before arming.

Items 1–3 move only the PR body, the changeset and the card. The delta reads only those.

… two-holder refusal

The changeset's BREAKING banner gains a third FROM/TO. A bare
GET /meta/:type/:name/published on a REST host with no objectQLProvider
went on to its published exit and now answers 409 without candidates.
The getMetaItemLayered docblock names the PackageScopedNameRefusedError
it throws for a name two packages register in code. Comment and prose
only.

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

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

Test Core (3/8) red on head e57e7c0 (run 43743965993, job 132903743253) is judged a load flake, not this PR's. One re-run of the failed jobs follows; a second failure is treated as real.

  • Failing case: @objectstack/scenarios test/runner/run-date.test.ts › 'run on 2028-03-31 …', Error: Test timed out in 5000ms. at 6278 ms; 1 failed of 881, the loop's other eight cases passed in 1984–4428 ms.
  • The test imports only @objectstack/spec and the scenarios package's own src (loader, run-date, score, truth); this diff touches none of them.
  • It is a timeout, not an assertion. main's Test Core (3/8) passed on the same file at current origin/main (run 43744895949).
  • The cases run close to vitest's 5 s default since fix(scenarios): keep a working-day card's dates on working days on every run date #33999 changed the test; noted for that lane, not filed here.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head e57e7c0 · 2026-11-15T19:00Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e57e7c05668dc6989a54f4ff616a6e5a0002498e
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-meta-layered-reads.ts, packages/metadata-protocol/src/protocol.packageless-layered-read-refusal.test.ts, packages/metadata-protocol/src/protocol.ts, packages/rest/src/meta-disabled-package-doors.test.ts, packages/rest/src/meta-item-read-routes.ts, packages/rest/src/meta-layers-ambiguous-package.test.ts, packages/runtime/src/domains/meta-disabled-holder-served-stack.test.ts, packages/runtime/src/domains/meta-layers-ambiguous-package.test.ts, packages/runtime/src/domains/meta-qualified-item-read.test.ts + read in the cited code, never reviewed: packages/metadata-protocol/src/protocol-meta-item-reads.ts, packages/metadata-protocol/src/protocol-meta-item-face.ts, packages/metadata-protocol/src/protocol-environment-rows.ts, packages/metadata-protocol/src/protocol-artifact-lookup.ts, packages/metadata-protocol/src/protocol-exact-qualifier.ts, packages/metadata-protocol/src/protocol-mutation-fan-out.ts, packages/objectql/src/registry.ts, packages/objectql/src/package-scoped-read.ts, packages/core/src/package-scoped-resolution.ts, packages/types/src/thrown-http-error.ts, packages/rest/src/error-response.ts, packages/rest/src/rest-server.ts, packages/rest/src/meta-item-read-gate.ts, packages/rest/src/meta-item-history-routes.ts, packages/rest/src/meta-qualified-item-route.test.ts, packages/runtime/src/domains/meta.ts, packages/plugins/plugin-security/src/packaged-permission-set-lock-gate.ts, packages/plugins/plugin-security/src/security-catalog-echo.ts, packages/spec/src/api/plugin-rest-api.zod.ts, AGENTS.md (Post-Task Checklist step 3), .changeset/32622-layers-two-holders-candidates.md (for ② only)

Read at 2026-11-15T19:18Z. First review of this head by this seat, taken on patrol as owed; claim: comment 6899607341; prior record 6897231104 is on an earlier head. Independence: implemented in a zhuangjianguo lane; neither dispatched nor implemented by os-tesla.

Inputs read: card #32622 (body and comments, the dev report 6895377619 and the rework addenda included), card #32914 (body and 4 comments), follow-up card #34101 (body and its triage comment), PR #33885 body and every comment through 6899607341, the file list (10 files) and the net diff of refs/review/pr-33885 against merge base 64807a9c; the check-runs on the head and the log of the failed shard. Nothing was built or run here. Everything below marked "read" is read on the tree, not measured.

① Derived judgments

The doors of the layered read on this tree, and what each answers for a name two served packages register in code, read naming no package:

door reaches the new judgment answer at this head same as the plain read
protocol getMetaItemLayered in process yes throws PackageScopedNameRefusedError (409, RESOURCE_CONFLICT, refusal.candidates) yes: the same resolver call
REST GET /meta/:type/:name/layers yes, before the door chain 409 RESOURCE_CONFLICT with details.candidates yes: same thrown object, same handleRouteError option as the plain read's catch
REST ?layers=true yes the same, through the plain read's own catch yes
dispatcher /layers and ?layers= (answerMetaLayered) yes 409 with details.candidates through errorFromThrown; not touched by this diff yes, pinned since #32250
REST /published, no objectQLProvider yes 409, no details.candidates code and status yes, candidates no (declared)
REST /published, engine wired no, the plain read is asked first 409, no details.candidates, unchanged as before
dispatcher /published, engine registry not reachable yes the throw is swallowed, the snapshot exit answers no (declared; see S3)
REST fetchCurrentMetaDocument (/history, /audit, /diff) no, the plain read is asked first unchanged n/a
plugin-security lock gate and catalog echo yes, for permission caught, each holder read at its package n/a (see N1)

No SDK or client method calls the layered read in process: packages/client names layers only as a reserved address word, and ui/** reaches it over HTTP.

  1. getMetaItemLayered, no packageId, a type the registry reads by package: the added call is registry.resolveItem(type, name, null, member) under readsByPackage(type) === true. RIGHT. It is the call the plain read makes (packagelessScopedRead, protocol-meta-item-reads.ts:594), on the canonicalised type, with the member resolved the same way, after the same refuseUnjudgeableByNameRead. One producer (readPackageScopedItem over the one resolver), so code, status, message, candidate shape and candidate order are the plain read's by construction.
  2. What the new call can refuse. For a caller with no package the registry's resolver source supplies no platform item, so the only refusal is two or more package holders that are not an overridable baseline (or two baselines). Checked against the three states the brief names:
    • a name one package holds: resolved, no throw; the layers below are untouched (CONTROL pin solo);
    • a name with an explicit package: the guard is !request.packageId, and the exact qualifier keeps judging it (pinned, ?package= of each holder in every composition);
    • a name the environment holds over a package: the environment's own item answers first; a package-less customization row over one holder is no second holder (getEnvironmentScopedItem answers undefined for it), so the unique holder resolves. No throw in either.
      Also: one enabled and one disabled holder is re-addressed to the served holder before the guard, so the resolver is not asked. Nothing the plain read serves at the same address is refused by the layered read.
  3. The two places where the plain read's face sets an address the layered read does not (declaredMemberOverrideAddressOf, and the own-and-pair arm of storedRowHoldersRefusal), and the app package-id key: in each the resolver, asked with no package, resolves or finds nothing, so the layered read gains no refusal there. RIGHT.
  4. REST /layers catch with packageScopedCandidates: true: every package-scoped refusal that route throws now answers details.candidates. That is wider than the two exits the PR names: the bare-action refusal (judgeBareActionRead) and the exact-qualifier refusal (?package= of a package holding none) gain them too. RIGHT in direction (the plain read's catch does the same); not pinned (S1).
  5. Step 1c (packagelessLayeredReadRefusal): sentence, code, status and remedy unchanged; gains refusal: { status: 'refused', reason: 'ambiguous-in-environment', candidates }, recognised by shape. The save and delete doors do not pass through withPackageCandidates and are pinned carrying no details. RIGHT for the pinned state. The candidate set is the active rows' bindings, not the plain read's holder judgment (S2).
  6. protocol.ts: docblock only (13 lines added, 2 removed, every one a comment line). No accept set moves.
  7. Tests. REST: 3 compositions by 2 registration orders by 2 spellings, each asserting the plain read first, then the layered answer, and that neither holder's body is served; in process in every composition; CONTROL: one holder served in process and on both spellings, ?package= served. Step 1c and the metadata-protocol: a name held only by stored rows of two packages, one disabled, answers by save order, and /layers takes the first composite when the environment holds its own item (ADR-0150 D3) #32354 row-holder exit pinned on REST, the dispatcher and hono. The ablations in the PR body show each of the three source hunks is load-bearing for a pin.

② Semver level

  • Changeset: @objectstack/metadata-protocol patch, @objectstack/rest patch. Source moves in those two packages only; packages/runtime carries tests alone. Patch is the level step 3 sets for Metadata-protocol: none, which is the right kind: no key, value or metadata type an author writes changes.
  • BREAKING carrier: ! in the PR title and in the changeset summary; **BREAKING** banner in the changeset.
  • Clause-②: no (narrowing) and Metadata-protocol: none, line-initial, in the PR body and the changeset body. Skills-docs: none with its reason in the PR body; checked: nothing under skills/ names the layered or published door.
  • ADR-0087: exactly one marker, not-required (no-migration-prescription). Admissible for a read answer that moves with no stored shape changing.
  • FROM and TO: three rows (REST /layers with no engine wired, the in-process read, REST /published with no objectQLProvider), and the one-line remedy ("name the package"). The first two are complete. The third is incomplete for one state, and the sentence about the dispatcher is not true in that state (S3).
  • CI on this head, as read: 55 check-runs; 35 success, 18 skipped, 2 failure. The failures are Test Core (3/8) and the Test Core aggregate. Shard 3/8 failed on its first run and again on the lane's one re-run. Both times the only failed task was @objectstack/scenarios test/runner/run-date.test.ts, cases timing out at the 5000 ms default (a different case each run); in the re-run 74 of 75 tasks passed, the runtime package's 605 test files among them. packages/qa/scenarios is not in this diff and imports nothing the diff touches. Every other shard, Build Core, the type checks, the lint and changeset gates, the Governed Surface Queue Guard and the Dogfood Regression Gate aggregate read success. Read: not caused by this diff. But the head is RED, not running: the landing check is not met, and the lane's own rule ("a second failure is treated as real") has been reached. This PASS is on the contract only; the seat must not arm until Test Core is green on this head.
  • Dogfood battery: run on fa7fb66a. fa7fb66a..e57e7c05 is the changeset and comment lines in protocol.ts only (read), so the battery covers the head's executable bytes.

Clause-②: no (narrowing). The arm is right.

③ Boundary flags

④ Design judgment

Does the narrowing take a declared capability away, or make the spec's own refusal real? It makes the refusal real. ADR-0150 D3 gives a caller with no package the environment's item, else the unique package holder, else the refusal with candidates (D5). "The holder that registered first" is declared nowhere; it was the artifact lookup's fallback, and the plain read at the same address already refused. The remedy stays served (packageId, ?package=). Card #32914's constraint ("never answer a bare name by picking one holder", "No relaxation") is met for two holders. Card #32622's "carry the candidates on every /layers refusal exit, on both transports" is met in the code; its "pin each exit" is met for three exits of five (S1).

No must-fix. Four should-fix (S1 to S4): S1 and S3 want a small head move or a filed card before ACCEPT; S2 and S4 are follow-up cards. The contract of this PR holds on the tree: every door of the layered read that reaches the judgment refuses a two-holder name with the plain read's code and status, the /layers doors with its candidates, and nothing that is not a two-holder ambiguity is newly refused.

Implemented-by: claude/area-E1-32622
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

…s; declare the stored-row /published move

Two REST /layers exits now carry details.candidates through the route's
catch: the bare action read weighing the package-less holder, and the
exact qualifier of a package holding none. Each is pinned against the
item read's candidates. The stale comment that said /layers carries the
refusal's text only is corrected.

The changeset's /published row adds a state. A name with a package-unbound
active row, on a REST host with no objectQLProvider, was served that row
(200) and is now refused 409. The dispatcher sentence now covers that
state: it moves from the row to the code snapshot.

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

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head a2b2989 · 2026-11-16T00:02Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

Request: review (delta) · PR #33885 · area S4 (E1) · Fixes #32622 #32914 · head a2b2989 (green: 36 success, 18 expected skip, 1 superseded PR-body-guards run cancelled with its re-run success; declared final)

Two delta reads are owed on this head:

  • L1, review-b: delta from REWORK 6897329364 (e516f35). It covers F1, which declares the REST /published move in the changeset banner, the PR body's Clause-② line and its table. It also covers the Skills-docs: line, the N2 @throws, and the claim-lane lines (amendment 6897280879).
  • L2, delta on record 6899857966 (review#2, PASS at e57e7c0):

e57e7c05..a2b29893 is two merges of origin/main (clean; the second carries #34104, the p0 run-date fix #34081 behind both Test Core (3/8) reds) plus 53ca1e7 (the S1 test, the changeset and nothing else).
Dogfood battery: still the fa7fb66 reading. Since then the head adds only comments, changeset prose and one REST unit test; main merges aside, no executable byte has moved.
Reports: #32622 comments 6899229546 and 6903259509.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — PASS (delta)

Head-sha: a2b29893d07bbda1df8c314b3be97f543cb5b378
Supersedes the REWORK verdict 6897329364 (e516f353) and its predecessor 6897239914. Scope: the L1 items that verdict opened, read on this head's own diff against merge base b4eea885. The L2 delta on record 6899857966 belongs to review#2.

  1. Skills-docs: closed. The PR body now carries Skills-docs: none — …. Its reason holds: no skill under skills/ names the layered or published door, and the four docs pages named only name the routes.
  2. F1: closed on the prose faces. The changeset banner now says "Three answers move" and adds the REST /published FROM and TO.
  3. N2: closed. The getMetaItemLayered docblock in protocol.ts gains @throws PackageScopedNameRefusedError (409 / RESOURCE_CONFLICT). The PR's own protocol.ts diff has no non-comment line, so it is docblock only.
  4. Lane line: closed. Claim amendment 6897280879 names protocol.ts (docblock only) under the 14:41Z rule change, and its merge-tree check is clean.
  5. Dogfood battery: still accepted as a recorded deviation, re-measured on this head. Excluding comment lines, the PR's own diff of protocol-meta-layered-reads.ts, meta-item-read-routes.ts and protocol.ts is byte-identical at fa7fb66a7c (the battery's head) and at this head. I compared md5 of each file's own non-comment +/− lines: equal.
    • Since the battery, the only own changes are the REST unit test, the changeset and the docblock. The two main merges carry other PRs' code, and the merge-group Dogfood shards run in full on metadata-protocol (ci.yml core is 'true' on merge_group), so the 16:10Z rule needs no local re-run.
  6. New test, read for L1 form only. It adds the top-level describe #32622 — the other /layers refusal exits carry details.candidates to the shared meta-qualified-item-route.test.ts. Its contract adequacy is review#2's L2 delta.
  7. Check-runs on the head: 36 success, 18 skipped. The one cancelled run is a superseded PR-body guards run, and its re-run succeeded. Nothing has failed or is pending.

The own-diff patch-id is 157b58a1b6e15d12ba562d179f59e295a8e596fe. A clean main merge that keeps it keeps this PASS. Landing also needs review#2's L2 delta PASS on this head. #34169 (PASS 6903110803) lands after this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a2b29893d07bbda1df8c314b3be97f543cb5b378
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-meta-layered-reads.ts, packages/metadata-protocol/src/protocol.packageless-layered-read-refusal.test.ts, packages/metadata-protocol/src/protocol.ts, packages/rest/src/meta-disabled-package-doors.test.ts, packages/rest/src/meta-item-read-routes.ts, packages/rest/src/meta-layers-ambiguous-package.test.ts, packages/rest/src/meta-qualified-item-route.test.ts, packages/runtime/src/domains/meta-disabled-holder-served-stack.test.ts, packages/runtime/src/domains/meta-layers-ambiguous-package.test.ts, packages/runtime/src/domains/meta-qualified-item-read.test.ts + read in the cited code, never reviewed: packages/metadata-protocol/src/protocol-meta-item-reads.ts, packages/objectql/src/registry.ts, packages/objectql/src/package-scoped-read.ts, packages/rest/src/rest-server.ts, .changeset/32622-layers-two-holders-candidates.md and .changeset/33264-bare-doc-read-refusal.md (for ② and the merge check only)

Read at 2026-11-16T00:17Z. Delta review of this head against PASS 6899857966 at e57e7c0; claim: comment 6903603101; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5; reviewed by os-tesla, who neither dispatched nor implemented it.

Inputs read: the refreshed PR body, the PR comments through 6899857966, card #32622 body and comments through the dev report 6903259509, the file list (11 files), git show 53ca1e7b, the net diff of the head against its merge base, the main commits the two merges brought into the areas this PR touches, and the check-runs on the head. Nothing was built or run here. Everything marked "read" is read on the tree, not measured.

① Derived judgments

What the branch is since e57e7c05: merge 9dd398cd (main 27c2f1ea), one dev commit 53ca1e7b, merge a2b29893 (main b4eea885).

  1. The net change is the reviewed change plus 53ca1e7b, and nothing else. Merge base at e57e7c05: 64807a9c. Merge base at the head: b4eea885 (the second merge's main parent, an ancestor of main). Per path, the patch of 64807a9c..e57e7c05 and the patch of b4eea885..a2b29893 have the same patch-id for 9 of the 11 paths, the three source files among them (protocol-meta-layered-reads.ts and meta-item-read-routes.ts are the same blob; protocol.ts differs in blob by main's own hunks only). The two that differ are the two 53ca1e7b touches: the changeset (one line) and meta-qualified-item-route.test.ts (new in the diff, 35 added, 1 changed). Both merges are clean: git merge-tree --write-tree of each merge's two parents gives the tree the merge commit carries, so neither merge holds a hand edit.
  2. 53ca1e7b, the test hunk: a new top-level describe with two REST cases. The bare action read with the platform's item beside one package's asserts /layers answers 409 RESOURCE_CONFLICT with details.candidates exactly the package then the platform, and equal to the item read's candidates. /layers?package= of a package holding none asserts 409 with the one holder, equal to the item read's. Both compare ordered, not sorted. The comment that said /layers carries the refusal's text only is corrected, and its neighbour pin of /published (text, no candidates) is untouched. RIGHT: these are the two exits finding S1 of the prior record named. The author's ablation (the catch without the candidates option: both cases red, 2 of 325) shows the pins bear on the source line.
  3. 53ca1e7b, the changeset hunk: the third FROM row gains the state the prior S3 named (a package-unbound active row was served 200), and the dispatcher sentence now says it moves from that row to the code snapshot in that state. The PR body table carries both rows; REST is measured there (both orders, FROM 200 that row, TO 409 with no details), the dispatcher rows are declared read from the tree. RIGHT as a declaration.
  4. What the two merges brought into this PR's areas, and whether any of it meets the refusal contract. Commits under packages/metadata-protocol, packages/rest, the registry and the runtime meta domain in 64807a9c..b4eea885: fix(metadata-protocol): an action's artifact envelope is grafted only onto the item its package holds at that (object, name) #33898, fix(metadata-protocol): a bare save of a name an enabled and a disabled package hold writes the enabled holder's row #33889, feat(spec, objectql, driver-sql, driver-turso): run a per-measure aggregation filter in SQL behind one driver capability bit #33854, fix(objectql,runtime)!: a package-less action is kept on its own owner key, and a route serves the one on its key #33821, fix(runtime): a channel list with a member off the declared shape is not judged at the automation save doors #33970, fix(metadata-protocol): revertCommit reports a restored non-object item whose registry write-through faults #33979, fix(metadata-protocol): land the sys_metadata ACTIVE overlay index on PostgreSQL #34032, fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036, test(rest, dogfood): pin the action list agreeing with the by-name read beside a package-less action on another object #34073; outside them, feat(console): the docs reader lists the candidate packages when a doc name two packages ship is refused #34109 (console only). None touches protocol-meta-layered-reads.ts, meta-item-read-routes.ts, the resolver (package-scoped-read.ts, package-scoped-resolution.ts), the candidates recogniser or error-response.ts (read: empty diff on each).
    • fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036 adds a second producer of the same refusal: SchemaRegistry.resolveItem('doc', name) naming no package throws the one PackageScopedNameRefusedError class, reason ambiguous-in-environment, code RESOURCE_CONFLICT, status 409, candidates { kind: 'package', packageId } over the enabled packages that hold the name. Same class, same code, same candidate shape and the same meaning (the served packages that hold the name) as the resolver's refusal this PR's guard throws. Not a second semantics. The protocol asks it in the plain read only (readMetaItem); see S3.
    • feat(console): the docs reader lists the candidate packages when a doc name two packages ship is refused #34109 reads details.candidates of the plain doc read's 409 and keeps the entries whose kind is a package. It consumes the shape this PR answers on /layers; nothing in it contradicts or duplicates this PR.
    • The one candidate set on this door whose meaning differs is still step 1c's (the packages the active rows are bound to). That is this PR's own, unchanged since the prior record (S1 below); main added no third meaning.
  5. Source judgments 1 to 7 of the prior record stand unchanged: the bytes they were made on did not move.

② Semver level

  • Changeset: @objectstack/metadata-protocol patch, @objectstack/rest patch; ! in the title and the summary; **BREAKING** banner; Clause-②: no (narrowing) and Metadata-protocol: none line-initial in the PR body and the changeset; one ADR-0087 marker, not-required (no-migration-prescription). Unchanged in kind since the prior record, and still right: no key, value or stored shape moves.
  • FROM and TO: three rows, the third now complete for the stored-row state, with the remedy ("name the package"). Skills-docs: none with its reason.
  • CI on this head, as read: 55 check-runs, all completed; 36 success, 18 skipped, 1 cancelled, 0 failure, none running. The cancelled run is a first PR-body guards run; a later run of the same check on this head reads success. Test Core and its 8 shards, Build Core, the four type-check jobs, the Governed Surface Queue Guard and the Dogfood Regression Gate aggregate read success. The red shard of the prior head is green here (the head contains main's fix for the scenarios timeout).
  • Dogfood battery: run on fa7fb66a. Since then the branch's own commits are changeset prose, comment lines in protocol.ts and one REST test file (read); the head's executable source bytes in the two packages differ from that reading only by what main merged. The battery was not re-run on the merged head; CI's gate on this head is the reading for that.

Clause-②: no (narrowing). The arm is right.

③ Boundary flags

Prior record 6899857966, finding by finding at this head:

  • S1 there (two REST /layers exits unpinned, one tree comment saying the opposite): CLOSED. 53ca1e7b pins both exits against the item read's candidates and corrects the comment (judgment 2).
  • S2 there (step 1c's candidates are row bindings, not the plain read's holders): OPEN, unchanged in the tree. The PR body records it as read, not folded, and no card. Continued as S1 here.
  • S3 there (the /published declaration incomplete for a package-unbound active row): CLOSED on the prose faces, by the changeset line and the body rows, with REST measured. The dispatcher half is declared read, not measured, and no pin holds either /published answer; that was already the accepted state.
  • S4 there (the layered read takes the resolver's judgment and not its answer): OPEN, unchanged in the tree. Recorded in the PR body, not folded, no card. Continued as S2 here.
  • N1 there (the security catalog echo at a package-unbound address): UNCHANGED; recorded as accepted in the PR body, no carrier. Continued as N1.
  • N2 there (pin breadth): CHANGED a little. The two new pins compare ordered and cover an action and a page; the two-holder pins still compare sorted and cover dashboard only, no bundle member, and no dispatcher pin on a boot with no metadata-service copy. Continued as N2.
  • N3 there (PR body staleness): CLOSED. The body now says The bare /published read of a name two packages register: pin both transports, give the REST 409 its candidates, decide the dispatcher's swallow (ADR-0150 D3/D5) #34101 was closed as not planned and that the red shard was re-run.

Other flags:

  • The dev report's security_findings: none: nothing in the delta contradicts it. The rule the code must keep is unchanged: the layered door tells a caller no more about a name's holders than the plain read's refusal at the same address tells that caller. The two new pins hold it by equality on two more exits. No security finding in the delta.
  • "Not folded and no card, under the p3 standard" for the two open should-fix items: that is a seat decision, not the implementer's and not this record's. The seat's ACCEPT should say it in its own words.
  • Always-check (SQL pushdown): the delta adds no read. No new row read, id materialisation or in-app join.

④ Design judgment

The narrowing still makes the spec's own refusal real and takes no declared capability away: ADR-0150 D3 and D5 give a caller with no package the unique holder or the refusal with candidates, the remedy (packageId, ?package=) stays served, and the delta moves no answer. Card #32622's "pin each exit" is now met for the REST exits the catch reaches.

  • S1 (should-fix) — continues S2 of 6899857966. Step 1c's details.candidates name the packages the active rows are bound to, not the holders the plain read judges, so one door answers two meanings of candidates under one code. Read, not measured: where a package's row stands beside its own customization pair's row, the plain read serves that package's row while bare /layers answers 409 and names the pair as a package. Fix: a follow-up card that filters as the stored-row holder judgment does, or a ruling that this exit names row bindings, with a pin of that state on both transports.
  • S2 (should-fix) — continues S4 of 6899857966. For a name an overridable baseline and one other package both hold, the plain read serves the other package; the layered read does not refuse, and with no metadata-service copy its code layer is still the first composite by registration order. Read, not measured; not introduced by this diff. Fix: a follow-up card that measures it and reads the layers at the holder the resolver resolved.
  • S3 (should-fix) — new, from the merge of fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036. On this head the plain read refuses a doc name two enabled packages hold, naming both. The layered read's guard is readsByPackage(type), and doc is not in that set, so getMetaItemLayered({ type: 'doc', name }) in process is not judged (read: the guard is the only resolver call in that function) and answers one holder's layers. The REST /layers door answers that 409 only where a step of its chain asks the plain read; the composition with no engine wired was not followed here. So for doc the state this PR closes for the package-read types is open again, and the changeset's sentence "now answers like the plain read on every exit and on both transports" holds for the types the registry reads by package, not for doc. Where the doc refusal is thrown inside the REST /layers route, this PR's catch now answers its candidates too, unpinned. Neither PR introduced the gap alone; it opens where the two meet. Fix: a follow-up card (the layered read asks the doc judge before its layers, as the plain read does, with pins on both transports and in process), filed before ACCEPT or ruled out by the seat.
  • N1 (nit) — continues N1 of 6899857966. At a package-unbound address of a permission name two packages register, the security catalog echo throws where it read and skipped; its callers catch and warn. No grant, lock or served answer changes (read). No carrier.
  • N2 (nit) — continues N2 of 6899857966. Pin breadth as listed in ③.

No must-fix. Three should-fix (S1 to S3), each a follow-up card or a seat ruling, none a head move. The contract of this PR holds on the tree at this head: the net change is the change reviewed at e57e7c05 plus one test-and-prose commit, the two prior findings that wanted a head move are closed, and nothing main merged gives the refusal a second code or a second candidate shape.

Implemented-by: claude/area-E1-32622
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

席位核对

ACCEPT · area S4 (E1) · Head-sha: a2b29893d07bbda1df8c314b3be97f543cb5b378

  • Shape: Fixes #32622 #32914. Draft, base main, 11 files, +290/−22. mergeable_state clean. The title carries !, the changeset has a BREAKING banner (three answers move), and the declaration is Clause-②: no (narrowing) with Metadata-protocol: none, patch on @objectstack/metadata-protocol and @objectstack/rest. The ADR-0087 marker is not-required (no-migration-prescription). The body carries a Skills-docs: none — … line.
  • Premise: measured. Before the fix, the bare layered read of a name two served packages register answered the first registrant's layers; after it, 409 RESOURCE_CONFLICT with details.candidates, in both registration orders (dev reports 6895377619, 6899229546 and 6903259509).
  • Reviews on this head:
    • L1: review-b delta PASS 6903653668. It supersedes REWORK 6897329364. Own-diff patch-id 157b58a1b6e15d12ba562d179f59e295a8e596fe.
    • L2: review#2 delta PASS 6903815196 (CONTRACT_REVIEW_TIER). It follows PASS 6899857966 at e57e7c0, and no must-fix is open.
  • Gates:
  • Accepted deviations:
    • The dispatcher's /published rows are read from the tree, not measured, and are labelled so in the changeset and the body.
    • protocol.ts carries docblock lines only (claim amendment 6897280879).
  • Out of scope (seat decisions, in the seat's own words):
  • Changeset: both reviews checked its sentences against the diff. It now covers the stored-row /published FROM (L2 S3 of 6899857966, closed).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

Landing (landing-operations B) · head a2b29893

Reading Value
check-runs on head 55: 36 success, 18 expected skip, 1 superseded PR-body-guards run cancelled (its re-run green), 0 pending/failed
check-governed-merges --pr 33885 NOT governed, 312 lines
reviews L1 PASS 6903653668 · L2 PASS 6903815196

State change: ready + auto-merge (area authorising line).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 00:20
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 661ede2 Nov 16, 2026
55 of 56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-E1-32622 branch November 16, 2026 01:08
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…em whose registry write-through faults (objectstack-ai#33979)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_

Fixes objectstack-ai#33851

Clause-②: no
Metadata-protocol: none

## 维护者速读

-
改了什么:撤销提交(revertCommit)现在对所有类型如实上报两类故障。第一类是恢复视图、权限、对象扩展等条目时,写入运行时注册表出错;这时该条目列入
failed[],写明「行已恢复到版本 N」。第二类是撤销删除条目后注册表修复(heal)中途停止;这时写明「行已从 sys_metadata
移除,注册表可能仍在提供被删的行」。两类都带出错原因和 code,success 为 false,和对象条目的处理一致。
- 为什么改:以前这些故障只记日志,撤销照样报 success:true,但进程实际还在使用旧内容,违反 revertCommit
自己的契约「success 即进程已生效」(ADR-0067 D3)。
- 风险与回滚:只有 revertCommit
读这两个新返回值。保存、发布、删除等其他调用方都忽略它们,同样的故障下仍答成功,日志也不变(有对照测试,另有消融证明对照测试能变红)。回滚即
revert 本 PR。
- 先看:`protocol-registry-hydration.ts` 中 `applyRegistryWriteThrough` 的两个
catch 和 `restoreArtifactRegistryView` 的外层
catch、剩余行循环;`protocol-package-commits.ts` 的 revertCommit
两个分支;`protocol.ts` 中两个转发方法的类型。
- 两分钟验证:`pnpm --filter @objectstack/metadata-protocol exec vitest run
src/protocol.revert-commit-honest-outcome.test.ts`,预期 31 个用例全绿(§3 共 12
个,§4 共 9 个)。
- 需要你做的:无,席位落地。objectstack-ai#33563 那条变更说明里的一句旧话,在单独的纯文本 PR 中更正。

## What changes

`applyRegistryWriteThrough` has three branches. The `object` branch has
answered the registry's refusal since objectstack-ai#33805. The two non-object
branches caught their faults and logged them at `warn`. The first is the
overlay hydration, which every type except `object` and
`object_extension` takes. The second is the `object_extension`
registration. The registry heal that a removal runs
(`restoreArtifactRegistryView`) logged its stop at `error` and returned
nothing.

- `protocol-registry-hydration.ts`, write-through. The request has its
own exported type, `RegistryWriteThroughRequest`, with one new optional
field, `answerFaults`. When it is `true`, a non-object branch that
throws still logs the same `warn` line, and then returns the fault in
the `ObjectRegistryRefusal` shape (`{ error }`). When it is unset, the
answer is `undefined`, as before.
- `protocol-registry-hydration.ts`, heal. `restoreArtifactRegistryView`
now returns a `RegistryHealStop` (`{ error }`) in two cases. The first
is when its outer catch stopped the walk; the `error` line it logs is
unchanged. The second is when a row still stored under another package,
which the heal registers again (with `answerFaults: true`), is refused
or faults; every remaining row is still tried. Otherwise it returns
`undefined`, and that includes the designed outcomes: a refused baseline
read that retires the entry, and a degraded read that keeps it.
- `protocol-package-commits.ts`, `revertCommit`. The restore limb sets
`answerFaults: true`. The soft-remove limb reads the heal's stop, but
only where a row was actually removed; with no row removed, the heal is
a self-heal and stays logged. Both feed the existing `notApplied` /
`settle` path, so the item lands in `failed[]` with the row state, the
reason and its `code`. The revert's own commit still records the row
change. `rollbackToPackageCommit` carries the item through its existing
per-item channel.
- `protocol.ts`, two private forwarders. The
`restoreArtifactRegistryView` forwarder now returns `Promise` of
`RegistryHealStop | undefined` (`ProtocolHost` derives its type from
it). The `applyRegistryWriteThrough` forwarder's parameter is now
`RegistryWriteThroughRequest`, in place of its inline copy. The
`revertCommit` docblock sentence that said a non-object write-through
fault "is not seen here" now says that every type, and a stopped heal,
is reported. The `.d.ts` carries that docblock, so this change takes a
`patch` changeset.
- Every other caller ignores the new answers. Save and publish
(`protocol-save.ts`, `protocol-history-and-publish.ts`) do not set
`answerFaults`. They would report any returned refusal as an object's
(`object-registry-refused`), which ablation A4 shows. The delete door, a
publish's undo and a peer's convergence `await` the heal and discard its
answer.
- Changeset: `.changeset/33851-revert-non-object-write-through-fault.md`
(`patch`). It says that it supersedes the sentence of the objectstack-ai#33563 note
claiming such a fault "is still not seen by the revert". The objectstack-ai#33563 note
itself is unchanged here: its one sentence is corrected in a separate
text-only PR (DELIBERATE CORRECTION).

## Tests


`packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts`,
the revert harness, gains two top-level describes. They go there as
AGENTS.md requires (ruling record 6583487846).

- §3 has 12 cases, 4 each for `view`, `permission` and
`object_extension`: a clean restore control, which reaches the registry
verb as a non-vacuity check; a write-through throw that goes to
`failed[]` with `code`, "its row was restored to the body of version 1",
the reason and `success: false`; a save control; and a publish control.
The two controls hold under the same fault: `success: true`, no
advisories, and the same `warn` line.
- §4 has 9 cases, 4 each for `view` and `permission`: a clean
soft-remove control; a heal stop that goes to `failed[]` with `code`,
"its row was removed from sys_metadata", "may still serve the removed
row", `success: false` and the heal's `error` line kept; a delete
control (`success: true`, `error` line kept); and a save-and-publish
control (both `success: true`, no advisories). The ninth case is an
`action` row still stored under another package that the registry
refuses: it goes to `failed[]`. As a non-vacuity check, the stop is the
remaining row's write-through `warn`, not the heal's outer-catch
`error`.

Premise, measured on the code before each half. On the write-through
half (source at `63e47feeca`), §3's 3 fault cases were red: each
answered `success: true`. On the heal half (source at `2d23b49dd1`),
§4's 3 fault cases were red, with 28 cases green.

<details><summary>Ablations (scripts/ablation-replace.mjs, each landed,
run, then restored to blob == HEAD with git diff HEAD empty)</summary>

| Ablation | Red | Green |
| --- | --- | --- |
| A1: the overlay branch does not answer | 2 (§3 view, permission fault)
| 20 of 22 |
| A2: the extension branch does not answer | 1 (§3 object_extension
fault) | 21 of 22 |
| A3: revertCommit does not set `answerFaults` | 3 (every §3 fault case)
| 19 of 22 |
| A4: the overlay branch answers every caller | 4 (view and permission
save and publish controls; the save answered an
`object-registry-refused` advisory, "object 'ticket.grid' was published,
but the runtime registry refused it") | 18 of 22 |
| A5: the extension branch answers every caller | 2 (object_extension
save and publish controls) | 20 of 22 |
| B1: the heal's outer catch does not return its stop | 2 (§4 view,
permission heal stop: "expected true to be false" on `success`) | 29 of
31 |
| B2: the remaining row's refusal is dropped | 1 (§4 remaining-row case)
| 30 of 31 |
| B3: revertCommit does not read the heal's stop | 3 (every §4 fault
case) | 28 of 31 |

My first A1 to A3 attempt was a no-op: the replacement was a substring
of the anchor, `ablation-replace` refused it, and no test ran. They were
re-run with distinct markers, and the table shows those runs. A1 to A5
were run before §4 existed (22 cases). B1 to B3 were run on all 31
cases.
</details>

## Acceptance notes

- Out of scope, left as it is: in the heal, the object owner branch's
`unregisterObject` refusal ("object 'x' was deleted from sys_metadata
but stays registered") is still a `warn` line that answers no stop. It
is an object-only path, and the card's ruling covered the outer catch
and the remaining rows.

## Verification

<details><summary>Readings, local, at head 999b09d</summary>

- One locked run, at `999b09d9c3` with `origin/main` `68e726d631` merged
in (lock VERDICT command-exit 0; queued 6m18s, after a first attempt's
queue-timeout exit 99). It ran: the metadata-protocol dependency closure
build; `typecheck` exit 0; `test` 342 files passed and 9 skipped, 22923
tests passed; the metadata-protocol build; and the objectql suite, 597
of 597 files and 13177 of 13177 tests.
- The other direct dependents (runtime, cli, service-automation,
cloud-connection) were not run locally. CI runs them (Test Core). The
only type that moved is on private forwarders; `RegistryHealStop` and
`RegistryWriteThroughRequest` are not exported from the package entry.
- `pnpm lint`: exit 0.
- `dispatch-gates --ran`: 73 derived families, each with its exit code
recorded. 70 exit 0. 3 are NOT MEASURED, because each needs the whole
workspace built: `check:dual-build-cjs-loads`,
`check:lean-entry-closure` and `check:type-check-debt`, all exit 3
(PREREQUISITE NOT MET). CI runs them. The body gates (closing-keyword
parity, Part-of, changeset no-major, ADR-0087 registration) exit 0.
- `git merge-tree --write-tree --name-only`: clean against `origin/main`
`68e726d631`, against objectstack-ai#33885's head `fa7fb66a7c`, and against S5's
`claude/area-E1b-33832` head `9c4f75f36e`. No open PR for objectstack-ai#33308 was
found. No other open PR touches `protocol.ts`,
`protocol-registry-hydration.ts`, `protocol-package-commits.ts` or the
harness file.
- Dogfood: not run, because the title has no `!` and Clause-② has no
(narrowing) arm.
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
<!-- signed: domain:server#5 · zhuangjianguo ·
session_01QsR2jTkZnXtRhuEiiyidvJ -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…red override as effective (objectstack-ai#34169)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_

Part of objectstack-ai#32849 (the bare layered read's `effective` exit; the read
naming no member, measured below, stays open on objectstack-ai#32849)

Clause-②: no
Metadata-protocol: none

**objectstack-ai#33885 has merged.** This branch started from `claude/area-E1-32622`.
After objectstack-ai#33885 merged, `origin/main` was merged in (`c9112d29`), so the
diff is now this PR's own four files (+125/−7). The own-diff patch-id
`c0f3f1897e73032813735aa937738d8e0c8780a6` is unchanged.

## 维护者速读

- 改了什么:App 的 `.custom` pair 存了一行声明覆盖附加包 Z 自有成员 `fr-FR`
的邮件模板(`overrides.package: Z`)。objectstack-ai#33815 之后普通裸读已给出覆盖,但不带包的分层读
`?member=fr-FR&layers=true` 的 `effective` 仍是 Z 原版 `zeta fr-FR`、`overlay`
为空;现在它与 `?package=Z` 一致:`code` 是 Z 原版,`overlay` 和 `effective` 是覆盖,信封指向
Z。
- 为什么改:分层读的 `effective` 定义为「普通读会返回的内容」,声明了的覆盖应在每个给出 Z 该成员的出口被服务(ADR-0146
D8 第 2 项、ADR-0150 D4);Studio 编辑器读的正是这个出口。
- 风险与回滚:只在普通裸读已经改址到 Z 的同一情形下生效(复用同一个判定函数);未声明覆盖、声明给 X 的行(仍 409)、X 自己的
`en-US`、待发布草稿层均不变(已钉)。回滚即还原本 PR,存储数据不变。
- 先看:`packages/metadata-protocol/src/protocol-meta-layered-reads.ts` 中
`declaredOverrideAt` 与 `draftPackageId` 两处。
- 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run
--maxWorkers=2 src/package-scoped-exact-qualifier.test.ts -t 'the bare
layered read serves'`,预期 6 条全绿。
- 需要你做的:无,席位落地。

## What changes

Own files (four):
`packages/metadata-protocol/src/protocol-meta-layered-reads.ts`,
`packages/metadata-protocol/src/protocol-meta-item-face.ts` (one
`export` keyword and one docblock sentence, no behaviour),
`packages/objectql/src/package-scoped-exact-qualifier.test.ts`,
`.changeset/32849-bare-layered-read-declared-override.md`. No
`protocol.ts` edit.

`getMetaItemLayered`, naming no package and judged neither served nor
refused by `servedAddressJudgment`, now asks
`declaredMemberOverrideAddressOf` (the one predicate the plain read uses
since objectstack-ai#33815, exported from the item face for this). When it names the
member's one enabled shipper Z, the read takes Z's address for its
layers, as the plain read does, so `effective` is the override
`?package=Z` serves.

The pending draft layer (`withDraft`, the Studio door) is not moved: it
stays at the address the strict draft read takes
(`strictDraftReadAddress`), because the plain read's strict draft read
is outside the arm too. Re-addressing it would have made the draft layer
`null` where the strict draft read serves the pair's draft (measured: at
`?package=Z` the draft layer is `null`).

| read (both install orders) | before | after |
|:--|:--|:--|
| bare `?member=fr-FR&layers=true`, row declares Z | code `zeta fr-FR`,
overlay null, effective `zeta fr-FR` | code `zeta fr-FR`, overlay `pair
fr-FR`, effective `pair fr-FR`, envelope Z (= `?package=Z`) |
| same, with drafts, a pair draft pending | draft `pair fr-FR draft` |
unchanged (effective as above) |
| `?package=Z&member=fr-FR&layers=true` | effective `pair fr-FR` |
unchanged |
| bare `?member=en-US&layers=true` (X's own) | `suitex en-US` |
unchanged |
| bare, no row / undeclared pair row | effective `zeta fr-FR`, overlay
null | unchanged |
| bare, row declares X (objectstack-ai#32606 shape) | 409 naming X and Z | unchanged |
| door step 1c, `packagelessLayeredReadRefusal` | no refusal | unchanged
|

Nothing refused becomes served or the reverse; no authorable key or
value moves.

## Tests

New top-level describe in the shared real-`SchemaRegistry` harness
`packages/objectql/src/package-scoped-exact-qualifier.test.ts`:
`[objectstack-ai#32849] the bare layered read serves the pair's declared override of
an addition Z's own locale as effective, as ?package=Z does` (6 tests):

- fix pin, both install orders: bare layers equal `?package=Z`'s
(`effective` deep-equals the `?package=Z` document), step 1c refuses
nothing, `effective` equals the plain bare read, X's `en-US` untouched.
- draft pin: the draft layer is the strict draft read's (`pair fr-FR
draft`), `?package=Z` has none.
- CONTROL no override x2 (no row / undeclared pair row): Z's own, no
overlay.
- CONTROL row declares X: 409 `RESOURCE_CONFLICT` naming X and Z.

BASE measured on `e516f353` (the objectstack-ai#33885 head) with a temporary probe in
this harness before any edit: bare effective `zeta fr-FR`, overlay null,
in both orders; `?package=Z` effective `pair fr-FR`.

<details><summary>Ablations (each through
`scripts/ablation-replace.mjs`, metadata-protocol rebuilt,
`ablation-dist-preflight` marker present in 2 dist files, auto-restore
blob equals HEAD with `git diff HEAD` empty, rebuilt, marker absent from
all 24 dist files)</summary>

| | mutation | result (`-t 'the bare layered read serves'`) |
|:--|:--|:--|
| A1 | the arm's call replaced by `undefined` | 3 failed, 3 passed: both
fix pins, `expected [ 'zeta fr-FR', null, …(2) ] to deeply equal [ 'zeta
fr-FR', 'pair fr-FR', …(2) ]`; the draft pin, `expected [ 'zeta fr-FR',
'pair fr-FR draft' ] to deeply equal [ 'pair fr-FR', 'pair fr-FR draft'
]` |
| A2 | `isServedOverrideRowOf(row, shipper, installed)` replaced by
`true` | 2 failed, 4 passed: the undeclared-row CONTROL, `expected [
'zeta fr-FR', 'pair fr-FR', …(2) ] to deeply equal [ 'zeta fr-FR', null,
…(2) ]`; the X-declared CONTROL, `the read answered; a refusal was
expected` |
| A4 | the draft address re-addressed with the arm (`declaredOverrideAt
?? request.packageId`) | 1 failed, 5 passed: the draft pin, `expected [
'pair fr-FR', null ] to deeply equal [ 'pair fr-FR', 'pair fr-FR draft'
]` |

</details>

## Acceptance notes

- The no-row CONTROL pins an unchanged outcome by construction:
re-addressed to Z, Z's exact layers with no row answer Z's own `fr-FR`
too. The undeclared-row CONTROL is the one that catches an arm ignoring
the declaration (A2).
- Still open on objectstack-ai#32849, measured on `e516f353` with the same probe (X
ships `fr-FR`, Z ships `en-US`, the pair row declares Z for `en-US`):
the read naming NO member serves Z's `zeta en-US`, both the plain bare
read and the bare layered read, while the bare layered member read
`?member=en-US` takes the override after this change. `/published` calls
the layered read with no member (`meta-item-history-routes.ts`), so it
reads that same exit; not measured at the door. The helper answers
`undefined` when no member is named; that exit lives in the item face
first and is left to the card.
- Measured through the protocol with a real `SchemaRegistry`, stored
rows and hydrated rows (the objectstack-ai#33815 footing), not through the HTTP save
door; the door's own step 1c is pinned at the protocol.

## Verification

Head `f23319f9` (merges of `origin/claude/area-E1-32622` `e57e7c05` and
of `origin/main` up to `27c2f1ea`, then `origin/main` again just before
opening; the derived gate union ran on `24ecb579`, the head before that
last merge). Every command ran under `scripts/pm/os-verify-lock.sh`.

- Before the last merge, on `96a0a52e`: `@objectstack/metadata-protocol`
typecheck 0, test `22902 passed | 43 skipped`; `@objectstack/objectql`
typecheck 0, test `13252 passed`; `@objectstack/rest` typecheck 0, test
`8763 passed | 355 skipped`; `@objectstack/runtime` typecheck 0, test
`12414 passed | 19 skipped`.
- After the merge, on `24ecb579` (incoming main touched
metadata-protocol, none of rest/runtime): rebuilt, metadata-protocol
typecheck 0, test `22926 passed | 45 skipped`; the harness file `321
passed`.
- `git merge-tree --write-tree --name-only` of `24ecb579` against every
open PR sharing a file, and main: objectstack-ai#33995 (`7b65fff0`, item face and
harness) clean, objectstack-ai#33979 (`999b09d9`, protocol.ts) clean, objectstack-ai#33885
(`e57e7c05`) clean, `origin/main` `27c2f1ea` clean. (Before the first
main merge the harness conflicted with main's objectstack-ai#33817 block; resolved by
keeping both describes.)
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` on `24ecb579`: 75 derived families, every
one exit 0 (exit codes captured before any pipe).
`check:dual-build-cjs-loads` first answered exit 3 PREREQUISITE NOT MET
(no dist for 41 packages) and answered 0 after a whole-tree `pnpm turbo
run build --concurrency=2` under the lock; `check:type-check-debt` was
interrupted mid-run once and re-run to exit 0. `--ran`: 75 derived, 75
run, 0 NOT-MEASURED, 0 UNRUN. Body gates on this body:
`check-changeset-no-major` 0, `check-adr-0087-registration` 0 (with the
PR payload too), `check-closing-keyword-parity` 0 (`GITHUB_EVENT_PATH`),
`check-partof-closing-keyword` 0 (`PR_BODY`).
- `pnpm lint`: exit 0 on `24ecb579`.
- After the last merge of `origin/main` (14 commits; it touched
`protocol-meta-item-reads.ts` and objectql `registry.ts`, not this
diff), on `f23319f9`: closure rebuilt, metadata-protocol typecheck 0 and
test `22926 passed | 45 skipped`, objectql typecheck 0, the harness file
`321 passed`; ratchet families re-run there: `check:type-check-debt` 0,
`check:type-check-coverage` 0, `check:nul-bytes` 0.
- After objectstack-ai#33885 merged: merge of `origin/main` `dfb8ed35` → head
`c9112d29`. The one add/add conflict was objectstack-ai#33885's own changeset,
resolved to main's landed text; none of this PR's files conflicted.
Closure rebuilt, metadata-protocol typecheck 0, objectql typecheck 0,
harness `321 passed`, all under the verify lock.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
<!-- signed: domain:server#5 · zhuangjianguo ·
session_01QsR2jTkZnXtRhuEiiyidvJ -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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

1 participant