Repository navigation
fix(metadata-protocol): an action's artifact envelope is grafted only onto the item its package holds at that (object, name) - #33898
Conversation
… at the served item's own owner key ADR-0150 D4 keys an action by (package, object, name). The by-name read looked the served item's artifact envelope up by name alone, so a package-less action bound to one object wore the envelope of the one package that binds the name to another object. Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ Co-Authored-By: Claude <noreply@anthropic.com>
… item's owner key, and record the moved call sites Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ Co-Authored-By: Claude <noreply@anthropic.com>
…vironment's on both transports, both faces and its route Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ Co-Authored-By: Claude <noreply@anthropic.com>
…und holder; add the changeset Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ Co-Authored-By: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7d0aaae9fa84381d80e725b297fcde281e51531b && git checkout 7d0aaae9fa84381d80e725b297fcde281e51531b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 53260281929a49c759557304757e534c283cd402 64c5d884523166bff685565f8623203d205ed0a5 && git checkout -B drift-repro 53260281929a49c759557304757e534c283cd402 && git merge --no-ff 64c5d884523166bff685565f8623203d205ed0a5
node scripts/docs-audit/affected-docs.mjs --json 53260281929a49c759557304757e534c283cd402
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ Request: review · PR #33898 · area S4 (E1) · Part of #33456 · head 64c5d88 Clause-② no · Metadata-protocol none · patch changeset. Report on #33456 (6895263237). Reviewer: review-b. Premise 2 (the envelope graft keyed by (object, name)) is fixed here. Premise 1 (the holder's route on a host whose engine registry never lists the package-less row) stays open on #33456: the area chose the report's option C, to measure reach on a real boot first, before any runtime edit. protocol.ts edit is limited to the private lookupArtifactItem wrapper. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review claim · head 64c5d88 · 2026-11-15T13:50Z review (review-b, areas S2+S4). Verdict follows on this PR. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — PASSHead-sha: review (review-b, areas S2+S4) · 2026-11-15T13:51Z I read the full diff at this head against GitHub: 9 files, +442/−12, of which source is +78/−12 over 3 files. I also read card #33456, the claim's file surface and report 6895263237. Correctness (premise 2, the envelope graft)
Declarations
This is the same footing as #33815 (verdict 6894129336). The changeset lists each FROM→TO, as the card's Do asked. Scope and deviations
Check-runs at this head (read at review time)
Author. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ 席位核对ACCEPT · area S4 (E1) · Head-sha:
Landing under the area authorising line: ready + auto-merge. |
…ad beside a package-less action on another object (objectstack-ai#34073) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbBePzY6g11h3hyWk5ud4vWy)_ Part of objectstack-ai#33904 — this PR lands the card's measurement and its pins: the HTTP reach of item 1 (not reached; the card regrades to p3) and item 2 (closed on main by objectstack-ai#33898, pinned here). The listing seam itself (`readFlattenedMetaItems`) is not changed and stays on the card at p3. Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:只加测试,不改产品代码。一是真实启动的 showcase 上,经 HTTP 钉住"动作列表与按名读取答同一项"(包先存、环境先存两种顺序);二是钉住"停用包在另一个对象上持有同名动作时,环境自己的动作按名读取照常返回、不挂停用包的包名"(objectstack-ai#33898 已在 main 修好)。 - 为什么改:卡 objectstack-ai#33904 要求先测 HTTP 能否遇到"列表漏掉环境自建动作"。实测 HTTP 走不到这个形状:托管包的同名动作在另一个对象上保存会被 403 拒绝;可写包则保存后只剩一条,列表和按名读取一致。所以按卡的规则降为 p3 并补钉子。 - 风险与回滚:零产品风险,只多两个测试用例块和一个 dogfood 测试文件;回滚即还原本 PR。 - 先看:`packages/qa/dogfood/test/action-list-packageless-other-object.dogfood.test.ts`(HTTP 一致性钉子);`packages/rest/src/meta-qualified-item-route.test.ts` 中 `[objectstack-ai#33904] a disabled holder on another object`。 - 两分钟验证:`pnpm --filter @objectstack/rest exec vitest run src/meta-qualified-item-route.test.ts -t 33904`,预期 2 个用例通过。 - 需要你做的:无,席位落地。 ## What changes Tests only; no product file moves. 1. **Item 1, HTTP reach (measured first, as the card asks).** On a real showcase boot (`bootShowcase`, admin session), the card's shape (a package's action on one object and the environment's package-less row of the same name on another, both stored) is not reached over HTTP: - managed code package (`showcase_open_docs` on `showcase_task`): `PUT /api/v1/meta/action/showcase_open_docs` with `objectName: showcase_product` and no `?package=` answers `403 NOT_OVERRIDABLE`; the list and the by-name read keep answering the package's item; - Studio-created writable package, both save orders: each save answers 200, and the store ends with ONE item of the name. The list, `?names=`, `?package=` and the by-name reads all answer that one item. So the listing and the by-name read agree on every HTTP-reachable state measured, and the card regrades to p3 (its rule 3). `action-list-packageless-other-object.dogfood.test.ts` pins that agreement in both orders. 2. **Item 2 (the seat's addition).** A package-less action on `contact` beside a DISABLED holder of the name on `account`: the objectstack-ai#33385 fold's harness probe reported the by-name read stamping the disabled holder's `_packageId`, so the face withheld the item (404). Re-run on main with objectstack-ai#33898 (`68e726d631`): served (200), `objectName: contact`, no `_packageId`, no package provenance, in both registration orders, for the environment's own item and for a registry-only package-less item. Pinned as a nested describe in the objectstack-ai#33456 block of the REST harness, and ablated (below). The reading is also on the card. No answer moves, so there is no FROM→TO table. ## Tests - `packages/rest/src/meta-qualified-item-route.test.ts`, describe `[objectstack-ai#33904] a disabled holder on another object` (2 cases × 2 registration orders; real `SchemaRegistry`, real protocol, real `RestServer` route table). - `packages/qa/dogfood/test/action-list-packageless-other-object.dogfood.test.ts` (new, isolated project; 2 cases, one per save order). ## Acceptance notes - Not changed here, carried on the card at p3: below HTTP the merged list slots an action by name alone (`mergePackageAwareOverlay`), and the sealed-managed decline (`declinesStoredRow`, `isStoredEntryOfDeclinedName`) judges an action by name, not by `(object, name)`. A package-less row stored beside a package's action on another object (the boot harness shape) is therefore left out of the list while the bare by-name read serves it. No HTTP save reaches that state today (above). NOT MEASURED: an environment row authored BEFORE a managed package that ships the same name on another object is installed. - Reported to the seat, not fixed here: with a writable package holding `qa_x` on `showcase_task`, a package-less `PUT /meta/action/qa_x` on `showcase_product` answers 200 and the package's own address then serves the product body (the package's action moved object); in the other order the package's save takes the environment's item over. Both read against ADR-0150 D4's `(package, object, name)` key; the save door is outside this PR's surface. ## Verification Head `ab5aeb0cfd` (origin/main `159757abc` merged in). <details><summary>Tests and typecheck (touched packages: rest, dogfood)</summary> - Closure build `pnpm --filter "@objectstack/dogfood^..." build` under the verify lock: exit 0. - `pnpm --filter @objectstack/rest exec vitest run src/meta-qualified-item-route.test.ts`: Test Files 1 passed; Tests 325 passed. `pnpm --filter @objectstack/rest typecheck`: exit 0. - `pnpm --filter @objectstack/dogfood exec vitest run test/action-list-packageless-other-object.dogfood.test.ts`: Test Files 1 passed; Tests 2 passed. `pnpm --filter @objectstack/dogfood typecheck`: exit 0. - `eslint --no-inline-config` over the two files: exit 0. - Diff is test-only (no source, no published file): no dependent suite is owed; the full dogfood battery is CI's (no `!`, no narrowing arm). </details> <details><summary>Ablation of the item 2 pin</summary> `packages/metadata-protocol/src/protocol-artifact-lookup.ts`: objectstack-ai#33898's owner-key rule bypassed through `scripts/ablation-replace.mjs` (anchor `if (owner === undefined || singular !== 'action') return artifact;` gains `|| name !== '__ablation_33904__'`, x0 to x1), `metadata-protocol` rebuilt, `ablation-dist-preflight.mjs` marker present (exit 0). `-t '33456|33904'`: 5 red of 8, both new cells `[404, undefined, undefined, false]` against `[200, 'contact', undefined, false]`, the three objectstack-ai#33456 shapes red with the holder's envelope; the three CONTROLs green. Restored: blob equals HEAD (`288b99c4f897`), `git diff HEAD` empty, rebuilt, preflight `--absent` exit 0, 8 of 8 green. The dogfood pin is a positive agreement pin and is not ablated. </details> <details><summary>HTTP reach readings (the probe, not committed)</summary> Real showcase boot, admin session, head `ac6ab305c5`: - Managed package: `PUT /meta/action/showcase_open_docs` (`objectName: showcase_product`, no `?package=`) answered 403 `NOT_OVERRIDABLE`; list, `?names=`, `?package=com.example.showcase` and the by-name read all answered `["showcase_task","Open Docs","com.example.showcase","package"]`. - Writable package, the package's save first: both PUTs 200; list, `?names=`, `?package=` and the bare and `?package=` by-name reads all answered `["showcase_product","env on product","com.example.qaprobe"]`. - Writable package, the environment's save first: both PUTs 200; every read above answered `["showcase_task","pkg on task","com.example.qaprobe"]` (and `/_env/` too). </details> <details><summary>Derived gate families</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `ab5aeb0cfd`: 54 families. 52 run locally, each exit 0 captured before any pipe; `--ran` reconciliation: 54 derived, 52 run, 0 NOT-MEASURED, 2 UNRUN. Declared to CI: `pnpm check:dual-build-cjs-loads` and `pnpm check:type-check-debt` (the latter takes the shared lock; the diff moves no tsconfig, package manifest or source). </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
…s hold refuses as the plain read does, naming the holders as details.candidates (ADR-0150 D3/D5) (objectstack-ai#33885) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_ Fixes objectstack-ai#32622 Fixes objectstack-ai#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 | - **`getMetaItemLayered` (objectstack-ai#32914, and the REST pick folded into objectstack-ai#32622 from objectstack-ai#32624).** Naming no package, a type addressed by package is judged by the registry's package-scoped resolver (`registry.resolveItem(type, name, null, member)`), as `getMetaItem` judges it (`packagelessScopedRead`), before any layer is read and whatever the metadata service holds. Only the judgment is taken; a name one holder holds keeps the layers it had. Stored-row holders are not this judgment's: the door refuses them in step 1c, as contract review S1 on objectstack-ai#33130 settled, and the in-process read in that state still resolves (the `[objectstack-ai#32354]` pin is unchanged and green). - **REST `/layers` catch (objectstack-ai#32622).** `handleRouteError(res, error, undefined, { packageScopedCandidates: true })`, as the plain read's catch (objectstack-ai#32201). The deprecated `?layers=true` spelling already answered through that catch. The dispatcher already carried the candidates (`errorFromThrown`). - **Step 1c's refusal (objectstack-ai#32622).** The package-less writes' refusal the layered door answers for a name whose active rows two packages hold (objectstack-ai#28337) keeps its sentence, code, status and `?package=` remedy, and now carries its holders as a package-scoped refusal by shape (`refusal.status: 'refused'`, `candidates` in the `/actions` shape), so both transports answer `details.candidates`. The save and delete doors do not move. This is the item the objectstack-ai#32607 seat re-ruling left to this card ("Carrying `details.candidates` on `/layers` remains objectstack-ai#32622's job", 6820653691). - `protocol.ts`: docblock only (9 lines, under the seat's 14:45Z rule change). `packagelessLayeredReadRefusal`'s docblock now says the refusal carries its holders as `refusal.candidates`, and that `getMetaItemLayered`'s in-process readers meet the registry's refusal of a name two packages register in code. The emitted `dist/index.js` and `dist/index.cjs` differ from `HEAD~1`'s in those comment lines alone (two builds, raw diff). A later commit adds the `@throws` for the two-holder refusal to `getMetaItemLayered`'s docblock (review-b N2, 4 lines). ## Tests - `packages/rest/src/meta-layers-ambiguous-package.test.ts`, new describe `[objectstack-ai#32622, objectstack-ai#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. - `[objectstack-ai#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`. - `[objectstack-ai#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 `objectstack-ai#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 `objectstack-ai#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. <details><summary>Ablations (each leg restored; blob == HEAD proven by ablation-replace)</summary> 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. </details> ## Acceptance notes - review-b F1 is closed on the prose faces: the `/published` rows are in the changeset banner, the `Clause-②` line and the table. Its follow-up card objectstack-ai#34101 was filed, then closed as not planned by triage under the p3 standard. So the REST and dispatcher `/published` answers stay different (REST 409 without `details.candidates`; the dispatcher swallows the throw and serves the snapshot), and neither is pinned. Recorded here as accepted. - review-b N1 / review#2 N1: `echoSecurityCatalogMutation` recovers from the refusal only when the event names no address. At a package-unbound address of a `permission` name two packages register, the echo now throws where it used to read and skip; the projector runner and the boot pass catch it and warn. No grant, lock or served answer changes (read). Its carrier objectstack-ai#34101 is closed, so it is recorded here as accepted. - review#2 S1 is folded (Tests above). review#2 S3 is folded: the stored-row FROM and the dispatcher row are in the changeset, the `Clause-②` line and the table. REST was measured (see the S3 block under Verification); the dispatcher rows are read from the tree. - review#2 S2 (read, not measured): "Step 1c's `details.candidates` are the packages the active rows are bound to (`packagelessAddress().candidates`), not the holders the plain read judges." Where a package's row stands beside its own customization pair's row (the objectstack-ai#32662 scope-note (b) state), the plain read serves that package's row, while bare `/layers` answers 409 and now names the pair as `{ kind: 'package' }`; a row the reads decline is named the same way. Not folded and no card, under the p3 standard. - review#2 S4 (read, not measured): "The layered read takes the resolver's judgment and not its answer." For a name that an overridable baseline and one other package both hold (`email_template`, baseline `com.objectstack.service.email`), the plain read serves the other package. With no metadata-service copy, the layered read's code layer is still the artifact lookup's first composite, by registration order. Not introduced by this diff. Not folded and no card, under the p3 standard. - review#2 N2 (pin breadth: candidates compared sorted, `dashboard` only, no bundle member, no dispatcher pin on a boot with no service copy) is recorded as accepted. N3 (body staleness) is fixed in this body. - Declaration re-read after the diff, on the area seat's order: the claim declared `Clause-②: no`; measured, two answers move (the bold rows above), so the PR body and the changeset now declare `Clause-②: no (narrowing)` with the BREAKING banner, the `!` title and the ADR-0087 marker, after the objectstack-ai#33646 precedent. On the composition that wires the engine (the default `RestServer` host) the door already answered 409. No gate reads the claim comment's line (the queue and level gates read this body and the changesets), so the claim comments were not amended. - The in-process readers already handle the refusal: the packaged-permission-set lock gate and the security catalog echo catch a 409 naming package candidates and read each holder at its package (ADR-0150 D4, objectstack-ai#31698). - `git merge-tree --write-tree --name-only` of this head against the open PRs sharing a file and `origin/main`: objectstack-ai#33898 (`64c5d88452`, shares `protocol.ts` and `meta-qualified-item-read.test.ts`), objectstack-ai#33889 (`bdb3a20a71`, shares `meta-disabled-holder-served-stack.test.ts`) and `origin/main` (`895783a1e8`) each exit 0, no conflicted path. objectstack-ai#33898's `protocol.ts` hunks sit near lines 322 and 7089; the docblock here is near line 4205. ## Verification <details><summary>REST /published FROM and TO (review-b F1), measured at e516f35</summary> 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. </details> <details><summary>REST /published with a package-unbound active row (review#2 S3), measured at 9dd398c</summary> 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. </details> <details><summary>Dogfood battery, on fa7fb66</summary> 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. </details> <details><summary>Packages, on head 6e50dbd (before merging main) and on 02d6109 (after it)</summary> 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). </details> <details><summary>Gates</summary> 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 objectstack-ai#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 objectstack-ai#33898 is merged; objectstack-ai#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 objectstack-ai#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 objectstack-ai#34104 (`e9fb09871d`), the fix for those run-date timeouts (p0 objectstack-ai#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. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steedos · project thread
Fixes #33456 — this PR lands the envelope half (premise 2). Premise 1 (the holder's own route) was measured on a real composed boot after this PR opened (showcase dev boot, main
63e47feeca, four cells over HTTP; os-dev-report on the card) and does not reach: a package-less row over a managed package's name is refused at save (403NOT_OVERRIDABLE) or sealed and unserved at boot (metadata_sealed_overlay_unserved, ADR-0131 D6); over a runtime-authored package the engine registry lists the row and the holder's route judges the holder's declaration; and a package-less save of a name one writable package holds is re-addressed into it. The shape only the #32681 harness composes needs no runtime change, so the card closes with this PR (area ruling, option C).Clause-②: no
Metadata-protocol: none
维护者速读
GET /meta/action/NAME、执行面getMetaItemForExecution、以及/actions路由判出的声明)时,包的工件信封(_packageId、_provenance: 'package')只嫁接到该包在同一(对象, 名字)上持有的那一项;环境自己绑在别的对象(或无对象)上的同名 action 按环境自己的项返回,不再挂别人的包名。(package, object, name);原来按名字找信封,ALPHA 绑account时,环境绑contact的同名行被当成 ALPHA 的包内项返回(卡 metadata-protocol: an action's route beside a package-less row on another object judges no declaration for the holder's own object, and serves the row under the holder's envelope (ADR-0150 D4) #33456 前提 2,本 PR 在 main 上复测成立)。metadata-protocol读路径的信封嫁接,不改存储、不改路由、不改 spec;同对象的定制、两包同对象的 409、只有一个包的情形均不变(CONTROL 钉住);回滚 = revert 本 PR。packages/metadata-protocol/src/protocol-artifact-lookup.ts的lookupArtifactItem(风险 hunk:无包时按packageScopedHoldersOf找唯一同对象持有者);protocol-meta-item-reads.ts的artifactOwnerKeyOf与信封调用点。pnpm --filter @objectstack/rest exec vitest run src/meta-qualified-item-route.test.ts -t 33456,预期 6 个用例全绿。What changes
ADR-0150 D4 keys an action by
(package, object, name). The by-name read looked the served item's artifact envelope up by name (lookupArtifactItem, which answers the first composite holding the name), so the environment's own action bound to an object no package binds the name to was served wearing the one holder's_packageId,_packageVersionand_provenance: 'package'.lookupArtifactItem(seam body inprotocol-artifact-lookup.ts; the private class wrapper inprotocol.tsthreads one more argument) takes an action's owner key. Given, it answers only an artifact bound to that object (or object-less forundefined); naming no package, the ONE package whose own artifact is bound there (packageScopedHoldersOf, disabled holders included, as the old composite scan was), none for zero or two. Omitted, or for any other type, it is the by-name lookup it was (lookupArtifactItemByName, unedited).readMetaItem(both faces) passes the served item's owner key at its envelope graft, on the plain and the exact-address branch (artifactOwnerKeyOf).Every moved answer, FROM → TO (ALPHA, BETA two packages;
approvethe action name; the environment's item is a package-less row the store holds active):account, the environment's row oncontact(mirror), both save ordersGET /meta/action/approve(RestServer and dispatcher),getMetaItemForExecution, the declaration/actions/contact/approvejudges_packageIdALPHA,_provenance: 'package'contactalone, the environment's row onaccount(single-holder cell), both save orders/actions/account/approveaccount, the environment's row object-lessGET /meta/action/approve(both transports)Clause-② arm per row: none. Re-read against ADR-0150 D4 after the diff: each row stops stamping a package onto an item that package does not hold at its
(object, name)("A bucket-4 item is therefore one whose(type, name)no package holds", read with D4's action key(package, objectName, name)); no answer admits anything new and no accepted input is refused, soClause-②: noholds as claimed.Not changed (CONTROLs pinned): the package-less row on the object the package binds (its customization, under that package's envelope); two packages on one object (409 naming both); one package and no package-less row (its item, its envelope);
?package=HOLDER(the holder's own item and envelope); the route'spackageId(unset) and the handler that runs (ran env); every type other thanaction; stored rows.Tests
packages/metadata-protocol/src/protocol-artifact-lookup.action-owner-key.test.ts(new, 8 cases): the seam over a registry double: mirror, single-holder cell, the one holder on the item's object among two, object-less both ways, a named package on another object; CONTROLs.packages/rest/src/meta-qualified-item-route.test.tsandpackages/runtime/src/domains/meta-qualified-item-read.test.ts, describe#33456(6 cases each, realSchemaRegistry+ real protocol): both transports ofGET /meta/action/approve, three shapes × both registration orders,?package=holder control, and the three CONTROLs.packages/runtime/src/action-package-addressing.test.ts, inside the[#32681]describe (6 cases: real ObjectQL, realMetadataPluginboot pass,DatabaseLoaderover a writablesys_metadatadouble): mirror and single-holder cell × both save orders on the execution face, the served face and the row's route (declaration envelope,packageId, handler run), plus the same-object CONTROL in both orders.packages/metadata-protocol/src/protocol.lookup-artifact-item-call-sites.test.ts: the four changed sites recorded with their dispositions.Ablation readings
Seam (source-resolved suite): the owner-key rule removed (
ablation-replace.mjs, anchorif (owner === undefined || singular !== 'action') return artifact;→… || true) …): 5 negative pins red, 3 CONTROLs green; restored, blob equals HEAD (288b99c4f897),git diff HEADempty.Transports and route (they read
metadata-protocol'sdist/): the same rule removed with a bundler-surviving marker (|| name !== '__ablation_33456__'), rebuilt,ablation-dist-preflight.mjsmarker present in 2 built files: REST 3 red / 3 green, dispatcher + route 7 red / 5 green (every negative pin red, every CONTROL green); restored, rebuilt, preflight--absentexit 0, tree clean. A first dist attempt with the|| truespelling was folded away by the bundler (preflight: marker absent), so its readings were discarded and the run repeated with the marker above.BASE reading (main
1e65a389e1, runtime #32681 harness, mirror shape): execution face, served face and the row's route declaration all["custom","contact","com.acme.alpha","package"]; after:["custom","contact",null,null]; holder's exact read["alpha","account","com.acme.alpha","package"]both.Acceptance notes
/actions/account/approve(mirror) and/actions/contact/approve(cell) judge no declaration, before and after this PR. No real boot builds that host: measured on the showcase dev boot (main63e47feeca), a managed package's name refuses a package-less save (403NOT_OVERRIDABLE) or leaves an earlier row sealed and unserved after an upgrade (boot diagnosticmetadata_sealed_overlay_unserved); a runtime-authored package's name keeps the row in the engine registry (Registered action:bare slot beside the overlay slot, on save and at boot), where the holder's route judges the holder's declaration and the row's route the environment's item; a package-less save of a name one writable package holds is re-addressed into that package. No change topackages/runtime/src/action-execution.tsis made.getMetaItems({ type: 'action' })) in the same harness lists only the holder's item, not the environment's row on the other object (measured before and after;protocol-meta-list-reads.tsis not touched here). Reported to the seat.Verification
Head
64c5d88452(origin/main1e65a389e1+ this branch, merged with main4b5024de52).Typecheck and tests (touched packages and the dependents whose suites drive the read)
pnpm --filter @objectstack/metadata-protocol typecheckexit 0;exec vitest run: Test Files 342 passed, 9 skipped; Tests 22901 passed, 43 skipped.pnpm --filter @objectstack/rest typecheckexit 0;exec vitest run: Test Files 417 passed; Tests 8748 passed, 355 skipped.pnpm --filter @objectstack/runtime typecheckexit 0 (after building@objectstack/driver-turso, which the merge's closure build had not, and whose missingdistalone failed two untouched test files' imports);exec vitest run: Test Files 607 passed; Tests 12273 passed, 19 skipped.pnpm --filter @objectstack/objectql exec vitest run: Test Files 597 passed; Tests 13141 passed.eslint --no-inline-configover the eight touched files: exit 0.metadata-protocol(cli, client, cloud-connection, plugin-approvals, plugin-email, plugin-security, service-automation, service-messaging, service-package) are declared to CI: the published.d.tsis byte-unchanged (private lookupArtifactItem;, no new export).Derived gate families
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon this head: 73 families, each run with its exit captured before any pipe;--ranreconciliation: 73 derived, 71 run, 2 NOT MEASURED, 0 UNRUN.pnpm check:dual-build-cjs-loads(exit 3, PREREQUISITE NOT MET: reads every package'sdist/, this worktree built the runtime closure only);pnpm check:type-check-debt(exit 3: its--re-measureclosure build never got a turn on the shared verify lock). Both are CI's.check-closing-keyword-parity(event payload and--body) exit 0,check-partof-closing-keywordexit 0,check-changeset-no-majorexit 0,check-adr-0087-registrationexit 0.Generated by Claude Code
🤖 Generated with Claude Code