Repository navigation
feat(rest): serve the anonymous restriction profile os validate --target reads (ADR-0138 D2 amendment) - #35887
Conversation
…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
📓 Docs Drift CheckThis PR changes 1 package(s): 12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 19 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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
|
|
repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz Final green head (r2, main merged; resume after the p1-only release):
|
|
repo:objectstack#4 · os-elon-musk · session_016WV4cyFzxtKk2q3dE8qte3 L1 verdict (L1-a): ACCEPT at head 席位核对Shape and gates. 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 ( The ruling, against the diff. Ruling A on #35848 (7043884056) says: sweep row only, no
The wire matches the CLI reader. Tests (ADR-0112 envelope). The new conformance block drives the real registered handler on both mounts (base and Changeset, sentence by sentence: the route path, the Non-blocking notes:
Landing: Tier H ( Generated by Claude Code |
|
repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF Contract reviewServed-tier: Full round, ① to ④, on the ADR face ( 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
② Semver level
③ Boundary flags
④ Design judgmentThe 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 S1 (should-fix) — on a kernel without the approvals plugin, the profile lists
S2 (should-fix) — through the package's
Nits, none of which moves this head by itself:
S1 and S2 are open on this head. The head that closes them owes a delta read. Implemented-by: VERDICT: PASS |
…ormat pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
|
repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz Final green head (r3, seat contract-review S1 + S2):
|
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5 L1 verdict (L1-a): REWORK (one changeset sentence, text only) at head 席位核对Shape and gates. S1, route (b): closed. The body stays constant. The S2: closed in code.
REWORK item R1 (
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
|
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):
|
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5 L1 verdict (L1-a): ACCEPT at head 席位核对
Landing (not L1's):
Generated by Claude Code |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh Contract-review-claim: session_01FEkQ5miLqNucRZevceHwNh · head f6ba0eb · 2026-11-21T16:45Z |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh Contract reviewServed-tier: Delta round on top of the full record 7062697033 (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
② Semver level
The changeset text, read against the tree:
③ Boundary flags
④ Design judgmentS1: 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:
Each sentence is true against the code: the handler answers S2: closed. Each part 7062697033 asked for is in the tree and has a reading:
New in the delta. No must-fix, no should-fix. File by file:
Nits, none of which moves this head:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv 席位核对Awaiting a governed merge · 2026-11-21T16:52Z · head
|
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
维护者速读
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.packages/rest/src/discovery-routes.ts):GET {basePath}/discovery/restriction-profile, ported unchanged in behaviour from the parked branchclaude/area-a4C-34774-route@c7890e5b(main had not moved the four files since that branch's base). It is anonymous (noenforceAuth, as/discovery), refuses every query parameter (refuseUnknownQueryParams(req, res, [])→ 400VALIDATION_ERROR), answers 503SERVICE_UNAVAILABLEwhen the@objectstack/specmanifest cannot be read, serves{ success: true, data }withdataan openRestrictionProfileSchemavalue andversions { spec, skills }, and is mounted insideregisterDiscoveryEndpoints, soapi.enableDiscoverygates it. The docblock is corrected per review note N4 of 7038862149: the anonymous peer is/discovery'sversion, not the MCPinitializetext, and it now cites the ADR-0138 D2 amendment.REST_ROUTE_LEDGERrow (family: 'discovery',disposition: 'server-only'; the CLI reads it, not@objectstack/client).rest-config-mount-table.pin.test.ts,api.enableDiscoveryoff 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.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'sdiscoveryrow only, noALLOW_ROUTESrow, because the handler never callsenforceAuth); says what it serves (a constant open profile; the one added anonymous fact is the spec version, which/discovery'sversionstates too unless an operator stamp replaces it); gives the reason (os validate --target URLwithout 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-indexexit 0; the index row shows the status line's opening only).packages/qa/dogfood/test/anonymous-door-sweep.classification.ts): thediscoveryoutside family'srouteIs(…)gainsGET /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/34774-restriction-profile-route.md:'@objectstack/rest': patch.@objectstack/dogfoodis private, so it takes none.Clause-② reading
yes — widening. The diff adds one GET route at a path nothing served before (the CLI'sRESTRICTION_PROFILE_ROUTEgot 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 publishedexports, spec shape or authorable key changes, soMetadata-protocol: noneandpatch.Tests
rest: full suite, typecheck, and the three route files at ccc73c8
pnpm --filter @objectstack/rest test(under the verify lock, after a fullpnpm build):Test Files 424 passed (424),Tests 8648 passed | 351 skipped (8999); lockVERDICT command-exit 0.pnpm --filter @objectstack/rest --filter @objectstack/dogfood typecheck: lockVERDICT command-exit 0(rest'stsc --noEmitpluscheck:test-typecheck; dogfood'stsc --noEmit).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); lockVERDICT command-exit 0. This is the merge-group battery file that review F1 said would go red; PR CI skips it.scripts/ablation-replace.mjsreplaced the newrouteIskey with an unmatched one (anchor x1 → x0, blob8f35c855bae2→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 == HEAD8f35c855bae2,git diff HEADempty. 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.Verification
Real boot (after a full
pnpm build, the way round 1 did):pnpm dev:crm -- --fresh -p 38775, thencurl 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"}}};?x=1→HTTP 400; control: anonymousGET /api/v1/data/account→HTTP 401;os validate --target http://127.0.0.1:38775inexamples/app-crm→ exit 0, printedTarget profile: http://127.0.0.1:38775/api/v1/discovery/restriction-profileand✓ 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) andcurl -i http://127.0.0.1:PORT/api/v1/discovery/restriction-profilewith no credential. Expect 200 and the open profile with the spec version.Read first, by risk:
docs/adr/0138-…md, the new dated note under D2: the governed text, and the carrier statement (sweep row only, noALLOW_ROUTES).packages/rest/src/discovery-routes.ts, the route handler: noenforceAuth, the empty closed query set, the 503 branch.packages/qa/dogfood/test/anonymous-door-sweep.classification.ts, thediscoveryrow.Gates at ccc73c8
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 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-testfirst exited 3 (PREREQUISITE NOT MET: its pinned control commit621a4876was not in this shallow clone); aftergit fetch --depth=1 origin 621a4876…it exited 0 with "48 cases pass", and that exit is the one recorded.--ranreconciliation: "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).test:repoand the full CI farm; CI owns them.Acceptance notes
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.discoveryoutside family keeps noexpectpredicate: 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.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.
openRestrictionProfilenow say plainly:allowedFlowNodeTypesis the profile's whole node-type vocabulary, the approvals plugin'sapproval/approval_reviseincluded. It is not a statement of which plugins this kernel runs, soos validate --targetagainst 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.packages/rest/tsup.config.ts: the shared root config's settings unchanged (same entry, formats, dts, target, sourcemap, sources-content drop), plusshims: true, with a LOAD-BEARING comment in the shape ofpackages/mcp/tsup.config.ts.packages/rest/package.json'sbuildscript drops--config ../../tsup.config.tsso tsup reads the package config (one line; without it the new file would never be read). Measured on the rebuiltdist/index.cjs: 0 occurrences of an emptiedvar import_meta = {}(was 2 under the ablation below), and thegetImportMetaUrlshim is present. This also repairsloadOpenApiSpecinrest-server.ts, which spells the samecreateRequire(import.meta.url)and could not read the static OpenAPI artifact through therequireentry. The changeset says both.vi.resetModules) withmodule'screateRequirefailing only for@objectstack/spec/package.json→503,code: SERVICE_UNAVAILABLE(the flatsendDeclaredFaultdialect), nodata. (b) Both formats: a secondcheck:dual-build-cjs-loadsbehaviour probe, on@objectstack/rest, serves the route through the publicRestServerfromdist/index.cjsanddist/index.jsand requires both to answer the installed@objectstack/specversion. The probe table gains an optionalcall(a function source, awaited), with one new self-test case; the AGREES battery floor moves 5 → 6.RESTRICTION_PROFILE_PARAMS, an exported empty closed set, replaces the inline[]. (b) ADR-0138 criterion 2's discovery-documents item and thediscovery-routes.tsanchor invariant now name the route.Version disclosure.
/discoveryanswers its anonymousversionas theOS_RUNTIME_VERSIONstamp when one is set, otherwise the@objectstack/metadata-protocolpackage version.@objectstack/metadata-protocoland@objectstack/specare in onefixedchangeset 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 (/discoverythen saysunknown, and this route answers 503). With a stamp set, they differ: this route exposes the exact@objectstack/specversion, which/discoverydoes 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.skillsstay the exact resolved@objectstack/specversion, as implemented. Trimming to major.minor was not chosen:RestrictionProfileSchemarequires SemVer 2.0.0 andrestrictionProfileVersionDriftcompares by string equality, and an operator who wants the route hidden already hasapi.enableDiscovery: false. No docs sentence aboutOS_RUNTIME_VERSIONis added.Round 3 verification
At head
e5488dde62, underscripts/pm/os-verify-lock.sh: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; oneVERDICT command-exit 0for both.4a4e4685(expected undefined to be false): it assertedsuccess: false, which the flatsendDeclaredFaultdialect does not send. It now assertscode: SERVICE_UNAVAILABLEand nodata; fixed ine5488dde62.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 exportedrunBehaviourProbeson the two built entries it names (@objectstack/rest,@objectstack/metadata-core):findings: [], ran: 2. The full scan is CI's reading.scripts/ablation-replace.mjs --deleteon theshims: 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 indist/index.cjs; the probe went red:the two formats DISAGREE — require said 'status 503', import said '18.6.0'. Restored: blob == HEADa87f404dab54,git diff HEADempty; rebuilt; preflight (present mode) → marker indist/index.cjs, tree clean; probefindings: []. The preflight's tree reading refused on the mutate leg (the source spellsshims: true, the dist marker differs); the dist reading is the one recorded.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackate5488dde62derived 115 commands. 85 were run, exits captured per command: 84 exit 0 (among themcheck: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-gatesthroughcheck:workspace-manifest-cyclesin derivation order), stopped at the maintainer's handover order: NOT MEASURED, CI's reading.