Skip to content

fix(runtime): mount every /api/v1/keys verb so an anonymous caller is answered 401 on the standalone server - #24009

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-23909-keys-every-verb
Oct 16, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-23909-keys-every-verb

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #23909

Clause-②: no

Basis for the Clause-② line: no request that was accepted becomes refused, and none that was refused becomes accepted. An anonymous non-POST call to /api/v1/keys was refused 405 and is now refused 401. A signed-in one was refused 405 and still is, now in the dispatcher's standard envelope instead of the adapter's. The 401 is already published text: changeset 23225-domain-floor-anonymous-deny (in .changeset/pre/ for v18) says "/keys: 401 UNAUTHENTICATED for every verb. A verb other than POST used to be answered 405 to an anonymous caller; a signed-in caller still gets the 405."

The route ledger (seat ruling 6222005517)

The four new mounts are ledgered as four exact server-only rows, GET, PUT, PATCH and DELETE /keys. Their note says they are refusal-only: the anonymous floor answers 401, and a signed-in caller gets the domain's 405. The census count moves 88 → 92. There is no wildcard row: no /keys sub-path is mounted. route-ledger-live-mount-parity.dogfood.test.ts is 8/8 locally at 5e3b39fcd. It was 7/8 at 41fc6bb39, where "every mounted route is ledgered" failed on these four mounts; the dogfood shards do not run on a PR. The claim's original "no new row" line was wrong, because #7649's /mcp/skill was covered by the * /mcp/** wildcard; the correction is 6222005517 on the card.

