Skip to content

feat(rest): serve the anonymous restriction profile os validate --target reads (ADR-0138 D2 amendment) - #35887

Merged
os-zhuang merged 5 commits into
mainfrom
claude/area-a4C-34774-face3
Nov 21, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/area-a4C-34774-face3

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #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 #34774, resumed under the maintainer's ruling A on decision card #35848 (recorded on the card in comment 7043884056; card #35848 is resolved by the seat when this merges). Faces 1 and 2 landed in PR #35838 as Part of #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 mcp: the server states its authoring contract version, refuses a client on a different major, and serves the restriction profile #34774 face 3 and Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #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, cli: os validate --target accepts only a profile file — add the URL form once an environment publishes its restriction profile at a defined route (cloud#3713) #31240 comment 6716619631); and cites ruling A on Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #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

rest: full suite, typecheck, and the three route files at ccc73c8
  • 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".
The anonymous-door sweep, run locally on the booted showcase, plus a one-time ablation
  • 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.

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.
Gates at ccc73c8
  • 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 621a4876… 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; feat(units): os migrate unit-codes, the unit code backfill door (ADR-0158 U7 R1) #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.

Acceptance notes

  • Landing is Tier H (docs/adr/**, Prime Directive feat: Comprehensive CRM example demonstrating all ObjectStack protocol features #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

Round 3 (seat S1/S2)

Answers the seat contract review 7062697033 (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 spec: an open self-hosted restriction profile always lists approval / approval_revise, so os validate --target cannot tell whether the kernel runs the approvals plugin #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: #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.

Round 3 verification

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.

…get reads

GET {basePath}/discovery/restriction-profile answers { success, data } with an
open RestrictionProfileSchema value and versions { spec, skills }, refuses every
query parameter, answers 503 SERVICE_UNAVAILABLE when the spec manifest cannot
be read, and is mounted under api.enableDiscovery (mount-table pin 2 -> 3, one
REST_ROUTE_LEDGER row).

ADR-0138 D2 is amended (ruling A on the decision card) to admit the route to the
control-plane discovery role, carried by the anonymous-door sweep's discovery
row alone with no ALLOW_ROUTES row; the sweep classification is edited after
that amendment, in this commit.

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

This PR changes 1 package(s): @objectstack/rest, touching 8 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/rest/tsup.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/ai/connect-mcp.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/api/client-sdk.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/api/error-catalog.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/api/index.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/automation/webhooks.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/deployment/self-hosting.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/kernel/runtime-services/email-service.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/permissions/authentication.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/permissions/authorization.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/permissions/sharing-rules.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/protocol/kernel/error-handling.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/ui/print-pages.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))

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

  • content/docs/releases/implementation-status.mdx (via registerDiscoveryEndpoints (symbol, a top-level function))
  • content/docs/releases/v17/17-0.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/releases/v17/17-3.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/releases/v17/17-4.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/releases/v17/17-7.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/releases/v18/18-2.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))
  • content/docs/releases/v18/18-5.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in registerDiscoveryEndpoints))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/rest/tsup.config.ts) — pages documenting those are invisible to this run
  • 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 — 19 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 3543b51d37b41086275dacf91e7a29cb8c67da8b → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 3543b51d37b41086275dacf91e7a29cb8c67da8b

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 3543b51d37b41086275dacf91e7a29cb8c67da8b → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Final green head (r2, main merged; resume after the p1-only release): 12e4aa0aa353cb1d9a6a8d64d6b8753698eaedc0 · 2026-11-21T12:17Z

  • r2 is a clean merge of origin/main 8145424b into ccc73c86; no code change. The diff against main is still the r1 diff (7 files, +173 / -4). The os-dev report is 7062434049.
  • Local at this head: rest suite 425 files / 8675 tests pass; route conformance + mount-table pin 54/54 (enableDiscovery off removes exactly 3 routes); anonymous-door sweep on the booted showcase 21/21; dispatch-gates 83/83 exit 0; overlap-check clean.
  • CI: 39 success, 16 skipped, 0 failed, 0 pending.
  • check-governed-merges --pr 35887: GOVERNED (ADR-0138), Tier H (人合). It lands after an authorized APPROVED review, by the owning seat.
  • Sent to L1-a for review on this head; the seat's contract read at CONTRACT_REVIEW_TIER comes next. The ruling record is Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #35848 (A).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 verdict (L1-a): ACCEPT at head 12e4aa0aa353cb1d9a6a8d64d6b8753698eaedc0 (Fixes #34774, face 3). Full read. r2 only merges main; the diff against main is unchanged (7 files, +173/-4).

席位核对

Shape and gates. l1-face --pr 35887 CLEAN (13 items, none flagged). Check-runs at 12e4aa0: 39 success, 16 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both success. mergeable_state clean. Declares Clause-②: yes — widening, Metadata-protocol: none, with an @objectstack/rest patch changeset. Governed by docs/adr/** (ADR-0138 amendment), so Tier H.

Fixes is right. The card's Done-when has two halves. "A client declaring the previous major is refused" landed with faces 1 and 2 in #35838 (Part of #34774, merged 11-20 13:31Z). "os validate --target against a self-hosted runtime reads a profile instead of failing" is this route. Merging closes the card. Decision card #35848 stays open; whoever lands this closes it with a pointer, since this PR implements its ruling.

The ruling, against the diff. Ruling A on #35848 (7043884056) says: sweep row only, no ALLOW_ROUTES row, no sign-in as on cloud, the body discloses only the versions plus an open profile, and api.enableDiscovery: false hides it. The diff does each of these:

  • registerDiscoveryEndpoints registers GET ${basePath}/discovery/restriction-profile with no enforceAuth, beside /discovery. No auth-gate.ts file is touched.
  • The sweep discovery row in anonymous-door-sweep.classification.ts gains exactly GET /api/v1/discovery/restriction-profile, with its reason extended. There is no expect predicate, as for its two siblings.
  • The ADR-0138 D2 amendment is dated, cites the ruling record, F1 7038862149 and cli: os validate --target accepts only a profile file — add the URL form once an environment publishes its restriction profile at a defined route (cloud#3713) #31240 c6716619631, and names the env-scoped twin. It admits the route to the discovery role, not to a door class.
  • The mount-table pin moves api.enableDiscovery from removing 2 routes to 3, so the switch provably unmounts the new route.
  • REST_ROUTE_LEDGER gains a family: 'discovery', server-only row, which is right because @objectstack/client does not read it; the CLI does.

The wire matches the CLI reader. packages/cli/src/utils/restriction-profile.ts:139 has RESTRICTION_PROFILE_ROUTE = '/api/v1/discovery/restriction-profile'. Its reader (lines 262-268) needs success === true and data, then RestrictionProfileSchema.safeParse(data). The handler answers { success: true, data: openRestrictionProfile(spec) }. versions.skills = versions.spec holds because .changeset/config.json fixed puts @objectstack/spec, @objectstack/skills and @objectstack/cli in one group.

Tests (ADR-0112 envelope). The new conformance block drives the real registered handler on both mounts (base and environments/:environmentId). It asserts 200, success: true, a strict RestrictionProfileSchema parse with zero issues, and the exact open body with versions from the resolved spec package.json. The refusal case asserts status 400 and error.code VALIDATION_ERROR. The dev also reports a real boot: anonymous 200, ?x=1 gives 400, os validate --target succeeds, and the sweep is 21/21 on the booted showcase with an unmatched-row ablation. Only the merge queue runs dogfood, so the sweep's CI reading comes at the queue.

Changeset, sentence by sentence: the route path, the { success: true, data } envelope, no credential (ADR-0138 D2 amended 2026-11-20), a query parameter refused 400 VALIDATION_ERROR, 503 SERVICE_UNAVAILABLE with no profile when the spec version can't be read (sendDeclaredFault with a typed ErrorCode), and api.enableDiscovery: false unmounting it. Each matches the handler.

Non-blocking notes:

  • N1. The 503 SERVICE_UNAVAILABLE branch has no test: servedSpecVersion caches at module level, so a case would need to mock createRequire. The branch is three lines and the code is typed. If the branch moves again, a vi.doMock/reset case would pin the changeset's 503 sentence.
  • N2. The sweep row matches the base path only. The env-scoped twin is admitted by the ADR text and covered by the conformance test, but the booted showcase doesn't enable scoping, so no sweep run sees it. This is the existing pattern; noted for the seat.
  • N3 (for the seat's contract read): with an operator stamp (OS_RUNTIME_VERSION), /discovery's anonymous version shows the stamp, while this route always shows the resolved @objectstack/spec version. The ADR note says so in plain words, and ruling A accepted the versions as the disclosure. I read it as covered.

Landing: Tier H (docs/adr/**). The seat's contract read is next, then an approver.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 12e4aa0aa353cb1d9a6a8d64d6b8753698eaedc0
Local-runs: none
Scope: docs/adr/0138-guest-model-anonymous-principal-doors-grants-and-organization.md + packages/rest/src/discovery-routes.ts, packages/qa/dogfood/test/anonymous-door-sweep.classification.ts, packages/rest/src/rest-route-ledger.ts, packages/rest/src/discovery-schema-conformance.test.ts, packages/rest/src/rest-config-mount-table.pin.test.ts
Security-touching: yes

Full round, ① to ④, on the ADR face (docs/adr/**, Tier H). Read: the net diff against merge-base 8145424b (7 files, +173/-4), card #34774 and every comment, decision card #35848 with its ruling record 7043884056, the earlier record 7038862149, the cited code in this head's tree, and the head's check-runs (39 success, 16 skipped, 0 failed, 0 pending). Nothing was built or run. One reading comes from outside the tree: the published @objectstack/rest 18.6.0 tarball, read for S2.

Result: everything ruling A decided is implemented as ruled, and the anonymous answer holds nothing beyond the profile. Two should-fix findings are open on this head, both about what the route answers, neither about who may read it.

① Derived judgments

  • Route shape and wire against the CLI reader: holds. The CLI fetches /api/v1/discovery/restriction-profile at the target's origin with no credential and no query (RESTRICTION_PROFILE_ROUTE, fetchRestrictionProfile in packages/cli/src/utils/restriction-profile.ts), takes a 2xx JSON body with success === true and a data key, and parses data with the strict RestrictionProfileSchema. The handler answers { success: true, data } at {basePath}/discovery/restriction-profile, and the conformance test parses the live body with that schema on both mounts and compares it whole. The reader refuses every non-2xx, so the 400 VALIDATION_ERROR and the 503 SERVICE_UNAVAILABLE (a typed code, through sendDeclaredFault) both end as a refusal and never as "no restriction". Same shape as the cloud route recorded on cli: os validate --target accepts only a profile file — add the URL form once an environment publishes its restriction profile at a defined route (cloud#3713) #31240 (6716619631).
  • What an anonymous caller reads: the profile and nothing else. The handler takes no input: every query parameter is refused before anything is read, and req.params, the headers, the session, the protocol and the environment are never touched. The body is three true flags, the spec's own node vocabulary and the resolved @objectstack/spec version twice. The environment-scoped twin runs the same closure and answers the same body for any id, real or not, so it is no existence oracle. A request with a query gets back only its own parameter names. Security-touching: yes is meant: the hunks decide what answers without a credential. This read found no vulnerability in them.
  • Anonymous by construction, and pinned. No enforceAuth in the handler, and DiscoveryRouteHost does not even carry it. enforceAuth denies unconditionally (api.requireAuth is a retired, omitted key, so the requireAuth: false the new test passes plays no part), which means the conformance case, a request with no credential answered 200, goes red the day someone gates the handler.
  • api.enableDiscovery: false unmounts it. The route is registered inside registerDiscoveryEndpoints; the mount-table pin moves from 2 removed routes to exactly 3.
  • Sweep row and no auth-gate change: as ruled. The discovery family gains the one exact key GET /api/v1/discovery/restriction-profile. No file under packages/core/src/security/ is in the diff, so ALLOW_ROUTES, isAuthGateAllowlisted and shouldDenyAnonymous are untouched. The family still carries no expect, as its two siblings never did.
  • Ledger row: right. server-only fits a route the CLI reads and @objectstack/client does not; responseSchema is correctly blank, because that field resolves names against @objectstack/spec/api and this schema lives in system.
  • Closed query set (AGENTS.md, route rule 5): declared on the day it lands, with a refusal pin (status and nested error.code) beside the 200.

② Semver level

'@objectstack/rest': patch is right. Clause-②: yes with the widening reasoning is correct: one new route on a path nothing served, and no existing answer, export, schema or error code moves. Metadata-protocol: none is correct: nothing an author can write changes, and that kind alone sets the level. Both lines are in the PR body and the changeset; Check Changeset and the PR-body guards are green. @objectstack/dogfood is private and takes none.

③ Boundary flags

  • Dev report 7062434049: open_questions empty; security_findings: none, which this read agrees with. Deviations 1 to 3 of 7045443677 (the status-line entry beside the dated note, no expect on the family, the twin not in the row) are accepted.
  • L1 note N3 (the operator stamp): an acceptable, documented difference. Not a finding. OS_RUNTIME_VERSION is the system-identity stamp /discovery and /health report: an image tag, a git sha or a release name, free-form. versions.spec is a different fact with a different reader: the schema holds it to SemVer 2.0.0, and restrictionProfileVersionDrift compares it by string equality with the @objectstack/spec the project installs. A stamp there would either fail the strict parse, so the CLI would refuse the whole profile, or raise drift on every run. So neither the wire nor the reader depends on the two matching, the CLI never reads /discovery, and the route must not follow the stamp. The disclosure was in front of the maintainer: the decision card names "the spec version under an operator stamp" as the one new anonymous fact, ruling A accepts the versions as the body, and the ADR note states the difference in plain words.
  • L1 note N2 (the twin is admitted by the ADR and absent from the sweep row): accepted. A swept boot that enabled scoping would put the twin in the everything-else class and go red, which is the loud direction.
  • L1 note N1 (no test for the 503 branch): folded into S2.
  • The anonymous-door sweep runs on merge_group and push only. Its reading on this head is the dev's local run (21 of 21 on the booted showcase, with the ablation that named this route); the queue run is its first CI reading.
  • SQL push-down: the diff adds no query, no id materialisation and no join.
  • Author is objectstack-fleet[bot]: no login note owed.

④ Design judgment

The ADR amendment against ruling A: faithful. Sentence by sentence: admitted to the discovery role of the control-plane family and not as a door class; the route and its environment-scoped twin, which is the decision card's own question; the carrier is the sweep row alone; no ALLOW_ROUTES row, with the withdrawn option B's reason (the handler never calls enforceAuth, so a row would change no answer and only add a standing exemption); cloud parity cited; api.enableDiscovery: false unmounts it; the one added anonymous fact named, with the stamp caveat. The status-line entry and the dated note follow the invitation-preview amendment's form, and the note cites the ruling as the seat's record of the maintainer's choice, which is what 7043884056 is. Against its first consumer: os validate --target URL on a booted runtime reads the profile and passes, which is the card's Done-when.

S1 (should-fix) — on a kernel without the approvals plugin, the profile lists approval and approval_revise as allowed, which the published schema says such an environment leaves out.

  • The contract: packages/spec/src/system/restriction-profile.zod.ts puts the two plugin node types in the profile vocabulary so that a profile states whether the environment runs them. Its words: "whether an environment runs them depends on whether it installs that plugin, which is exactly what a profile states"; "which a hosted plan or a self-hosted kernel runs only when it installs the approvals plugin"; and the reader rule "an environment that runs the approvals plugin lists them, and one that does not leaves them out".
  • The code: openRestrictionProfile answers [...RestrictionProfileNodeType.options] on every kernel. @objectstack/rest does not know whether the plugin is composed, and approvals is a requested capability, not an always-on one (packages/core/src/capability-providers.ts; examples/app-crm requires only ui and automation).
  • At the first consumer: judgeNodeType in the CLI judges those two types by this list alone, so os validate --target passes a flow with an approval node against a kernel that has no executor for it (No executor registered for node type, service-automation). The one check the two types were put in the vocabulary for cannot fail on a self-hosted target.
  • Why before landing: the governed note says "a constant open profile". Once that sentence is approved, making the list follow the kernel is a second Tier H amendment.
  • Two ways to close it. (a) Derive the two types from the node types the serving kernel registered and reword the note, since the body is then no longer constant. That adds a second anonymous fact (whether this kernel runs approvals), which ruling A's "an open profile" does not cover as written, so it goes to the approver with this text. (b) Keep the constant body and say so, in the note and in the handler's docblock: the list is the whole vocabulary and is not a statement of which plugins this kernel runs. Then the spec's three sentences above are wrong for the open runtime and need their own spec-lane card.

S2 (should-fix) — through the package's require entry the route answers 503 on every request.

  • servedSpecVersion calls createRequire((import.meta as any).url). @objectstack/rest builds with the shared root tsup.config.ts, which has no shims, and publishes a require condition (dist/index.cjs) that @objectstack/runtime loads on a CommonJS host.
  • Reading, from the published 18.6.0 tarball: the same spelling in loadOpenApiSpec compiles to mod.createRequire(import_meta4.url) under var import_meta4 = {}. createRequire(undefined) throws, the new catch turns that into undefined, the promise is cached, and the route answers 503 SERVICE_UNAVAILABLE for the life of the process. packages/mcp/tsup.config.ts records the same measurement for this shared config and fixed it with shims: true; runtime, metadata-protocol and metadata-core did the same.
  • No test sees it: vitest resolves the import condition, and check-dual-build-cjs-loads probes behaviour only where a probe is declared.
  • To close it: give the manifest read an anchor that holds in both formats (the shim, or the __filename fallback other packages use), and pin the 503 branch and the served version so the two formats cannot part again. loadOpenApiSpec on main has the same shape and is outside this diff: a card for the server lane.

Nits, none of which moves this head by itself:

  • Nit a. The closed set is an inline []. Every other call site, the two empty sets included (META_ITEM_REFERENCES_PARAMS, META_ITEM_PUBLISHED_PARAMS), names an exported constant, which is the spelling AGENTS.md route rule 5 gives.
  • Nit b. Two texts still describe this family without the new route: ADR-0138 criterion 2 ("the discovery documents, at the two spellings") and the invariant in scripts/adr-anchors/packages__rest__src__discovery-routes.ts.json, which lists the file's doors. Worth one clause each on the head that closes S1.
  • Nit c. Two things the CLI prints for this route, both outside this diff and both a CLI-lane card. It glosses a 404 as "no environment is served at this host", which is the cloud meaning; against a self-hosted runtime with discovery off, a moved base path or an older release that misdiagnoses. And it reads an error code only at the nested error.code, while sendDeclaredFault sends this 503 in the flat dialect (error a string, code beside it), so the 503 prints without its code. The route's 400 is nested.

S1 and S2 are open on this head. The head that closes them owes a delta read.

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

VERDICT: PASS

@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Nov 21, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Final green head (r3, seat contract-review S1 + S2): e5488dde6262a8ce001244a3e299d6519b404750 · 2026-11-21T13:22Z

  • r3 adds two commits on 12e4aa0a: +98 / -12 across 8 files. Claim amendments: 3 (7062738586) and 4 (7063182125, which covers packages/rest/package.json and scripts/check-dual-build-cjs-loads.mjs). The os-dev report is on mcp: the server states its authoring contract version, refuses a client on a different major, and serves the restriction profile #34774.
  • S1, route (b): the body is unchanged and constant. The ADR-0138 D2 note and the openRestrictionProfile docblock state that nodeTypes is the whole vocabulary, not this kernel's plugin composition. The spec follow-up is spec: an open self-hosted restriction profile always lists approval / approval_revise, so os validate --target cannot tell whether the kernel runs the approvals plugin #36081.
  • S2: a package tsup.config.ts with shims: true, which also repairs loadOpenApiSpec. New pins: a 503-branch test and a check:dual-build-cjs-loads behaviour probe on @objectstack/rest. Ablation, dropping the shim: require answered 503 while import answered 18.6.0, so the probe went red.
  • Nits a and b are done. The PR body carries a "Version disclosure" paragraph with a major.minor OPTION that is not implemented; the seat decides.
  • Local at this head: rest 425 files / 8676 tests pass, and rest typecheck passes. dispatch-gates: 85 of 115 run, 84 exit 0, 1 PREREQUISITE (the full dual-build scan); 30 NOT MEASURED (stopped for the handover). CI covers those.
  • CI: 42 success, 18 skipped, 0 failed, 0 pending.
  • check-governed-merges: GOVERNED (ADR-0138), Tier H. Next: L1-a delta, the seat's delta read, then an authorized APPROVED review; the seat lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5

L1 verdict (L1-a): REWORK (one changeset sentence, text only) at head e5488dde6262a8ce001244a3e299d6519b404750 (Fixes #34774, face 3). Delta read 12e4aa0aa3..e5488dde62 (2 commits, 8 files, +98/-12), on top of the L1 ACCEPT 7062492565, against S1/S2 of record 7062697033.

席位核对

Shape and gates. l1-face --pr 35887 at e5488dd: nothing flagged. Check-runs: 42 success, 18 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check success. @objectstack/rest is public (files: dist, README.md, CHANGELOG.md) and the changeset lists it. Tier H (ADR-0138), so the seat lands it.

S1, route (b): closed. The body stays constant. The openRestrictionProfile docblock, the ADR-0138 D2 note and the changeset each say that allowedFlowNodeTypes is the whole vocabulary, approval / approval_revise included, and not a statement of which plugins the kernel runs. The spec-side reader rule is card #36081 (open, domain:spec). Nit b is done too: ADR-0138 criterion 2 and the adr-anchors invariant now name the route.

S2: closed in code.

  • packages/rest/tsup.config.ts is the root tsup.config.ts line for line, plus shims: true and its reason. package.json build now runs the package config. The exports map (import → index.js, require → index.cjs) is unchanged.
  • The anchor fix covers both readers: servedSpecVersion (discovery-routes.ts:519) and loadOpenApiSpec (rest-server.ts:5355). The second is published on main, and its catch logs and returns null, so the OpenAPI claim in the changeset is real.
  • 503 pin: the new test mocks module's createRequire (the module both readers import) to refuse @objectstack/spec/package.json, and asserts status 503, code: 'SERVICE_UNAVAILABLE' (the flat dialect of sendDeclaredFault) and no data. L1 note N1 from the first read is closed.
  • Cross-format pin: check-dual-build-cjs-loads gets a @objectstack/rest behaviour probe through the public RestServer, with an optional call and a self-test case (battery 5 → 6) that shows a call probe still catches a disagreement. The report's ablation (no shim: require 503, import 18.6.0) is the positive control.
  • Nit a: the closed set is now the exported RESTRICTION_PROFILE_PARAMS.

REWORK item R1 (.changeset/34774-restriction-profile-route.md, last bullet). Two parts of the sentence are not accurate as a release note:

  • "Its import.meta.url compiled to an empty object" is wrong. esbuild empties import.meta (var import_meta = {}), so import.meta.url is undefined and createRequire(undefined) throws. That is what the tsup.config.ts comment and record S2 say.
  • "so this route answered 503 on every request" describes a route that is new in this same note and never shipped. The fix a reader of a release can see is loadOpenApiSpec.
  • Suggested wording: "- fix(rest): the CommonJS build (require('@objectstack/rest')) now resolves package manifests as the ESM build does. esbuild emptied import.meta in that build, so loadOpenApiSpec could not read the static OpenAPI artifact, and the new restriction-profile route would have answered 503 there; the package now builds with tsup's shims."
  • Text only, so the next head owes a delta read of that one file. The contract delta can read the same head.

Not L1's: the version-disclosure OPTION in the PR body (not implemented). It goes to the seat for a Fable-evaluated recommendation, per the area order. On merge, close #35848 with a pointer (L1 note from 7062492565).


Generated by Claude Code

The last bullet said the CJS build's import.meta.url compiled to an
empty object and that the new route answered 503 on every request.
esbuild empties import.meta itself (url is undefined, createRequire
throws), and the route never shipped; the visible fix is loadOpenApiSpec.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Final green head (r4, L1 R1, area a4-C under re-claim 7065083442 and amendment 5 7065213736 on #34774): f6ba0eb6233b9252fcaa9549afe56d120ec11a9f · 2026-11-21T16:43Z

  • r4 is one commit on e5488dde62: .changeset/34774-restriction-profile-route.md, 1 line replaced (the fix(rest) bullet), with L1-a's suggested wording of 7065188136 word for word; the dev checked each clause against tsup.config.ts, loadOpenApiSpec and servedSpecVersion at the head. No code, test or ADR line moved. The os-dev report is 7065374037.
  • The version-disclosure option is ruled A (keep the exact version), Ruling-ref mcp: the server states its authoring contract version, refuses a client on a different major, and serves the restriction profile #34774 comment 7065230616; the PR body records it.
  • CI at this head (pr-state): 40 success, 16 expected skip, 0 failed, 0 pending; mergeable_state clean.
  • Owed next: L1-a delta of the one file, the area's contract delta at CONTRACT_REVIEW_TIER (S1/S2 of 7062697033 and this head), then the seat's hand-over to approvers (Tier H, ADR-0138).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5

L1 verdict (L1-a): ACCEPT at head f6ba0eb6233b9252fcaa9549afe56d120ec11a9f (Fixes #34774, face 3). This is a delta read of e5488dde62..f6ba0eb623: one commit, one line of .changeset/34774-restriction-profile-route.md, closing R1 of my REWORK 7065188136. That record's reading of S1, S2 and the code stands, because no code moved.

席位核对

  • R1, closed. The changeset's last bullet now reads "esbuild emptied import.meta in that build, so loadOpenApiSpec could not read the static OpenAPI artifact, and the new restriction-profile route would have answered 503 there".
    • The mechanism is now right: var import_meta = {}, as the packages/rest/tsup.config.ts comment and record 7062697033 S2 describe.
    • The release-visible fix is loadOpenApiSpec. It is published on main, and its catch logs and returns null.
    • The new route's 503 is now framed as what would have happened, not something that shipped.
  • Gates at f6ba0eb. l1-face is CLEAN: 13 items, none flagged. Check-runs: 40 success, 16 expected skip, 0 failed, 0 pending. mergeable_state is clean.

Landing (not L1's):


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Contract-review-claim: session_01FEkQ5miLqNucRZevceHwNh · head f6ba0eb · 2026-11-21T16:45Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f6ba0eb6233b9252fcaa9549afe56d120ec11a9f
Local-runs: none
Scope: docs/adr/0138-guest-model-anonymous-principal-doors-grants-and-organization.md + packages/rest/src/discovery-routes.ts, packages/qa/dogfood/test/anonymous-door-sweep.classification.ts, packages/rest/src/rest-route-ledger.ts, packages/rest/tsup.config.ts, packages/rest/package.json, scripts/check-dual-build-cjs-loads.mjs, scripts/adr-anchors/packages__rest__src__discovery-routes.ts.json, packages/rest/src/discovery-schema-conformance.test.ts, packages/rest/src/rest-config-mount-table.pin.test.ts
Security-touching: yes
Rule-change-verified: none

Delta round on top of the full record 7062697033 (head 12e4aa0aa3, PASS with S1 and S2 open). Read: the delta 12e4aa0aa3..f6ba0eb623 (3 commits, 8 files, +98/-12), the net diff against main (11 files, +268/-13), card #34774 with every comment, PR #35887 with every comment, ruling A on #35848 (7043884056), ruling A on the version level (7065230616), the cited code in this head's tree, and the head's check-runs (40 success, 16 expected skip, 0 failed, 0 pending). Nothing was built or run. One check-run log was read: the Build Core job at this head.

Result: the delta closes S1 and S2, introduces no new graded finding, and every governed and implementing file still holds. The sweep classification, the ledger row and the mount-table pin did not move in the delta; their judgments are carried from 7062697033.

① Derived judgments

  • Who may read, and what is answered: unchanged by the delta. The handler still has no enforceAuth, takes no input, and answers the same constant body. The only handler change is the closed set's spelling: the inline empty array became the constant RESTRICTION_PROFILE_PARAMS, also empty. The 200 body, the 400 and the 503 are byte-for-byte what 7062697033 judged. Security-touching: yes is meant, because the net diff decides what answers without a credential; the delta adds no anonymous fact.
  • No new package export. RESTRICTION_PROFILE_PARAMS is exported from discovery-routes.ts only. packages/rest/src/index.ts does not re-export that module, and rest-server.ts imports only the two registrars and their host types from it. The published exports map is unchanged.
  • The require entry now serves the route: right. packages/rest/tsup.config.ts is the root tsup.config.ts setting for setting (entry, splitting, sourcemap, clean, dts, format, target, esbuildOptions) plus shims: true. The build script drops --config ../../tsup.config.ts, so tsup reads the package file, the same spelling @objectstack/mcp and @objectstack/metadata-protocol use. The package source reads import.meta in exactly two places, servedSpecVersion (discovery-routes.ts:519) and loadOpenApiSpec (rest-server.ts:5355), and names no __dirname or __filename, so the ESM output's behaviour is not changed by the shim.
  • The same change alters one published behaviour on main: right, and declared. Through the require entry loadOpenApiSpec could not resolve the static OpenAPI artifact; it now can. That is a repair of a shipped defect, and the changeset says so.
  • The gate change: right. runBehaviourProbes takes an optional call, a function source, and awaits the answer in both formats. The existing @objectstack/metadata-core probe goes through the same wrapper with an unchanged result. A throw or a rejection exits non-zero and is reported as "threw"; an answer that never arrives prints nothing, which fails the comparison with the expectation. No path turns a broken probe into a pass.
  • Sweep row, ledger row, api.enableDiscovery unmount, wire against the CLI reader: unchanged in the delta, carried from 7062697033.

② Semver level

'@objectstack/rest': patch still matches what the diff publishes: one new route on a path nothing served, one repaired defect in the CommonJS build, no export, schema, error code or default moved. Clause-②: yes — widening is correct and is in both the PR body and the changeset, with Metadata-protocol: none; Check Changeset and the PR-body guards are green at this head.

The changeset text, read against the tree:

  • The node-type bullet matches openRestrictionProfile and the ADR note.
  • The fix(rest) bullet (the one line of e5488dde62..f6ba0eb623) is accurate clause by clause: esbuild empties import.meta in the CommonJS bundle; loadOpenApiSpec is the reader a release could see fail; the new route "would have answered 503 there", stated as what would have happened and not as something that shipped.

③ Boundary flags

  • Dev report 7063154772: open_questions empty; security_findings: none, which this read agrees with. Its three deviations are accepted. The package.json build line and the call field in the gate script were outside amendment 3's surface and are admitted by amendment 4 (7063182125). The PR-body ordering is not a contract matter. Its remaining list (30 local gates not run, the full dual-build scan not measured locally) is answered by the check-runs on this head, below.
  • Dev report 7065374037: open_questions empty. Six whole-tree gate families were left to CI; CI is green at this head. The commit-message amend was on an unpublished tip. Accepted.
  • Claim amendments 3, 4 and 5 against the delta's file list: every file the delta touches is named by one of them (amendment 3: tsup.config.ts, the adr-anchors file, the probe declaration, ADR criterion 2, plus the route and its tests from amendment 2; amendment 4: package.json and the gate script; amendment 5: the changeset). No file is outside the claimed surface.
  • Version-disclosure option: closed as ruled A (7065230616). versions.spec and versions.skills stay the exact resolved @objectstack/spec version, also where OS_RUNTIME_VERSION is set. The tree does that: nothing in servedSpecVersion reads the stamp, and no line of it moved since e5488dde. The ADR note already states the consequence ("unless an operator stamp replaces it").
  • The dual-format pin's first CI reading: Build Core at this head ran pnpm check:dual-build-cjs-loads: self-test 94 cases pass, then "124 published require entry point(s) across 72 package(s) load … 2 cross-format behaviour probe(s) agree". So both formats served the installed spec version from the built dist. The 503 pin ran in Test Core (10 of 10 shards success).
  • The anonymous-door sweep still runs on merge_group and push only. Its file did not change in the delta; its reading stays the dev's local run recorded in 7045443677 and 7062434049, and the queue run is its first CI reading.
  • SQL push-down: the diff adds no query, no id materialisation and no join.

④ Design judgment

S1: closed. Route (b) of 7062697033, as amendment 3 chose. The body is still the constant open profile that ruling A on #35848 admitted, and three texts now say what the list means:

  • the dated D2 note in ADR-0138: allowedFlowNodeTypes is the profile's whole node-type vocabulary, approval / approval_revise included, and 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 openRestrictionProfile docblock, in the same words;
  • the changeset, for the reader of a release.

Each sentence is true against the code: the handler answers [...RestrictionProfileNodeType.options] on every kernel, and the CLI judges the two types by that list alone. The spec-side reader rule ("an environment that runs the approvals plugin lists them, and one that does not leaves them out", restriction-profile.zod.ts:215-217) is still on main and is carried by spec-lane card #36081, which the L1 record 7065188136 reads as open; this review did not open that card. Why (b) holds against the scenario: deriving the list per kernel would add a second anonymous fact that ruling A does not cover. One thing for the approver to know: until #36081 lands, the published spec text and this route disagree on those two types, and a release that ships the route before #36081 ships that disagreement. This is not graded against this PR; the ADR note and the changeset both state it.

S2: closed. Each part 7062697033 asked for is in the tree and has a reading:

  • The anchor holds in both formats (shims: true, ① above), and it also repairs loadOpenApiSpec.
  • The 503 branch is pinned: a fresh module graph with module's createRequire refusing only @objectstack/spec/package.json yields status 503, the flat code: 'SERVICE_UNAVAILABLE' and no data. The pin cannot pass for the wrong reason: if the mock did not reach the handler, or the branch were removed, the answer would be 200.
  • The served version is pinned across formats: the @objectstack/rest probe drives the route through the public RestServer from dist/index.cjs and dist/index.js and requires both to equal the installed @objectstack/spec version. The new self-test case shows a call probe still catches a disagreement, and the dev's ablation (shim removed: require said status 503, import said 18.6.0) is its positive control. Green in Build Core at this head.

New in the delta. No must-fix, no should-fix.

File by file:

  • docs/adr/0138-…md: the note is still faithful to ruling A on Decision: may a self-hosted server serve the restriction profile without sign-in? (ADR-0138 D2 amendment for GET /discovery/restriction-profile) #35848 (role, twin, carrier, no ALLOW_ROUTES row, cloud parity, the unmount switch, the one added fact), now with the vocabulary sentences. Criterion 2's discovery item names the route with a valid anchor (packages/rest/src/discovery-routes.ts#registerDiscoveryEndpoints). Against the first consumer: os validate --target on a booted runtime reads the profile and passes (the dev's real-boot reading in 7045443677; no handler line that decides the 200 body has moved since).
  • packages/rest/src/discovery-routes.ts: agrees with the note sentence by sentence; the closed set is a named constant, as AGENTS.md route rule 5 spells it.
  • packages/rest/tsup.config.ts, packages/rest/package.json: agree with each other and with the comment's claim; the comment names both readers and the probe that holds the line.
  • scripts/check-dual-build-cjs-loads.mjs: the probe declaration, the call field, the self-test case and the battery floor 5 to 6 agree; the type comment lists call.
  • scripts/adr-anchors/packages__rest__src__discovery-routes.ts.json: the invariant names the route and says it is anonymous by the dated D2 note; the default-deny sentence after it still speaks of the OpenAPI door only.
  • discovery-schema-conformance.test.ts: the 200 and 400 cases are unchanged; the 503 case is judged above.
  • Sweep classification, ledger row, mount-table pin: unchanged in the delta, carried from 7062697033.

Nits, none of which moves this head:

Implemented-by: claude/area-a4C-34774-face3
Reviewed-by: session_01FEkQ5miLqNucRZevceHwNh

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

席位核对

Awaiting a governed merge · 2026-11-21T16:52Z · head f6ba0eb6233b9252fcaa9549afe56d120ec11a9f

@objectstack-fleet objectstack-fleet Bot added pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue security labels Nov 21, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 21, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue security 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.

mcp: the server states its authoring contract version, refuses a client on a different major, and serves the restriction profile

3 participants