Repository navigation
fix(mcp,runtime): get_record_context reads a package's context packs on both MCP doors - #37255
Conversation
…hored packs The protocol's served ai_context listing stamps every item with the read path's _diagnostics; the executor parses each row with the closed AiContextSchema, so every pack was dropped and get_record_context answered RESOURCE_NOT_FOUND on the HTTP and stdio doors alike. Both doors now pass their listing through stripReadDecorations (METADATA_READ_DECORATIONS), which keeps the ADR-0010 protection envelope the schema declares. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…xt pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…d on both record-context doors Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
… protocol Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
… packs Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…t the frozen memory driver Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
📓 Docs Drift CheckThis PR changes 3 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 37 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 935f9dc055eb783623e3bd7f2315753071bca5c0 && git checkout 935f9dc055eb783623e3bd7f2315753071bca5c0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9171bed0a65ab242567f243969368ead786cd830 1176335e4863e31f3446cbe8b06f79e1f0344bbf && git checkout -B drift-repro 9171bed0a65ab242567f243969368ead786cd830 && git merge --no-ff 1176335e4863e31f3446cbe8b06f79e1f0344bbf
node scripts/docs-audit/affected-docs.mjs --json 9171bed0a65ab242567f243969368ead786cd830
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 083ab1b · 2026-11-25T08:45ZL1: REWORK (L1-w, zone ai-A) There is one should-fix, which is a changeset push. The code is right. This is Tier S: no governed path, 249 changed lines on this card's only PR. No L2 is owed:
Should-fix
Read and found right (head 083ab1b)
Path to ACCEPT
|
…ips in its types Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head 1176335 · 2026-11-25T09:12ZL1: ACCEPT (L1-w, delta read, zone ai-A) No must-fix and no should-fix. No L2 is owed: nothing under Delta
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK Landing · 2026-11-25T09:14Z · ACCEPT 7158044850 at head 1176335 (no L2 owed: no
State: ready + auto-merge (Tier S). On MERGED, #37243 closes by |
…xt pack is identified by its package and its name; get_record_context selects a pack by its face on both MCP doors (objectstack-ai#37291) repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Fixes objectstack-ai#37216 Clause-②: yes (narrowing) Metadata-protocol: narrowed Skills-docs: follow-up objectstack-ai#37177 ## 维护者速读 - 用户能看到什么变化:两个应用各自带了同名的资料包时,外部 AI 通过 MCP 读取记录资料能按“应用+名字”分别选到各自的包;只给名字且有两个应用都带这个名字时,会被明确拒绝并列出每个可选的写法。 - 为什么做:属于“在一条记录上问 AI”专题,落实已合并的资料包身份裁决(资料包按应用+名字认),也为后续“技能指定资料包”那张卡扫清前提。 - 出错会怎样:只影响资料包的选取与同名校验;第一方应用里没有任何同名资料包,现有部署读到的结果不变,可直接撤回。 - 要你做什么:这是收窄改动,请你批准;批准后由席位合入。契约审核通过记录是 PR comment 7168612536,Head-sha `7408543965b4dbbc8e51cf8033e51106d2e2f79d`。 ## What changes ADR-0150's addendum (PR objectstack-ai#37209, merged by the maintainer) puts the context pack in bucket 3 beside `skill`: a pack is identified by its package and its name. - **The four lists.** `ai_context` joins `PACKAGE_SCOPED_TYPES` (`packages/core/src/package-scoped-resolution.ts`, the one ADR-0150 D3 rule), `PACKAGE_SCOPED_READ_TYPES` (`packages/objectql/src/package-scoped-read.ts`, the `/meta` by-name read and its `?package=` qualifier), `PACKAGE_SLOTTED_METADATA_TYPES` (`packages/spec/src/api/protocol.zod.ts`, the metadata service's per-`(package, name)` slot; uninstall drops one package's pack and keeps another's) and `NAMESPACE_UNIQUE_TYPES` (`packages/objectql/src/namespace-co-owner-names.ts`, D2's refusal of a second holder inside one namespace, at install and in `os validate`). - **Reader 1, pack selection** (`packages/services/service-record-context/src/read-set.ts`). Candidates are still the packs rooted on `objectName`. `context` is read as a skill prompt's name is: a face (`NS-NAME`, `deriveAiFaceName`) answers its one pack; a bare name resolves by D3 as a caller with no package (the environment's pack, else the one package holder, else `409 RESOURCE_CONFLICT` naming each candidate by its face). `RecordContextDoor` gains an optional `packageNamespace(packageId)`; the tool description teaches `NAMESPACE-NAME`. - **Both MCP doors place a pack's package.** The `/mcp` route (`packages/runtime/src/domains/mcp.ts`) implements `packageNamespace` through `packageNamespaceOf`, on the engine resolved beside the `listContextPacks` read, as `listSkills` does. The stdio bridge (`packages/mcp/src/stdio-data-bridge.ts`) implements it from its `engine`'s registry (the `objectql` service, the same record `installedPackageNamespace` reads for skill prompts). Both sit on top of objectstack-ai#37255's `stripReadDecorations` listing, unchanged. - **The several-packs answer** (triage row 7154571964, ADR-0160 D4 step 3 as amended by objectstack-ai#37196): each pack is listed by its face with its label, in en and zh-Hans; a pack with a blank label is listed by its face alone. - **The overlay consequence** (card What 4, ADR-0150 D4 as ruled for `skill`): a package-less `ai_context` row under a name a package ships is that holder's customization and is not served, read at `(type, name)` whatever the row's root. Measured by a §5 pin with a control in `packages/metadata-protocol/src/protocol.reads-environment-only.test.ts`. - **ADR-0087 semantic entry** `packages/spec/src/migrations/entries/semantic/18.ai-context-package-scoped-name.ts`, registered by the changeset's `registered ai-context-package-scoped-name` marker. **Narrowings, each measured on first-party trees** (objectstack at `d7f299c0`, re-read at this head; hotcrm at `9b735103`): the one declarer of packs, `examples/app-showcase` (`src/ai/record-context.ai-context.ts`), ships two packs of different names (`showcase_project_brief`, `showcase_task_notes`) in one package; hotcrm declares none. | Narrowing | First-party count | |:---|:---| | A second holder of a pack name inside one namespace: refused at install (`422 NAMESPACE_CONFLICT`) and by `os validate` | 0 | | `GET /api/v1/meta/ai_context/NAME` with no package, for a name two packages hold: first match becomes `409 RESOURCE_CONFLICT` | 0 | | A package-less pack row under a name a package ships: not served (the holder's customization) | 0 | ## Tests - `packages/mcp/src/mcp-record-context-tools.test.ts`: a new top-level `describe` on the stdio bridge whose engine's registry places two packages: each same-name pack reached by its face, alike over MCP-over-HTTP and stdio; the bare name refused `409` naming both faces; a control engine with no registry spells each pack bare, so no face reaches one (`404`). - `packages/runtime/src/mcp-record-context-tools-bridge.test.ts`: in the real-protocol `/mcp` harness, two packages of two namespaces ship `rcd_brief` on one root: each is reached by its face, and the bare name is refused `409` naming both. The door's member pin lists `packageNamespace`. - `packages/services/service-record-context/src/__tests__/record-context-tools.test.ts`: a new top-level `describe` for selection by `(package, name)`: each of two packages' same-name packs reached by its face; the bare name refused `409` naming both faces with nothing read; uninstalling one holder keeps the other; environment pack first under D3; the root narrows before D3 picks; the several answer by face and label in en and zh-Hans, with the blank-label fallback; a door without `packageNamespace`. - `packages/metadata/src/metadata-manager-keyed-plural-read.test.ts`: the pinned slotted set gains `ai_context`, so every plural-read case runs for it. - `packages/metadata/src/loaders/database-loader.test.ts` (objectstack-ai#32521 priming): the two host-file cases spelt the host's file `helper.TYPE.yml`, which the pass never reads for `ai_context` (the registry declares `**/*.ai-context.yml`). They now spell the file from the type's registry pattern. Every assertion is unchanged, and the `ai_context` cases assert the slotted behaviour every other type already had. - objectql and CLI enumeration pins (`registry-namespace-co-owner-names`, `package-scoped-exact-qualifier`, `package-scoped-e8-readers`, `manifest-service-residual-namespace-name`, the CLI's `namespace-co-owner-names`) list `ai_context` where it moved. ## Acceptance notes - **Owed item 3 of the hand-off is folded into this PR.** Both doors' `packageNamespace` (`packages/runtime/src/domains/mcp.ts`, `packages/mcp/src/stdio-data-bridge.ts`) waited for PR objectstack-ai#37255 (objectstack-ai#37243), which edits the same `listContextPacks` regions. It landed after objectstack-ai#37255 merged: `main` was merged in at `057cedfa` (no rebase), and the doors were built on its `stripReadDecorations` listing (commit `1deea31f`). - `record-context-tools.zod.ts`'s `context` describe still says "by name"; the addendum makes it a face or a bare name. Noted for objectstack-ai#37141, which owns that key. - The contract review at CONTRACT_REVIEW_TIER (`packages/spec/src/api/protocol.zod.ts`) is run by the zone, not here. ## Verification <details><summary>Local readings</summary> Each run under `scripts/pm/os-verify-lock.sh`, exit taken from its `VERDICT command-exit` line. Readings taken at `6cb32813` (main merged at `057cedfa`, which carries objectstack-ai#37255). The head is now `74085439`: the two commits since change only the changeset's `Clause-②` line and the semantic entry's `reason` plus the first BREAKING bullet (`422 NAMESPACE_CONFLICT`). The dogfood battery was re-run on `74085439` (see below). The suites the door commits touch were re-run there; the rest were read at `c61fb9f7`, and the merge brought no change to their packages (`packages/spec`, `core`, `objectql`, `metadata`, `metadata-protocol` untouched by it). | Command | Head | Result | |:---|:---|:---| | `pnpm --filter @objectstack/mcp test` | `6cb32813` | 85 files, 1507 tests passed · exit 0 | | `pnpm --filter @objectstack/runtime test` | `6cb32813` | 647 files; 11997 passed, 25 skipped · exit 0 | | `pnpm --filter @objectstack/service-record-context test` | `6cb32813` | 2 files, 82 tests passed · exit 0 | | `typecheck` mcp, runtime | `6cb32813` | exit 0 each | | `pnpm --filter @objectstack/core test` | `c61fb9f7` | 157 files, 3761 tests passed · exit 0 | | `pnpm --filter @objectstack/objectql test` | `c61fb9f7` | 638 files, 14423 tests passed · exit 0 | | `pnpm --filter @objectstack/metadata test` | `c61fb9f7` | 83 files, 2798 tests passed · exit 0 | | `pnpm --filter @objectstack/metadata-protocol test` | `c61fb9f7` | 370 files passed, 9 skipped; 23419 tests passed · exit 0 (§5 pin and its control both ran and passed) | | `pnpm --filter @objectstack/spec exec vitest run src/migrations src/api` | `c61fb9f7` | 69 files, 2339 tests passed · exit 0 | | `pnpm --filter @objectstack/cli exec vitest run --project unit src/utils/namespace-co-owner-names.test.ts` | `c61fb9f7` | 31 tests passed · exit 0 | | `typecheck` service-record-context, metadata, core, objectql, metadata-protocol, spec, cli | `c61fb9f7` | exit 0 each | The objectstack-ai#32521 host-file pins before the fixture fix: 2 failed / 539 passed (the two `ai_context` host-file cases; the pass read no file). After: 541 passed, 23 of them `ai_context` cases. **Ablations** (once each, after committing; restore proven by blob equal to HEAD): deleting the stdio bridge's `packageNamespace` member turns both face cases of the new mcp `describe` red (2 failed, the control passes). Deleting the `/mcp` door's member turns the runtime face case and the member pin red (2 failed). The CLI `integration` layer and `test:repo` were not run locally; CI runs them. </details> <details><summary>Gate sweep (dispatch-gates --commands)</summary> `node scripts/pm/dispatch-gates.mjs --commands` at `6cb32813`: 105 derived commands, each run with its exit code recorded. `--ran`: **105 derived, 105 run, 0 NOT MEASURED** (a derived zero: every line carries its exit code). - 104 exit 0 on the first run. - `pnpm check:type-check-debt`: exit 3 on the first run (lock queue-timeout behind the dogfood run, nothing measured). Re-run under the lock: exit 0. - `check:adr-0087-registration`: `registered ai-context-package-scoped-name (new here: ai-context-package-scoped-name)`. </details> <details><summary>Dogfood battery</summary> Head `74085439` (the current head; the os-dev-report is objectstack-ai#37216 comment 7169906867): the full battery under the lock gave `VERDICT command-exit 0` · Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68 skipped (4196) · no failures. Earlier reading, head `6cb32813`, `pnpm turbo run build --filter='@objectstack/dogfood^...'` (exit 0), then `pnpm --filter @objectstack/dogfood test` under the lock: `VERDICT command-exit 0` · Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68 skipped (4196) · no failures. (Also run at `c61fb9f7`, before the door commits: the same counts.) </details> **Read first:** `packages/services/service-record-context/src/read-set.ts` (`selectContextPack`, the face / D3 order), `packages/spec/src/api/protocol.zod.ts` (the slot list, a contract surface), `packages/mcp/src/stdio-data-bridge.ts` (`installedPackageNamespaceOf`, the stdio door's new member). **Two-minute check:** `pnpm --filter @objectstack/service-record-context exec vitest run src/__tests__/record-context-tools.test.ts` → 65 passed, including "the bare name two packages hold is refused 409, naming both faces". ## Provenance Opened by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「objectstack-ai#37216 开 PR 放行」). The dev session's (`session_01QSeKYohZLmQ1Ug9FKcQtVu`, zone a4-A) own relay `pr_create` was refused by its permission check and not retried; the dev sent the prepared body. The seat changed the dev's `Clause-②: no (narrowing)` to `Clause-②: yes (narrowing)`. A narrowing arm is legal with either value; `yes` is right here because the diff also widens published surface: `?package=` on the history and rollback doors for `ai_context`, a face in `get_record_context`'s `context`, and new `service-record-context` exports. Branch `claude/issue-37216-ai-context-package-scope` @ `74085439`. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ --------- Co-authored-by: Claude <noreply@anthropic.com>
…tes on the /mcp and stdio doors over a real kernel (objectstack-ai#37350) Part of objectstack-ai#37175 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感。这是测试:外接 AI 读取一条记录资料的工具,在网页通道和本地命令行通道上,用真内核、真执行器对同一个人逐字节比对回答。 - 为什么做:属于“在一条记录上问 AI”专题,补上网页通道只测了接线、没用真执行器的缺口。 - 出错会怎样:只增加一组测试,不改任何产品代码;有问题直接撤回即可。 - 要你做什么:无。 ## What changes - **One new top-level `describe` in the shared harness file** `packages/runtime/src/mcp-record-context-tools-bridge.test.ts`: `get_record_context` over one real kernel, asked through both MCP doors for one caller, every answer compared byte for byte (`isError` and the text content), refusals included. - The kernel: a real `ObjectQL` on `SqlDriver` (better-sqlite3), the real `SecurityPlugin` (a permission set with an object refusal, a field-level refusal and a row rule), the real `ObjectStackProtocolImplementation`, and the real `RecordContextServicePlugin` registered as the `record-context` service. Nothing of the metadata plane, the data plane or the executor is a double. - The `/mcp` door: `HttpDispatcher.handleMcp` into the real `MCPServerRuntime`, so the call goes through this package's HTTP data bridge (`packages/runtime/src/domains/mcp.ts`). - The stdio door: the real `MCPServerPlugin`'s long-lived session (`createStdioDataBridge`) over an in-process transport, principal-bound to `OS_MCP_STDIO_API_KEY`. - One caller: the `/mcp` request carries the context `resolveAuthzContext` plus `assembleExecutionContext` build for the same key the stdio session resolves (owner `usr_member`, active in `org_1`). A precondition case checks that the stdio door's root read carried the same `userId`, `tenantId`, `permissions` and `positions`. - **The cases** (card What 2 and 3, and amendment 4): - the record through its package pack: the field-level-hidden field is not carried and is stated by the `not_visible` note; the lookup whose target is `apiEnabled: false` is answered `notVisible: true`, never expanded or named (amendment 4: the door decides an expansion target's API exposure); the related row the caller's row rule refuses is absent; the body is carried whole; - a root the caller may not read: `PERMISSION_DENIED` 403 before any pack is looked up, equal to `get_record`'s answer for the same object and record on both doors; - a related child this caller is not served: today `PERMISSION_DENIED` 403 for the whole call, the child unnamed (see Acceptance notes for the gap to ADR-0160 as amended); - a related child its API exposure refuses: `PERMISSION_DENIED` 403, named; - a related child whose package is disabled (the protocol answers `OBJECT_PACKAGE_DISABLED` for it, checked in the case): `PERMISSION_DENIED` 403, unnamed; - an anchor the body does not resolve: `RESOURCE_NOT_FOUND` 404; - a pack saved at run time through `protocol.saveMetaItem` (served from the metadata registry, not shipped by the stack, no `_packageId`): read on both doors. - **The WIP probe file is removed**: `packages/runtime/src/domains/mcp-record-context-37175.test.ts` (console output, from the resumed backup `0fa37da2`) is deleted. Its rig is now the `describe` above. - No production source changes. `packages/runtime/package.json`, the lockfile and `packages/runtime/vitest.config.ts` are unchanged: PR objectstack-ai#37255 already landed the two devDependencies and the two alias rows this rig needs. ## Tests Final head `9c9d8a634`. - `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/mcp-record-context-tools-bridge.test.ts` under the verify lock: `Tests 15 passed (15)`, VERDICT command-exit 0. Of the 15, 8 are this `describe`'s; the 7 earlier ones are unchanged and still pass. - `pnpm --filter @objectstack/runtime typecheck` (tsc plus `check:test-typecheck` over `tsconfig.test.json`, which compiles this file, counted with `--listFiles`): exit 0, "test layer compiles … 27 file(s) / 183 error(s) … held in test-typecheck-debt.json", the ledger unchanged. - One-off fixture control, not committed: with the permission set's row rule removed, the main case answers rows `["r1","r2"]` and its test goes red. So `r2` is absent because of the row rule, and the case can fail. The file was restored with `git checkout HEAD --`; `git diff HEAD` is empty and the blob hash equals HEAD's. ## Acceptance notes - **Card acceptance.** "For one fixture and one caller, the HTTP bridge and the stdio bridge give byte-identical answers, refusals included": every case goes through one helper that asks both doors and requires `stdio` to equal `http` (`isError` and text). "The registry-served pack is read": the last case. - **Gap to ADR-0160 as amended 2026-11-25 (point 2).** A related child this caller is not served should be "left out and stated, not refused". `executeGetRecordContext` still refuses the whole call (`refuseObject(entry.object, false)`, step 4a). The case pins today's answer and says so in its title. When the executor changes, this case goes red on purpose. Routed by the seat, not fixed here: `packages/services/service-record-context/**` is outside this card's fence. - **Amendment 4, the docblock half is not in this PR.** The amendment asks for a sentence in `packages/services/service-record-context/src/door.ts` (`query`): a door decides each expansion target's API exposure. That file is fenced off for this card, because sibling work is in flight there. The behaviour half is pinned here (the `vault` lookup case). That is why this PR says `Part of`: the sentence is the half left open. - **The WIP's two open readings, measured again on `main` `a182fbe37`:** - (a) The stdio door answered `RECORD_NOT_FOUND` for a row the HTTP door read. Cause: the WIP's key resolved to a caller with no organization, while the row is in `org_1`. It was the rig, not a door defect. With the key active in `org_1` and the same context handed to `/mcp`, both doors read the row. - (b) A private-OWD row owned by another user came back on HTTP. Not a row-security defect. The WIP rig composed no `sharing` service, and the private-OWD read filter is that service's (`resolveSharingReadFilter` in `plugin-security` returns `null` when `resolveKernelService('sharing')` has no `buildReadFilter`). The rig now uses an authored row rule on the permission set. Both doors honour it. - **Placement.** The file is the shared harness file (AGENTS.md: a new pin for a component that already has a shared harness file goes into that file as a top-level `describe`). The claim named `packages/runtime/src/domains/**` for a new file; this is a declared change of surface, and the deleted WIP file under `domains/` is the only change there. - The file's wall time is collection. Shared box: `Duration 18.59s (… import 17.77s, tests 655ms)`. The 8 new cases take under a second. ## Verification <details><summary>Derived gates (dispatch-gates --commands, 50 families) — local</summary> 48 exit 0. Two are NOT MEASURED, each exit 3 PREREQUISITE NOT MET, so they belong to CI: `node scripts/check-plugin-teardown-shape.mjs --self-test` (its positive control is pinned to a commit this shallow clone does not hold) and `pnpm check:dual-build-cjs-loads` (it needs every package built). `dispatch-gates --ran` with recorded exit codes: "50 derived famil(ies) accounted for — 48 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)". `node scripts/pm/overlap-check.mjs --branch=HEAD`: VERDICT clean exit 0 before each push. </details> **Read first** (by risk): `packages/runtime/src/mcp-record-context-tools-bridge.test.ts`, the last `describe`. The risky hunk is the `keyedQl` proxy, which stands in for the key's auth tables, and the `caller` assembly beside it. **Two-minute check:** `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/mcp-record-context-tools-bridge.test.ts` should print `Tests 15 passed (15)`. Not run locally (declared): the runtime package's full `pnpm test` (653 files). The diff is this one test file, and CI's `Test Core` runs the suite. No changeset: the diff is a test file under `src/`, and `packages/runtime` publishes `dist`, `README.md` and `CHANGELOG.md` only, with tests excluded from its build tsconfig, so `skip-changeset`. repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK
Fixes #37243
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/runtime/src/domains/mcp.ts,listContextPacksin the bridge's record-context members) and the stdio door (packages/mcp/src/stdio-data-bridge.ts,listContextPacks) read the protocol's servedai_contextlisting, whichdecorateMetadataItemstamps with_diagnostics; the executor's closedAiContextSchemaparse (parsedContextPacks) dropped every row. Each door now maps its listing throughstripReadDecorations(@objectstack/spec/kernel), the metadata-fallback branch included.METADATA_READ_DECORATIONS(_diagnostics,_draft,_withheldFields,_relatedListsArrangement), the read path's derived keys that are no part of a document. The ADR-0010 protection envelope (_packageId,_packageVersion,_provenance,_lock,_lockReason,_lockSource) stays:AiContextSchemadeclares it throughMetadataProtectionFields, so it parses, and the pin asserts the served pack still carries_packageId. A blanket underscore strip would remove declared keys; stripping only_diagnosticswould leave the next listed decoration to fail the same way.spec/kernel/metadata-read-decorations.ts, whose module docblock names this exact failure class ("any re-parse of a served document"). Both doors already depend on@objectstack/spec, so neither takes a new runtime dependency, and the protocol's served read (with its per-type redaction) is still the one a door reads —getMetaItemsForExecutionwould have dropped the_diagnosticstoo, but its docblock forbids reading it from a door that answers a caller.RecordContextDoor.listContextPacks(packages/services/service-record-context/src/door.ts). The executor's strict parse is unchanged.Tests
packages/mcp/src/mcp-record-context-tools.test.ts: new top-leveldescribe— a realObjectStackProtocolImplementationover a realObjectQL(an in-memory SQLiteSqlDriverstore) with a package carrying the pack; the metadata service lists no pack, so the protocol's listing is the only one. Precondition asserts the served pack carries_packageIdand_diagnostics; thenget_record_contextanswers through the pack, identically on MCP-over-HTTP and stdio.packages/runtime/src/mcp-record-context-tools-bridge.test.ts: new top-leveldescribe— the/mcproute end to end (HttpDispatcher.handleMcp, the realMCPServerRuntime, the real executor,SecurityPlugin, the real protocol overObjectQL+SqlDriver); same precondition, then the call answers the pack's fields.git diff HEADempty and blob == HEAD): removing the strip at either door turns its pin red with the defect's own answer,RESOURCE_NOT_FOUND"No context pack named … reads object …".@objectstack/mcpgains devDeps@objectstack/metadata-protocoland@objectstack/driver-sql;@objectstack/runtimegains devDeps@objectstack/mcpand@objectstack/service-record-context; each new value import has an anchored source alias row in that package'svitest.config.ts(check:test-source-alias).Acceptance notes
service-analytics' dataset executor strips decorations inside the executor; this card's ruling puts the strip at the doors and keepsAiContextSchema's consumer strict. Noted, not changed.metadata-protocolsource through the new alias. These readings come from single-file runs. A full-package run shares the transform cost across files.Verification
Local readings (final head in the report)
See the report comment on #37243 for the exact commands, exit codes and the head sha they were read on.
Read first:
packages/mcp/src/stdio-data-bridge.ts(listContextPacks, the strip on both branches),packages/runtime/src/domains/mcp.ts(same),packages/mcp/src/mcp-record-context-tools.test.ts(the precondition that makes the pin non-vacuous).Two-minute check:
pnpm --filter @objectstack/mcp exec vitest run src/mcp-record-context-tools.test.ts→ 11 passed; delete.map(stripReadDecorations)from the stdiolistContextPacksand the last case fails withRESOURCE_NOT_FOUND.Generated by Claude Code