What changed

  • packages/runtime/src/dispatcher-plugin.ts: GET, PUT, PATCH and DELETE are mounted on ${prefix}/keys beside the unchanged POST, each dispatching its own method to /keys, in the shape of the /mcp and /mcp/skill helpers above it. The comment says why (the domain's floor answers only a verb that reaches it, precedent mcp-http-surface (a): POST /api/v1/mcp/skill returns a hand-rolled 405 envelope, not the standard API error shape #7649) and that the PUT and PATCH mounts are not wrapped by the per-route instrumentation, like the other PUT/PATCH mounts in the file.
  • packages/runtime/src/dispatcher-plugin.routes.test.ts: the /keys expectation goes from POST alone to the five verbs.
  • packages/runtime/src/keys-every-verb.hono.integration.test.ts (new pin): a real Hono socket. For each anonymous non-POST verb it asserts status 401, error.code UNAUTHENTICATED, error.httpStatus 401 and no error.details. For each signed-in non-POST verb it asserts 405, METHOD_NOT_ALLOWED, error.httpStatus 405 and no error.details. That last pair tells the domain's answer from the adapter's, which fills details and no httpStatus. Anonymous POST is the unchanged control.
  • .changeset/23909-keys-every-verb-anonymous-floor.md: @objectstack/runtime patch.

Not touched, as ruled: domains/keys.ts, the observability Proxy's verb list, plugin-hono-server/src/adapter.ts, the /notifications and /share-links mounts, and docs/qa/. route-ledger.ts gains the four rows above, by the seat's corrected ruling.

Measured on a live boot

Stock showcase, pnpm dev -- --fresh -p PORT, built from base f901746ac and from head 41fc6bb39; signed in as the seeded admin.

call base head
anonymous GET / PUT / PATCH / DELETE /api/v1/keys 405 METHOD_NOT_ALLOWED, Allow: POST, adapter body {"success":false,"error":{"code":"METHOD_NOT_ALLOWED","message":"GET is not supported for /api/v1/keys. Allowed: POST.","details":{...}}} 401 UNAUTHENTICATED, {"success":false,"error":{"code":"UNAUTHENTICATED","message":"Authentication is required to access this endpoint.","httpStatus":401}}
signed-in GET / PUT / PATCH / DELETE /api/v1/keys 405, Allow: POST, adapter body 405 METHOD_NOT_ALLOWED, {"success":false,"error":{"code":"METHOD_NOT_ALLOWED","message":"Method not allowed","httpStatus":405}}, no Allow header
anonymous POST /api/v1/keys 401 UNAUTHENTICATED 401 UNAUTHENTICATED (unchanged)
anonymous HEAD /api/v1/keys 405, Allow: POST 401
GET /api/v1/keys/anything (either caller) 404 ENDPOINT_NOT_FOUND 404 ENDPOINT_NOT_FOUND (unchanged)

The cloud-host shape (@objectstack/hono's createHonoApp catch-all, driven in process with app.request over a LiteKernel and a fake auth service, base build) already answered every anonymous verb 401 UNAUTHENTICATED and every signed-in non-POST verb the domain's 405 with no Allow. This PR makes the standalone server answer the same.

Tests

  • Pin + route list, head 41fc6bb39: pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/keys-every-verb.hono.integration.test.ts src/dispatcher-plugin.routes.test.ts → Test Files 2 passed (2), Tests 25 passed (25).
  • Ablation (one-off, not kept): node scripts/ablation-replace.mjs replaced the four mountKeys(...) calls (anchor 1 → 0, marker 0 → 1, blob 05f460424d3c → 89de55c9ef5d). The same run gave Tests 9 failed | 16 passed (25): the 4 anonymous rows failed with expected 405 to be 401, the 4 signed-in rows with expected undefined to be 405 (the adapter's body has no httpStatus), and the route-list case failed. Anonymous POST stayed green. Restore: blob == HEAD 05f460424d3c, git diff HEAD empty. The test imports ./dispatcher-plugin.js from source, so no dist/ sits on its resolution path.
  • pnpm exec turbo run build --filter='@objectstack/runtime...' --concurrency=2 → exit 0. pnpm --filter @objectstack/runtime typecheck → exit 0. pnpm --filter @objectstack/runtime test → exit 0, Test Files 404 passed (404), Tests 6139 passed | 19 skipped (6158).
  • pnpm exec eslint --no-inline-config over the three changed .ts files → exit 0.

Gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 62 commands for this diff. All 62 exit 0 at head 41fc6bb39, and --ran reconciles: 62 derived, 62 run, 0 NOT-MEASURED, 0 UNRUN. Also run, all exit 0: the five roster families whose roster sits under a changed directory (check-changeset-fixed, check:authz-resolver, check:error-code-casing, check:filter-alias-parity, check:route-ledger-census). The repo-wide lint is the PR's Lint & Repo Gates check-run.

Acceptance notes (seen on the way, not changed here)

  • The domain's 405 carries no Allow header. A signed-in non-POST call used to get the adapter's 405 with Allow: POST. Now it gets the keys domain's 405, built through deps.error with no header. The cloud host already answered this way. domains/mcp.ts, domains/meta.ts and domains/ai.ts hand-roll Allow on their 405s; domains/keys.ts and domains/actions.ts do not.

  • PUT and PATCH mounts are not instrumented. On the live head, GET and DELETE /api/v1/keys echo X-Request-Id and PUT and PATCH do not. The observability Proxy wraps only get, post and delete. The other mounts it misses are PATCH on /packages/:id, /packages/:id/enable and /packages/:id/disable, PUT /automation/:name, the PUT and PATCH /ai/* wildcards, and service-emitted PATCH routes through mountRouteOnServer.

  • The same mount gap on sibling doors of the v18 anonymous-floor text, on the standalone server (base and head alike):

    • anonymous DELETE / PUT /api/v1/notifications → 405, Allow: GET, HEAD;
    • anonymous PUT / DELETE /api/v1/share-links → 405, Allow: GET, HEAD, POST;
    • an unserved /api/v1/share-links sub-path → 404 ENDPOINT_NOT_FOUND.

    The cloud-host probe answered 401 for anonymous DELETE /api/v1/notifications and for an unserved /api/v1/share-links sub-path (the other verbs above were not probed there). On the standalone server, /api/v1/share-links is served by plugin-sharing's own routes, not the dispatcher domain, so its anonymous 401 carries that plugin's message and no httpStatus.


Generated by Claude Code

…answers it

The standalone dispatcher mounted ${prefix}/keys for POST alone, so GET,
PUT, PATCH and DELETE never reached the keys domain: the adapter's
unmatched-route 405 answered first, naming the allowed method, to an
anonymous caller too. The four verbs are now mounted and dispatched with
their own method, so an anonymous caller gets the domain's 401
UNAUTHENTICATED and a signed-in one the domain's 405 in the dispatcher's
envelope.

Claude-Session: https://claude.ai/code/session_018t6a5rvqPRvEDMCVVW9kYT
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime, touching 2 documentable anchor(s).

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

  • content/docs/deployment/production-readiness.mdx (via createDispatcherPlugin (symbol, a top-level function))
  • content/docs/plugins/packages.mdx (via createDispatcherPlugin (symbol, a top-level function))
What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 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 — 26 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 92fd343bcf986fbd8c7cbc9a3824d8096573f3d5 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 92fd343bcf986fbd8c7cbc9a3824d8096573f3d5

⚠️ 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 92fd343bcf986fbd8c7cbc9a3824d8096573f3d5 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

GET, PUT, PATCH and DELETE /keys are mounted so the domain's anonymous
floor answers every verb, as the v18 text states. They serve only
refusals, so they are ledgered as exact server-only rows; the census
count moves 88 -> 92.

Claude-Session: https://claude.ai/code/session_018t6a5rvqPRvEDMCVVW9kYT
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · #23909 · domain:cli seat 2 · os-tesla · session session_018t6a5rvqPRvEDMCVVW9kYT · 2026-10-16T19:09Z · reviewed head 5e3b39fcd3d5a73a3f4615498a1a888888158adc, against GitHub and the branch, not against the report's prose. Holder of claim 6220480872 and its correction 6222005517; reports 6221942285 and the addendum on #23909.

  1. Shape.
    • Draft, base main, assignee os-tesla. Line 1 is Fixes #23909; Clause-②: no is in the body and the changeset.
    • 5 files, +210 / −3: dispatcher-plugin.ts, its route-list test, one new pin, route-ledger.ts, and one changeset.
    • check-governed-merges --pr 24009: NOT governed (0 of 5 paths); 213 changed lines.
    • git merge-tree is clean against origin/main. origin/main was merged once, as a real merge commit (b0733b0fb).
  2. The change, read by this seat.
    • mountKeys registers GET, PUT, PATCH and DELETE on ${prefix}/keys. Each dispatches its own method to /keys, beside the unchanged POST, in the shape of mountMcp / mountMcpSkill.
    • The comment says why: a floor answers only a verb that reaches it (mcp-http-surface (a): POST /api/v1/mcp/skill returns a hand-rolled 405 envelope, not the standard API error shape #7649's remedy). It also says the PUT and PATCH mounts sit outside the observability Proxy, as the file's other PUT/PATCH mounts do.
    • domains/keys.ts is untouched; its first statement is already the floor.
    • route-ledger.ts gains four exact server-only rows with a refusal-only note, and the census count 88 → 92, by the corrected ruling. There is no wildcard row.
  3. Review of record: this record. The PR has no contract face: Clause-②: no, no published schema, no governed path.
    • No accept set moves. An anonymous non-POST call was refused 405 and is refused 401. A signed-in one was refused 405 and still is, now in the dispatcher's envelope.
    • The 401 is the published v18 text (changeset 23225).
  4. Changeset: one, '@objectstack/runtime': patch. It states the before and after for an anonymous and a signed-in caller, and that the signed-in 405 now carries no Allow header. That sentence is true, and the header is filed as its own card.
  5. Gates, pinned to the head. Check-runs on 5e3b39fcd3 read at this stamp, latest run per name: 40 names, 34 success, 6 skipped, 0 failure, nothing running.
    • The successes include Build Core, Test Core 1–6/6, TypeScript Type Check, Lint & Repo Gates, Check Changeset and Governed Surface Queue Guard.
    • The 6 skips are roster names: Build Docs, Console Pin Gate, Dogfood Regression Gate (matrix), Dogfood Verify CLI, Packed-tarball smoke and Temporal Conformance.
    • The dogfood parity file does not run on a PR. The dev ran it locally at this head: 8/8, including "every mounted route is ledgered" (7/8 at 41fc6bb39).
    • The dev's local subset at this head: 65 of 65 derived gate commands exit 0 (--ran: 0 NOT-MEASURED, 0 UNRUN). The pin, the route list and the ledger conformance pass 31/31, and the client ledger tests 4/4.
    • At round 1: an ablation of the four mounts reddened the 8 non-POST rows and the route list, while anonymous POST stayed green.
    • Live boot on the standalone showcase, base against head: anonymous GET / PUT / PATCH / DELETE go from 405 + Allow: POST to 401 UNAUTHENTICATED; signed in they go from 405 (adapter) to 405 (domain). The createHonoApp host already answered this way at base.
  6. Accepted deviations:
    • the corrected ledger ruling (rows instead of none);
    • the gate list was derived after the merge;
    • no full runtime suite in round 2: no runtime file changed upstream, and CI's Test Core is green;
    • the worktree was removed and re-added between rounds.

Filed from this card's findings (seat): the 405 with no Allow header (domains/keys.ts, domains/actions.ts), the /notifications and /share-links standalone mounts (one family card), and the PUT/PATCH mounts outside the observability Proxy. The /keys/* sub-path 404 is noted, not filed: no published text promises 401 there.

Landing: pr_ready + automerge_enable through the relay, in this act. The card closes on the merge (Fixes).


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 16, 2026 19:10
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 16, 2026 19:10
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit 9e797a8 Oct 16, 2026
48 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-23909-keys-every-verb branch October 16, 2026 19:33
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

Projects

None yet

2 participants