Skip to content

feat(mcp): state the authoring contract version and refuse a client on another spec major - #35838

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/area-a4C-34774
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/area-a4C-34774

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Part of #34774
Clause-②: yes — widening: a new optional tool input and one new instructions line; the major refusal applies only to a client that sends the new input, so nothing a client could send before is refused.
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用 AI 客户端连接自托管服务器并写草稿的开发者,会在连接说明里看到服务器所用的规范版本;客户端声明的规范大版本不同时,保存草稿会被拒绝,并给出要运行的安装命令。本次只落地版本说明这一行和大版本拒绝,命令行校验工具读取限制档案的匿名路由拆出,等待单独裁决。
  • 为什么做:属于「MCP 二期与问数」专题的草稿入口一线,解决客户端按另一版规则编写、服务器按本版执行而无声失败的问题。
  • 出错会怎样:只影响主动声明版本的客户端,不声明版本的请求与原来逐字节相同;不新增任何匿名可访问的地址;出问题可直接撤回本次合并。
  • 要你做什么:无(拆出的匿名路由另有决策卡等你裁决)。

What changes

Two faces, so the seat's contract read can find each one:

  1. Instructions line (packages/mcp/src/mcp-server-runtime.ts). Where a connection lists authoring tools, the open server's default initialize instructions carry Authoring contract: @objectstack/spec VERSION. as their second paragraph. VERSION is the @objectstack/spec this process resolves, read from its package.json. The draft-save check reads the same file, so both faces state one value. The line is sent only where the authoring family registers tools, as the existing drafts line is. The existing pin for a connection with no build door says its default text must promise no building. The line therefore did not join that text, and that pin is unchanged. A host text or a configured text is left whole, as before.
    • Measured: the longest default text, with every conditional paragraph on, is 2,604 characters (2,557 before this line). The bound is 4,096. A test asserts the bound on that composition.
  2. Tool input (packages/runtime/src/domains/mcp-authoring.ts). save_metadata_draft takes an optional clientSpecVersion, a SemVer string, and its input-schema description tells a client to send it.
    • Another MAJOR: refused VALIDATION_ERROR 400 before any write. The message names both versions and the command to run, npm i -D @objectstack/spec@SERVER_VERSION. No existing install-line wording for the spec package was found in packages/**.
    • Another MINOR: saved as usual, and the answer gains specVersionAdvisory with the same command.
    • Not SemVer: refused VALIDATION_ERROR 400, naming the expected form.
    • Absent, or the same major and minor: unchanged, byte for byte.
    • The item's own validation on the save stays the final gate.

packages/rest has no diff against the merge base 7878cf0 (git diff 7878cf05 HEAD -- packages/rest is empty).

Scope-out: face 3 (the anonymous restriction-profile route, card Done-when part 2) is split to decision card #35848 (ADR-0138 D2 amendment, seat contract review 7038862149 F1); code parked on claude/area-a4C-34774-route @ c7890e5

Round 3: commit a8e9136 removes face 3 (the route, its REST_ROUTE_LEDGER row, the mount-table pin's third discovery route back to 2, the conformance cases), drops @objectstack/rest and the route paragraph from the changeset, and rewords two comments that named the route. Faces 1 and 2 are unchanged in code. No history rewrite.

Clause-② reading

Question: on main, does the dispatcher enforce additionalProperties: false on the save_metadata_draft parameters, or only advertise it? If it only advertised it, an unknown clientSpecVersion key would pass today, and a major refusal would be a narrowing.

Finding: it is enforced at dispatch, so this change is a pure widening.

  • toolInputSchema in mcp-server-runtime.ts converts a definition's JSON Schema with z.fromJSONSchema. My diff leaves that code as it is on main 7878cf0.
    • Probe: for { type: 'object', properties: {…}, required: [...], additionalProperties: false } the result is a ZodObject.
    • Its safeParse of { type: 'object', clientSpecVersion: '17.0.0' } answers unrecognized_keys: ["clientSpecVersion"].
  • The SDK validates a call's arguments against that schema before the handler runs. The existing test mcp-tool-bridge-input-schema.test.ts pins this ("CONSEQUENCE: the SDK rejects arguments that do not match the declared schema").
  • New pin in the mcp-server-runtime.authoring-scope.test.ts suite ("a closed authoring tool input refuses an undeclared key before the registry is called"):
    • Through handleHttpRequest, with save_metadata_draft's pre-change parameters, a tools/call carrying clientSpecVersion is refused. The refusal names the key, and the authoring registry receives 0 calls.
    • Control: the same call without the key reaches the registry with its input whole.
  • So no request main accepts can be refused after this change: a request that carried clientSpecVersion was already refused at the schema.
  • Request without clientSpecVersion is unchanged, pinned in mcp-authoring.test.ts ("a save without it, or with the same major and minor, answers byte for byte as before"):
    • The answer's keys are exactly saved, verdict, review.
    • The answer string equals that of a same-major-and-minor save.
    • The protocol writes are identical.
    • The existing toEqual pin on the save's exact body and saveMetaItem arguments also passes unedited.

Seat ruling (repo:objectstack#4, 2026-11-20, option A): the Authoring contract line goes only to connections that serve the authoring tools; pin #32766 (a connection with no build door hears nothing about building or authoring) stays unedited. How a client that builds offline reads the server's version (the restriction profile) is split out with face 3 to decision card #35848; this PR serves no such route. With the measurement above, the seat records this PR as a pure widening.

Tests

  • packages/mcp/src/initialize-selection-rule-34686.test.ts, new describe:
    • The line is the second paragraph under metadata:write, with or without data:read.
    • It is absent for an API key, for data:read with a registry, and for an empty registry.
    • The longest default text is under 4,096 characters. As an anti-vacuity check, every conditional paragraph is asserted present.
  • packages/mcp/src/mcp-server-runtime.authoring-scope.test.ts: the Clause-② pin above. Pin edited in place: the helper withoutDraftsParagraph now also strips the contract paragraph, and the "default plus the paragraphs its tools earn" case asserts both paragraphs. Old answer: one paragraph is added. New answer: two are added, the drafts line and the contract line, by this card.
  • packages/runtime/src/domains/mcp-authoring.test.ts, new describe:
    • Optional input, unchanged answer.
    • Done when: previous and next major refused with the command, nothing written.
    • Minor saved and advised.
    • Five malformed values refused.

Verification

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --project local src/domains/mcp-authoring.test.ts. Expect the clientSpecVersion describe green, including the case where another major is refused with npm i -D @objectstack/spec@ and nothing is written.

Read first, by risk:

  1. packages/runtime/src/domains/mcp-authoring.ts: clientSpecVersionVerdict and its call in the save_metadata_draft case. This is the refusal before any write.
  2. packages/mcp/src/mcp-server-runtime.ts: AUTHORING_CONTRACT_LINE and its gate in openServerInstructions.
Local test and gate readings (head a8e9136)
  • Dependency closure build (pnpm --filter '@objectstack/mcp^...' --filter '@objectstack/runtime^...' run build): VERDICT command-exit 0.
  • pnpm --filter @objectstack/mcp test: Test Files 80 passed (80), Tests 1446 passed (1446), VERDICT command-exit 0.
  • pnpm --filter @objectstack/runtime test (the local project, the package's own test script): Test Files 633 passed (633), Tests 11684 passed, 25 skipped (11709), VERDICT command-exit 0.
  • typecheck for @objectstack/mcp and @objectstack/runtime: VERDICT command-exit 0 (tsc --noEmit plus check:test-typecheck).
  • @objectstack/rest suite: not run this round, because packages/rest has no diff against the merge base.
  • Derived gate list (dispatch-gates.mjs --commands, 69 commands): 67 exit 0; 2 NOT MEASURED, both exit 3 (prerequisite not met): check-plugin-teardown-shape.mjs --self-test (its positive control is a pinned commit this shallow clone cannot reach) and check:dual-build-cjs-loads (it reads dist/ of packages outside this closure). CI runs both. --ran reconciliation: 69 derived, 67 run, 2 NOT-MEASURED (derived from recorded exit 3), 0 UNRUN.
  • overlap-check --branch=claude/area-a4C-34774: VERDICT clean exit 0.
  • Ablation, once, at head e8b37b4 (the major refusal; face 2 code is unchanged since): if (clientMajor !== serverMajor) was changed to if (false && …) through scripts/ablation-replace.mjs (the anchor went from 1 hit to 0, and the blob changed). The "done when" case went red (1 failed / 3 passed). The file was restored to the HEAD blob f0d6ca7, and git diff HEAD was empty.

Acceptance notes

Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz

🤖 Generated with Claude Code

…ion, serve the restriction profile

- initialize: where a connection lists authoring tools, the open server's
  default instructions carry "Authoring contract: @objectstack/spec <version>"
  as their second paragraph, read off the spec package the process resolves.
  The longest default text measures 2,604 characters (bound: under 4,096).
- save_metadata_draft: optional clientSpecVersion. Another major is refused
  VALIDATION_ERROR 400 before anything is written, naming both versions and
  `npm i -D @objectstack/spec@<server version>`; another minor is saved with
  a specVersionAdvisory; a non-SemVer value is refused as an input error; no
  value, or the same major and minor, answers exactly as before.
- GET {basePath}/discovery/restriction-profile: the route the CLI's
  `os validate --target <url>` reads, answering { success: true, data } with
  a RestrictionProfileSchema value that restricts nothing and names the spec
  and skills versions the runtime runs. One REST route ledger row.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@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 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

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

Coarse fallback — 37 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 e1143241de6256fcb825da88bc096c12f31b56a8 → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

…ute too

`api.enableDiscovery` off removes three routes, not two: the
GET {basePath}/discovery/restriction-profile route this branch adds is
registered with the discovery routes, under the same switch. The mount-table
pin is edited in place (2 routes -> 3).

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Final green head: c7890e5b8529042294502f557a787442c4efaea6 · 2026-11-20T11:36Z

  • CI: 38 success, 18 skipped, 0 failed; the one cancelled PR-body guards run (136252432585) was superseded by its re-run on this head, success (136252759650).
  • Round 2 fixed Test Core (5/10): the mount-table pin api.enableDiscovery off now removes 3 routes (adds GET /api/v1/discovery/restriction-profile), edited in place; full @objectstack/rest suite green locally.
  • Sent to L1-a for review on this head; then the seat's xhigh contract read (Clause-② yes, measured pure widening; seat ruling A recorded in the body).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1eW7iLBvc8c6xv9Fx

L1 verdict (L1-a): ACCEPT at head c7890e5b8529042294502f557a787442c4efaea6 (Fixes #34774: the open MCP server states its authoring contract version, judges clientSpecVersion, and serves the restriction profile).

Gates on this head:

  • l1-face --pr 35838 flags one item, all-checks, for a cancelled PR-body guards (claim · duplicate · Part-of · single-writer path) run (id 136252432585, started 11:12:41Z). The same name re-ran on this head and succeeded (id 136252759650, started 11:13:21Z), so the cancelled run is superseded. Net: 38 success, 18 expected skip, 0 failed, 0 pending.
  • Every other item is ok: draft, base main, first line Fixes #34774, no closing keyword binds another card. The changeset covers @objectstack/mcp, @objectstack/rest and @objectstack/runtime. Declarations are Clause-②: yes / Metadata-protocol: none.
  • Lint & Repo Gates and TypeScript Type Check both success. Dogfood battery not owed.

What I checked (holds):

  • The card is delivered whole.
    • Done when, part 1: "a client declaring the previous major is refused with the command to run". Pinned, with nothing written.
    • Done when, part 2: "os validate --target against a self-hosted runtime reads a profile". The CLI reader (packages/cli/src/utils/restriction-profile.ts) fetches RESTRICTION_PROFILE_ROUTE with no credential. It wants the { success, data } envelope and runs RestrictionProfileSchema.safeParse(data). The new route answers exactly that, and the conformance case parses it on both mounts. The real-boot reading in the body was taken at e8b37b4d. Round 2 (c7890e5b) touched only rest-config-mount-table.pin.test.ts, so that reading carries over.
    • Scope "initialize instructions and discovery state the contract": met under seat ruling A. The line goes to authoring connections, and an offline client reads versions.spec from /discovery/restriction-profile.
  • Clause-② reading: pure widening, holds.
    • The new pin drives save_metadata_draft's pre-change parameters through handleHttpRequest. A call carrying clientSpecVersion is refused, the refusal names the key, and the registry gets 0 calls. Its control (no key) reaches the registry whole. So no request main accepted can be refused now.
    • I looked for another door to the same effect. createOpenAuthoringRegistry has one caller, resolveOpenAuthoringInjection, which is the HTTP MCP injection. No other door reaches the save without that schema.
  • Seat ruling A. openServerInstructions adds AUTHORING_CONTRACT_LINE only under authoringServed, right after DEFAULT_HTTP_INSTRUCTIONS, so it is the second paragraph. The mcp: give a host a per-request instructions seam for grants that do not admit the authoring family, and say on the data-only surfaces (default instructions, SKILL.md, Connect page) that building needs an OAuth metadata:write connection #32766 describe has no edit in the diff. The only edits to the authoring-scope test are the strip helper, now with two paragraph starts, and the "default plus the paragraphs its tools earn" case, which asserts both.
  • The major refusal. clientSpecVersionVerdict behaves as follows:
    • Absent: answers {}.
    • Not a string, or not matching the anchored SEMVER_2_0_0_VERSION_PATTERN: refused.
    • Another major: refused with npm i -D @objectstack/spec@<server>.
    • Same major, other minor: advisory.
    • Same major and minor: {}.
    • It runs after the existing input checks and before typeAdmission('PUT') and the save. Tests pin { code: 'VALIDATION_ERROR', status: 400 } for the major and malformed cases (ADR-0112). The byte-for-byte case pins the answer string and the protocol writes against a same-major-and-minor save.
  • The route. It is registered inside registerDiscoveryEndpoints beside /discovery, with no enforceAuth. It refuses every query parameter. It answers 503 SERVICE_UNAVAILABLE when the manifest is unreadable. It has one ledger row, server-only, under amendment 7035926523. versions.skills = versions.spec is backed by .changeset/config.json: @objectstack/spec and @objectstack/skills sit in one fixed group.
  • Length. A test bounds the composed default text under 4,096 characters, with every conditional paragraph asserted present (anti-vacuity).
  • Changeset, sentence by sentence (.changeset/34774-authoring-contract-version.md, three packages at patch):
    • Bullet 1 (the line, second paragraph, host or configured text unchanged, under 4,096) holds. Host or configured text bypasses openServerInstructions.
    • Bullet 2 (optional input, major refused with both versions and the command, minor saved with specVersionAdvisory, non-SemVer an input error, unchanged without it, item validation still final) holds against clientSpecVersionVerdict and the three answer(...) sites.
    • Bullet 3 (route served by @objectstack/rest, { success: true, data }, restricts nothing, versions name what it runs, os validate --target reads a profile instead of a 404) holds.
  • Tests I ran on c7890e5 (after pnpm turbo run build for the runtime and mcp dependency closures, 37/37 tasks, exit 0):
    • mcp initialize-selection-rule-34686 + mcp-server-runtime.authoring-scope: 46/46.
    • rest discovery-schema-conformance + rest-config-mount-table.pin + rest-route-ledger.conformance: 54/54.
    • runtime domains/mcp-authoring.test.ts: 41/41.
  • Positive controls (each restored with git checkout --, then git status empty):

Non-blocking notes:

  1. api.enableDiscovery: false also hides the profile. os validate --target against such a runtime still meets a 404. The mount-table pin records this on purpose, and it fits "a discovery route". Mentioned so the contract read sees it.
  2. An unreadable server manifest. When the server cannot read its own spec version, any well-formed clientSpecVersion is saved with an advisory saying it was not compared. The instructions line is absent and the route answers 503 in that state. The changeset does not mention this case. It is a corner case, consistent across the three faces.
  3. A prerelease client on the same major and minor (e.g. 18.6.0-next.1 against 18.6.0) is silent. That matches the card's major/minor rule.

NOT MEASURED: the stdio server's default text, out of scope and carried by p3 #35841. The full rest, mcp and runtime suites: I ran the targeted files above, and CI Test Core is green on this head.

Landing: not governed. Clause-② widening. The seat's xhigh contract read follows, then a4-C lands.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF
Served-tier: TIER_DEFAULT

Contract review — FAIL at c7890e5

Head-sha: c7890e5b8529042294502f557a787442c4efaea6
Local-runs: none
Read: 2026-11-20T11:52Z

Face: the Clause-②: yes declaration alone. check-governed-merges.mjs --pr 35838: 0 of 10 paths governed. No packages/spec/src/** path and no governed rule text in the diff, so this is TIER_DEFAULT, items ①–③, no ④. Read against card #34774 Done-when, the L1-a ACCEPT 7038706539 and the dev report 7037604649. The read used the diff, the card, the cited code on main and the head's check-runs. Nothing was built or run.

① Derived judgments

  • Pure widening: holds. On main, save_metadata_draft declares additionalProperties: false, and toolInputSchema (mcp-server-runtime.ts, unchanged by the diff) passes parameters through z.fromJSONSchema into the inputSchema that registerToolFromDefinition hands the SDK. The SDK validates a call's arguments before the handler runs (pinned by mcp-tool-bridge-input-schema.test.ts). The new pin, "a closed authoring tool input refuses an undeclared key before the registry is called", goes through handleHttpRequest with the pre-change parameters. A call that carries clientSpecVersion is refused, the refusal names the key, and registry.calls is 0. The control call without the key reaches the registry whole. No other door reaches the save: createOpenAuthoringRegistry has one caller, resolveOpenAuthoringInjection (domains/mcp.ts), and neither is exported. @objectstack/runtime's exports map has only . and ./compiled-plugin-manifest-file, and index.ts does not re-export mcp-authoring. So no request that main accepts is refused at this head.
  • Face 1 (ruling A): holds. AUTHORING_CONTRACT_LINE is added only under authoringServed, as the second paragraph. The mcp: give a host a per-request instructions seam for grants that do not admit the authoring family, and say on the data-only surfaces (default instructions, SKILL.md, Connect page) that building needs an OAuth metadata:write connection #32766 no-build-door assertion (not.toMatch(/build|metadata|author|scope/i)) is not edited, and it would catch the line, because "Authoring" matches /author/i. The shared strip helper now also strips the contract line. It is used at the mcp: give a host a per-request instructions seam for grants that do not admit the authoring family, and say on the data-only surfaces (default instructions, SKILL.md, Connect page) that building needs an OAuth metadata:write connection #32766 blank-text case for a metadata:write request, which earns the line under ruling A. Host text and configured text bypass openServerInstructions.
  • Face 2: holds.
    • Omitted: clientSpecVersionVerdict returns {}, ...advised spreads nothing, and the pin covers the answer keys, the answer string and the protocol writes.
    • Another major: 400 before typeAdmission('PUT'), with nothing written, carrying npm i -D @objectstack/spec@ and the server version.
    • Another minor: saved, with specVersionAdvisory.
    • Not SemVer: 400. The empty string and non-strings are already refused by the schema (type: string, minLength: 1).
  • Error codes: VALIDATION_ERROR 400 (typed ErrorCode, already used by this registry) and SERVICE_UNAVAILABLE 503 (sendDeclaredFault) are both existing standard codes. No new code, so no ERROR_CODE_LEDGER row is owed.
  • Face 3: the route sits inside registerDiscoveryEndpoints, so api.enableDiscovery gates it (rest-server.ts). It has a closed empty query set and a REST_ROUTE_LEDGER row (server-only, amendment 7035926523). The mount-table pin's 2→3 edit is in place and correct. The content needs no credential: the profile is constant and its vocabulary comes from the published spec. But the route itself fails, see F1.
  • Done when: both parts are pinned. Part 2 rests on an anonymous route, so it carries F1.

② Semver level

patch on @objectstack/mcp, @objectstack/runtime and @objectstack/rest is correct per AGENTS.md: Metadata-protocol: none (a tool input is not an authorable metadata key) means patch, and a widening that is not a protocol change ships patch. No published spec or exports edit. Both declaration lines are in the body and the changeset. The body records seat ruling A and scope-out #35841 (open).

③ Boundary flags

  • F1 — must-fix: the new anonymous route is outside ADR-0138 D2's closed list, and the in-tree sweep holds it to 401.
    • The rule: ADR-0138 D2 says an unauthenticated request is served only by the six door classes and the "outside by construction" families, and everything else answers 401. "A new surface is therefore 401 until this list names it."
    • Why the route is not covered: the control-plane family is named by its predicate isAuthGateAllowlisted. ALLOW_ROUTES matches exact segments, ['discovery'], so /api/v1/discovery/restriction-profile is not on it. The sweep's discovery row is routeIs('GET /api/v1', 'GET /.well-known/objectstack').
    • The consequence: anonymous-door-sweep.classification.ts puts the route in the everything-else class (and its environment-scoped twin, where scoping mounts it). anonymous-door-sweep.dogfood.test.ts reads the population off the booted showcase, which mounts REST discovery, so a 200 there turns "the everything-else class answers 401 throughout" red.
    • Why PR CI is green: the dogfood battery never runs on pull_request (ci.yml, github.event_name != 'pull_request'; both shard runs show skipped on this head). It runs on merge_group and push, so this head fails in the queue.
    • Why the fix is not a test edit: the sweep header says a route moves into an outside family "only by an amendment of ADR-0138, and the classification is edited after that amendment, never instead of it". The invitation-preview door was admitted that way. Gating the route with enforceAuth fails Done-when part 2, because fetchRestrictionProfile (packages/cli) sends no credential.
    • So the route needs a ruling, the same kind as the invitation-preview amendment: does a ruled ADR-0138 amendment admit GET {basePath}/discovery/restriction-profile into the control-plane discovery role? If so, through which carrier: a sweep row only, or an exact ALLOW_ROUTES row? An ALLOW_ROUTES row also exempts the route from the ADR-0069 held-user gate and from shouldDenyAnonymous, so it reaches further.
    • The ADR amendment is a governed surface. The PR body and changeset are not edited until then. The dev report's security_findings: none and dogfood_battery: n/a both missed this.
  • N1 (L1 note 1): enableDiscovery: false also hides the profile. The CLI fails closed: it refuses a non-2xx and never reads it as "no restriction". Consistent with the switch, and pinned. Nit: the changeset could say so.
  • N2 (L1 note 2): the server manifest cannot be read. This is a degenerate state. @objectstack/spec exports ./package.json, which package-version.ts and loadOpenApiSpec already resolve. All three faces agree in that state (no line, 503, an advisory that says the versions were not compared), and the item's own validation stays the gate. Nit.
  • N3 (L1 note 3): a prerelease on the same major and minor is silent. This matches the D4 = A major/minor rule. A prerelease of another major (19.0.0-next.0) is still refused. Nit.
  • N4: the route's docblock is wrong about who already hears the version. It says the route "says nothing the MCP initialize instructions do not", but initialize reaches only authenticated metadata:write connections. The anonymous peer is /discovery's version: the metadata-protocol package version, in the same fixed group, unless OS_RUNTIME_VERSION overrides it. openapi.json's info.version has needed authentication since rest: the API-description endpoints (RestServer.registerOpenApiEndpoints) answer an anonymous caller with the whole object model; ADR-0056 D2 and ADR-0138 D2 require 401 #22430. So the one new anonymous fact is the spec version under an operator stamp. That is input for F1's ruling. Nit.
  • Open question (A/B): answered by seat ruling A, which the body records. Out of scope: the stdio text is carried by mcp stdio server: state the authoring contract version in its default instructions (scope-out of PR #35838) #35841.
  • SQL push-down: the diff adds no query, no id materialisation and no in-app join. Nothing to record.
  • Author objectstack-fleet[bot]: no login note owed.

F1 gets a card that cites this record. The head that fixes it owes a new full L2 round.

Implemented-by: claude/area-a4C-34774
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: FAIL

The anonymous GET {basePath}/discovery/restriction-profile route is outside
ADR-0138 D2's closed anonymous list, so it waits for a ruled amendment and is
parked on its own branch. This removes the route, its route-ledger row, the
mount-table pin's third discovery route and its conformance cases, returning
packages/rest to the merge base. The authoring contract line and the
clientSpecVersion judgement stay; two comments no longer name the route, and
the changeset drops @objectstack/rest and the route paragraph.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Final green head (round 3, split): a8e9136eee238a2ccb08d5b0d9fa36f87b54f98d · 2026-11-20T12:57Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1eW7iLBvc8c6xv9Fx

L1 delta verdict (L1-a): ACCEPT at head a8e9136eee238a2ccb08d5b0d9fa36f87b54f98d (now Part of #34774). This is a delta from my ACCEPT 7038706539 at c7890e5b.

Gates on this head: l1-face --pr 35838 CLEAN (13 items, none flagged): first line Part of #34774, no closing keyword anywhere in the body, the changeset covers @objectstack/mcp and @objectstack/runtime. Check-runs at a8e9136: 39 success, 18 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both success.

The delta (one commit, a8e9136e, parent c7890e5b):

Not re-run by me: the code of faces 1 and 2 did not move, so I take my run at c7890e5b (mcp 46/46, runtime 41/41, positive controls) as standing. The dev reports full mcp 1446/1446 and runtime 11684 passed on this head, and CI is green.

Landing: not governed. The seat's contract re-read of the narrowed PR follows, then a4-C lands. #34774 stays open for #35848.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF
Served-tier: TIER_DEFAULT

Contract review — PASS at a8e9136

Head-sha: a8e9136eee238a2ccb08d5b0d9fa36f87b54f98d
Local-runs: none
Read: 2026-11-20T13:04Z

Face: the Clause-②: yes declaration alone. check-governed-merges.mjs --pr 35838 reports 0 of 6 paths governed. The diff has no packages/spec/src/** path and no governed rule text, so the tier is TIER_DEFAULT, items ①–③, no ④. This is a fresh full round on the new head after my FAIL 7038862149 at c7890e5b. It was read against card #34774, the L1-a delta ACCEPT 7040140242, the dev report 7040118951, the cited code on main (2ad42b5d, merge base 7878cf05) and the head's check-runs (39 success, 18 skipped, 0 failed). Nothing was built or run.

① Derived judgments

  • F1 of 7038862149: closed.
  • Pure widening: holds on main.
    • On main, save_metadata_draft declares additionalProperties: false.
    • toolInputSchema (unchanged by the diff) passes parameters through z.fromJSONSchema into the inputSchema that registerToolFromDefinition gives the SDK. registerAuthoringTools, the per-request HTTP authoring bridge, registers through that function. The SDK validates arguments before the handler runs, as mcp-tool-bridge-input-schema.test.ts pins.
    • The new pin goes through handleHttpRequest with the pre-change parameters. A call that carries clientSpecVersion is refused, the refusal names the key, and registry.calls is 0. The control call without the key reaches the registry whole.
    • No other door reaches the save. createOpenAuthoringRegistry has one caller, resolveOpenAuthoringInjection (domains/mcp.ts). @objectstack/runtime exports only . and ./compiled-plugin-manifest-file, and index.ts does not re-export mcp-authoring.
    • So no request that main accepts is refused at this head.
  • Face 1: holds.
  • Face 2: holds. clientSpecVersionVerdict runs after the writer 403 and the input checks, and before typeAdmission('PUT'), writeVerdict and saveMetaItem.
    • Absent: the verdict returns {}, and ...advised spreads nothing. Pinned: the answer keys are exactly saved, verdict, review; the answer string equals a same-major-and-minor save's; the protocol writes are identical.
    • Malformed: 400 VALIDATION_ERROR, naming the SemVer form. The check uses SEMVER_2_0_0_VERSION_PATTERN, which @objectstack/spec/kernel exports on main. Five values are pinned (18, v18.6.0, 18.6, the number 18, the empty string), and nothing is written for any of them.
    • Another major: 400 VALIDATION_ERROR, naming both versions and npm i -D @objectstack/spec@ plus the server version. The previous and the next major are both pinned with nothing written. Ablation is recorded in the body.
    • Another minor: saved, with specVersionAdvisory carrying the same command. The writes are saveMetaItem then draftPublishJudgement.
  • Error code: an existing standard code. VALIDATION_ERROR is in the standard catalog (errors.zod.ts, and HttpStatusErrorCodeMap[400]), typed as ErrorCode and already used by this registry. No new code, so no ERROR_CODE_LEDGER row is owed. The tools declare no outputSchema, so the new answer key only adds.
  • One value for both faces. Both reads require('@objectstack/spec/package.json'), an exported subpath. @objectstack/spec, @objectstack/mcp and @objectstack/runtime are in one fixed group, and both packages depend on spec through workspace:*, which becomes an exact version at publish.
  • Done when. Part 1 (a client on the previous major is refused with the command) is pinned. Part 2 (os validate --target reads a profile) is not delivered: it is scoped out to Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #35848. The body says Part of #34774 and has no closing keyword, so the card stays open.

② Semver level

  • The changeset names exactly the two packages the diff moves, @objectstack/mcp and @objectstack/runtime, both at patch. @objectstack/rest is dropped, which is right because it has no diff.
  • Metadata-protocol: none is right. A tool input is not an authorable key, and no metadata value is newly refused. AGENTS.md: "none takes patch; a non-protocol change, widening or breaking, ships patch."
  • The Clause-②: yes — widening line is identical in the body and the changeset. Its prose names only "a new optional tool input and one new instructions line", not the route.
  • The changeset bullets match the code sentence by sentence.
  • The body's scope-out names Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #35848 and claude/area-a4C-34774-route at c7890e5b. Check Changeset is green.

③ Boundary flags

  • Dogfood anonymous-door sweep: would stay green. The diff registers no route and changes no auth gate. The only HTTP surface it touches is the initialize text on /api/v1/mcp. The sweep's mcp outside family holds that endpoint to 401 for an anonymous caller, and the line needs a metadata:write grant anyway. The everything-else class gains no member. (The battery skips on pull_request as designed; it runs in the merge group.)
  • N1 (L1 note b): re-judged, still a nit. When the spec manifest cannot be read, AUTHORING_CONTRACT_LINE and SERVER_SPEC_VERSION are both undefined.
    • The result: no instructions line, and any well-formed clientSpecVersion saves with an advisory saying it was not compared. Malformed values are still refused.
    • Why it is a nit:
      • The state needs a bundle that drops the exported ./package.json subpath.
      • A client that was told no version was promised no comparison.
      • The item's schema parse still gates the save.
      • Failing closed would refuse every declaring client on a server that cannot name a version to install.
    • With face 3 gone, two faces agree in this state, not three.
  • N2 (L1 note c): re-judged, still a nit. A prerelease on the same major and minor, such as 18.6.0-next.1 against 18.6.0, parses to [18, 6] and gets no advisory. Ruling D4 = A grades by major and minor only. A prerelease of another minor is advised, and one of another major (19.0.0-next.0) is refused. The schema parse stays the gate.
  • N3: the PR title still ends "serve the restriction profile". The repository squashes with PR_TITLE, so the commit subject on main would claim a route this PR does not serve. The changeset, the Clause-② prose and the diff are all clean. Retitle before landing. It is prose only, so the head does not move.
  • Dev flags and open questions. Seat ruling A is recorded in the body. The stdio text is scoped out to mcp stdio server: state the authoring contract version in its default instructions (scope-out of PR #35838) #35841. Face 3 is split to Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #35848. The round-3 report raises no new question.
  • Main drift. origin/main is 23 commits past the merge base. Among them, only the packages/rest batch routes are near this diff, and none of the six files moved. git merge-tree is clean.
  • SQL push-down. The diff adds no query, no id materialisation and no in-app join. Nothing to record.
  • Author. objectstack-fleet[bot], so no login note is owed.

Only nits remain, so this is the final round. N3 is a retitle, not a new head.

Implemented-by: claude/area-a4C-34774
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot changed the title feat(mcp): state the authoring contract version, refuse another spec major, serve the restriction profile feat(mcp): state the authoring contract version and refuse a client on another spec major Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Landing: ready + auto-merge at a8e9136eee238a2ccb08d5b0d9fa36f87b54f98d · 2026-11-20T13:07Z

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 13:07
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 3c038eb Nov 20, 2026
62 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-a4C-34774 branch November 20, 2026 13:31
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…get reads (ADR-0138 D2 amendment) (objectstack-ai#35887)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDxdrYJq965rUfrZBso8FS3)_
Fixes objectstack-ai#34774
Clause-②: yes — widening: one new anonymous read-only discovery route
(an open restriction profile); nothing served today changes
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:自托管服务器的开发者用命令行校验工程时,可以直接指向自己的服务器地址读取它的限制配置(开放、无限制,附带它运行的规范版本),以前这一步对自托管服务器总是失败。
- 为什么做:属于 MCP 本地优先编写入口那条主线,补上“对自托管服务器校验”的后一半;你在决策卡(自托管服务器能否不登录公开限制配置)上选了
A。
- 出错会怎样:未登录的人只能多读到一个规范版本号,不涉及任何业务数据;关掉服务器的发现功能就一并隐藏;随时可以撤回。
- 要你做什么:这次改动修订了访客模型那篇架构决策记录,需要你本人批准后才能合并。

## What changes

Face 3 of objectstack-ai#34774, resumed under the maintainer's ruling **A** on
decision card objectstack-ai#35848 (recorded on the card in comment 7043884056; card
objectstack-ai#35848 is resolved by the seat when this merges). Faces 1 and 2 landed
in PR objectstack-ai#35838 as `Part of objectstack-ai#34774`; this PR closes the card.

- **The route** (`packages/rest/src/discovery-routes.ts`): `GET
{basePath}/discovery/restriction-profile`, ported unchanged in behaviour
from the parked branch `claude/area-a4C-34774-route` @ `c7890e5b` (main
had not moved the four files since that branch's base). It is anonymous
(no `enforceAuth`, as `/discovery`), refuses every query parameter
(`refuseUnknownQueryParams(req, res, [])` → 400 `VALIDATION_ERROR`),
answers 503 `SERVICE_UNAVAILABLE` when the `@objectstack/spec` manifest
cannot be read, serves `{ success: true, data }` with `data` an open
`RestrictionProfileSchema` value and `versions { spec, skills }`, and is
mounted inside `registerDiscoveryEndpoints`, so `api.enableDiscovery`
gates it. The docblock is corrected per review note N4 of 7038862149:
the anonymous peer is `/discovery`'s `version`, not the MCP `initialize`
text, and it now cites the ADR-0138 D2 amendment.
- **One `REST_ROUTE_LEDGER` row** (`family: 'discovery'`, `disposition:
'server-only'`; the CLI reads it, not `@objectstack/client`).
- **Behaviour pin flipped in place:**
`rest-config-mount-table.pin.test.ts`, `api.enableDiscovery` off removes
2 routes → 3 routes (the new one added), ruled by objectstack-ai#34774 face 3 and
objectstack-ai#35848 A.
- **ADR-0138 D2 amendment** (`docs/adr/0138-…md`), in the
invitation-preview amendment's form and place: a `· **Amended**
(2026-11-20, …)` entry on the status line, and a dated note under D2's
table after the 2026-11-16 note. It admits the route, and its
environment-scoped twin where scoping mounts it, into the control-plane
**discovery** role; names the carrier (the anonymous-door sweep's
`discovery` row only, no `ALLOW_ROUTES` row, because the handler never
calls `enforceAuth`); says what it serves (a constant open profile; the
one added anonymous fact is the spec version, which `/discovery`'s
`version` states too unless an operator stamp replaces it); gives the
reason (`os validate --target URL` without a credential, plus cloud
parity, objectstack-ai#31240 comment 6716619631); and cites ruling A on objectstack-ai#35848 and the
review record 7038862149. Nothing else in the ADR changes. The generated
ADR index is unchanged (`pnpm check:adr-index` exit 0; the index row
shows the status line's opening only).
- **Sweep classification**
(`packages/qa/dogfood/test/anonymous-door-sweep.classification.ts`): the
`discovery` outside family's `routeIs(…)` gains `GET
/api/v1/discovery/restriction-profile`, and its reason names the
amendment. It is edited in the same commit as the amendment, as the
header requires.
- **Changeset** `.changeset/34774-restriction-profile-route.md`:
`'@objectstack/rest': patch`. `@objectstack/dogfood` is private, so it
takes none.

### Clause-② reading

`yes — widening`. The diff adds one GET route at a path nothing served
before (the CLI's `RESTRICTION_PROFILE_ROUTE` got a 404 from every
self-hosted runtime). No existing route, schema, export, error code or
default changes. The new answer for an anonymous caller is a 200 where
the ADR's everything-else class answered 401, which is exactly what the
ruled amendment admits. No published `exports`, spec shape or authorable
key changes, so `Metadata-protocol: none` and `patch`.

## Tests

<details><summary>rest: full suite, typecheck, and the three route files
at ccc73c8</summary>

- `pnpm --filter @objectstack/rest test` (under the verify lock, after a
full `pnpm build`): `Test Files 424 passed (424)`, `Tests 8648 passed |
351 skipped (8999)`; lock `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/rest --filter @objectstack/dogfood
typecheck`: lock `VERDICT command-exit 0` (rest's `tsc --noEmit` plus
`check:test-typecheck`; dogfood's `tsc --noEmit`).
- Targeted, verbose: `discovery-schema-conformance.test.ts`,
`rest-config-mount-table.pin.test.ts`,
`rest-route-ledger.conformance.test.ts`: `Test Files 3 passed (3)`,
`Tests 54 passed (54)`, including "api.enableDiscovery: on → mounted,
off → exactly 3 route(s) gone", "answers { success: true, data } on both
mounts…" and "reads no query parameter: an unknown one is refused 400
VALIDATION_ERROR".

</details>

<details><summary>The anonymous-door sweep, run locally on the booted
showcase, plus a one-time ablation</summary>

- `pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=2
test/anonymous-door-sweep.dogfood.test.ts`: `Test Files 1 passed (1)`,
`Tests 21 passed (21)`; lock `VERDICT command-exit 0`. This is the
merge-group battery file that review F1 said would go red; PR CI skips
it.
- Ablation (one time, not kept): `scripts/ablation-replace.mjs` replaced
the new `routeIs` key with an unmatched one (anchor x1 → x0, blob
`8f35c855bae2` → `f861b4156a21`). The everything-else case went red,
`Tests 1 failed | 20 passed (21)`, with exactly one route in that class:
this one. So the route is in the swept population and the new key is
what classifies it. Restored: blob == HEAD `8f35c855bae2`, `git diff
HEAD` empty. A first attempt was a no-op that the tool refused before
running anything (its replacement text already occurred in the file), so
it measured nothing.
- The environment-scoped twin: the sweep's showcase boot does not enable
environment scoping, and the ablation's red named only the unscoped
route, so the row lists that route alone. The ADR amendment admits the
twin where scoping mounts it.

</details>

## Verification

**Real boot** (after a full `pnpm build`, the way round 1 did): `pnpm
dev:crm -- --fresh -p 38775`, then

- anonymous `curl
http://127.0.0.1:38775/api/v1/discovery/restriction-profile` → `HTTP
200`, body
`{"success":true,"data":{"allowCode":true,"allowSandboxedJs":true,"allowScheduledAutomation":true,"allowedFlowNodeTypes":[…23
node types…],"versions":{"spec":"18.6.0","skills":"18.6.0"}}}`;
- the same URL with `?x=1` → `HTTP 400`; control: anonymous `GET
/api/v1/data/account` → `HTTP 401`;
- `os validate --target http://127.0.0.1:38775` in `examples/app-crm` →
exit 0, printed `Target profile:
http://127.0.0.1:38775/api/v1/discovery/restriction-profile` and `✓
Validation passed`.

The server was torn down by its recorded pid and port.

**Two-minute check:** boot any example (`pnpm dev:crm -- --fresh -p
PORT`) and `curl -i
http://127.0.0.1:PORT/api/v1/discovery/restriction-profile` with no
credential. Expect 200 and the open profile with the spec version.

**Read first, by risk:**
1. `docs/adr/0138-…md`, the new dated note under D2: the governed text,
and the carrier statement (sweep row only, no `ALLOW_ROUTES`).
2. `packages/rest/src/discovery-routes.ts`, the route handler: no
`enforceAuth`, the empty closed query set, the 503 branch.
3. `packages/qa/dogfood/test/anonymous-door-sweep.classification.ts`,
the `discovery` row.

<details><summary>Gates at ccc73c8</summary>

- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 83 commands at ccc73c8. Each was
run with its exit captured before any pipe: 83 exit 0. `node
scripts/check-plugin-teardown-shape.mjs --self-test` first exited 3
(PREREQUISITE NOT MET: its pinned control commit `621a4876` was not in
this shallow clone); after `git fetch --depth=1 origin 621a487…` it
exited 0 with "48 cases pass", and that exit is the one recorded.
- `--ran` reconciliation: "83 derived, 83 run, 0 NOT-MEASURED, 0 UNRUN",
exit 0.
- `node scripts/pm/overlap-check.mjs
--branch=claude/area-a4C-34774-face3`: `VERDICT clean exit 0`
(origin/main merges cleanly; objectstack-ai#35865 shares the ledger and the
mount-table pin and merges cleanly).
- Not run locally: `test:repo` and the full CI farm; CI owns them.

</details>

## Acceptance notes

- **Landing is Tier H** (`docs/adr/**`, Prime Directive objectstack-ai#14): this PR
lands only by the maintainer's hand or an authorized approval, after the
seat's CONTRACT_REVIEW_TIER review. Never readied, queued or labelled by
a seat.
- The `discovery` outside family keeps no `expect` predicate: D2 states
no answer for it, and the classification header forbids pinning one
route's own answer. A 200 is accepted there as it is for the REST root;
the everything-else red in the ablation is what pins the classification.
- Size: 11 files, +268 / −13 against the merge-base (round 3 alone: 8
files, +98 / −12, net 86).

Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz

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

## Round 3 (seat S1/S2)

Answers the seat contract review
[7062697033](objectstack-ai#35887 (comment))
(S1, S2, nits a and b) under claim amendment 3 (7062738586). Nit c is a
CLI-lane card and is not here.

- **S1, route (b), text only.** The body stays the constant open profile
ruling A admitted. The ADR-0138 dated D2 note and the docblock of
`openRestrictionProfile` now say plainly: `allowedFlowNodeTypes` is the
profile's whole node-type vocabulary, the approvals plugin's `approval`
/ `approval_revise` included. It is not a statement of which plugins
this kernel runs, so `os validate --target` against a self-hosted
runtime does not check whether an approval flow has an executor there.
The spec-side reader rule goes to spec-lane card objectstack-ai#36081. Neither the
body nor the ruling's scope moves.
- **S2, the CJS manifest anchor.** New `packages/rest/tsup.config.ts`:
the shared root config's settings unchanged (same entry, formats, dts,
target, sourcemap, sources-content drop), plus `shims: true`, with a
LOAD-BEARING comment in the shape of `packages/mcp/tsup.config.ts`.
`packages/rest/package.json`'s `build` script drops `--config
../../tsup.config.ts` so tsup reads the package config (one line;
without it the new file would never be read). Measured on the rebuilt
`dist/index.cjs`: 0 occurrences of an emptied `var import_meta = {}`
(was 2 under the ablation below), and the `getImportMetaUrl` shim is
present. This also repairs `loadOpenApiSpec` in `rest-server.ts`, which
spells the same `createRequire(import.meta.url)` and could not read the
static OpenAPI artifact through the `require` entry. The changeset says
both.
- **Pins.** (a) The 503 branch: a fresh module graph (`vi.resetModules`)
with `module`'s `createRequire` failing only for
`@objectstack/spec/package.json` → `503`, `code: SERVICE_UNAVAILABLE`
(the flat `sendDeclaredFault` dialect), no `data`. (b) Both formats: a
second `check:dual-build-cjs-loads` behaviour probe, on
`@objectstack/rest`, serves the route through the public `RestServer`
from `dist/index.cjs` and `dist/index.js` and requires both to answer
the installed `@objectstack/spec` version. The probe table gains an
optional `call` (a function source, awaited), with one new self-test
case; the AGREES battery floor moves 5 → 6.
- **Nits.** (a) `RESTRICTION_PROFILE_PARAMS`, an exported empty closed
set, replaces the inline `[]`. (b) ADR-0138 criterion 2's
discovery-documents item and the `discovery-routes.ts` anchor invariant
now name the route.

**Version disclosure.** `/discovery` answers its anonymous `version` as
the `OS_RUNTIME_VERSION` stamp when one is set, otherwise the
`@objectstack/metadata-protocol` package version.
`@objectstack/metadata-protocol` and `@objectstack/spec` are in one
`fixed` changeset group, so without a stamp the two numbers are the same
on any install that resolves one release of the platform; they differ
only on an install that resolves the two packages at different versions,
or where the manifest read fails (`/discovery` then says `unknown`, and
this route answers 503). With a stamp set, they differ: this route
exposes the exact `@objectstack/spec` version, which `/discovery` does
not.
**Ruled A: keep the exact version.** The maintainer chose A on the
version-disclosure decision card on 2026-11-21 (Ruling-ref: objectstack-ai#34774
comment 7065230616): `versions.spec` / `versions.skills` stay the exact
resolved `@objectstack/spec` version, as implemented. Trimming to
major.minor was not chosen: `RestrictionProfileSchema` requires SemVer
2.0.0 and `restrictionProfileVersionDrift` compares by string equality,
and an operator who wants the route hidden already has
`api.enableDiscovery: false`. No docs sentence about
`OS_RUNTIME_VERSION` is added.

<details><summary>Round 3 verification</summary>

At head `e5488dde62`, under `scripts/pm/os-verify-lock.sh`:

- Closure + package build: `pnpm --workspace-concurrency=2 --filter
'@objectstack/rest^...' build && pnpm --filter @objectstack/rest build`
→ `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/rest test` → `Test Files 425 passed
(425)`, `Tests 8676 passed | 351 skipped (9027)` (the route conformance
tests, the new 503 pin and the mount-table pin included); `pnpm --filter
@objectstack/rest typecheck` (tsc + `check:test-typecheck`) → OK; one
`VERDICT command-exit 0` for both.
- The 503 pin went red once, locally and in CI at `4a4e4685` (`expected
undefined to be false`): it asserted `success: false`, which the flat
`sendDeclaredFault` dialect does not send. It now asserts `code:
SERVICE_UNAVAILABLE` and no `data`; fixed in `e5488dde62`.
- `node scripts/check-dual-build-cjs-loads.mjs --self-test` → `94 cases
pass`. The full scan exits 3 (PREREQUISITE NOT MET: not every package is
built in this worktree), so the shipped probe table was run through the
gate's own exported `runBehaviourProbes` on the two built entries it
names (`@objectstack/rest`, `@objectstack/metadata-core`): `findings:
[], ran: 2`. The full scan is CI's reading.
- **Ablation** (one time, not kept): `scripts/ablation-replace.mjs
--delete` on the ` shims: true,` line (lines after mutation: 0),
rebuild, `ablation-dist-preflight.mjs @objectstack/rest getImportMetaUrl
--absent` → dist marker absent from all 6 built files, `var import_meta
= {}` ×2 in `dist/index.cjs`; the probe went red: `the two formats
DISAGREE — require said 'status 503', import said '18.6.0'`. Restored:
blob == HEAD `a87f404dab54`, `git diff HEAD` empty; rebuilt; preflight
(present mode) → marker in `dist/index.cjs`, tree clean; probe
`findings: []`. The preflight's tree reading refused on the mutate leg
(the source spells `shims: true`, the dist marker differs); the dist
reading is the one recorded.
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `e5488dde62` derived 115 commands. 85
were run, exits captured per command: 84 exit 0 (among them
`check:adr-index`, `check:adr-anchors`, `check:nul-bytes`,
`check:adr-links`), 1 exit 3 (`check:dual-build-cjs-loads`, prerequisite
as above). 30 were not run (`check:pm-dispatch-gates` through
`check:workspace-manifest-cycles` in derivation order), stopped at the
maintainer's handover order: NOT MEASURED, CI's reading.
- The anonymous-door sweep files did not change; not re-run.

</details>

<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5miLqNucRZevceHwNh -->

---------

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

Development

Successfully merging this pull request may close these issues.

2 participants