Skip to content

fix(runtime)!: an action route runs the handler of the item whose declaration it gated on - #34734

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/sec2-8fmv
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/sec2-8fmv

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill under skills/** and no hand-written page under content/docs/** teaches which handler runs when two package-less owners register one under an action's key.

维护者速读

  • 改了什么:一个不指定包的动作声明,其脚本派发运行"路由所校验的那条声明"所属条目的处理器。环境自建的动作(环境存储里有其无包行,可以是独立行、挂在其对象 actions 里的那一份,或嵌在存储对象行中),只要环境槽位里有为它绑定的处理器,就运行该处理器;派发那一刻该处理器已不在,则按路由既有的"未找到"作答(404),不运行任何其他处理器。平台动作的键上若压着一个来源已不存在的环境处理器,则运行该键下唯一的共享处理器。
  • 为什么改:同一次动作调用里,门槛所读的声明与实际运行的处理器必须是同一条目(ADR-0150 D4)。
  • 风险与回滚:只有同一键上存在多于一个无包所有者的处理器时,行为才会变化。包的动作、环境槽位里没有其处理器的环境动作(无 body,或 body 未绑定处理器)、仅由元数据服务提供而无存储行的动作,以及键上只有本条目处理器的动作,一律照旧。回滚即还原 packages/runtime 中的改动。
  • 先看:packages/runtime/src/action-execution.ts 的 attributeActionHandler(判定归属,风险最高)与 executeAttributedAction(同步选定并运行);packages/runtime/src/action-dispatch.ts 的准入与派发;packages/runtime/src/action-package-addressing.test.ts 末尾的 describe。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run --project local src/action-package-addressing.test.ts -t "whose declaration it gated on",预期 20 passed。
  • 需要你做的:无,席位落地。

What changes

The rule: on every action route, the declaration the route gates on and the handler it runs are the same item.

The admitted sequence every action door shares (runResolvedAction) carries the rule: POST /api/v1/actions/:object/:action, its _env address, MCP run_action and a host's dispatchAction. For a script dispatch whose declaration names no package, attributeActionHandler (action-execution.ts) attributes the handler to a holder:

  • The environment's own item. A package-less row the environment's store holds under the action's owner key and name, or an action a stored object row embeds. The row may be standalone, or served inside its routed object's actions by reference. When the environment's slot holds the handler the authored-action resync bound for it, this item runs that handler, whichever owner registered a handler under its key last. When that handler is gone by the moment the call dispatches, the door answers its routing miss, 404 Action 'NAME' on object 'OBJECT' not found, the answer it already gives when no handler is bound, and runs no other handler.
  • A platform item. When the unqualified slot holds a handler of the resync's whose source neither the store nor the metadata service's listing still holds (those are the resync's two sources), a platform item runs the one shared handler under the key: host code's or one plugin's. It is addressed through the engine's package-scoped reach (PLATFORM_DISPATCH_COORDINATE), which never answers the environment's slot or a package's; this route is taken only when exactly one shared handler holds the key.

Further:

  • One synchronous step. An attributed dispatch chooses its handler entry and calls the engine for that entry in one synchronous step (executeAttributedAction), so the handler that runs is the one the choice read. The owner gate judges the attributed coordinate.
  • Reads. The attribution reads only when the answer can change. It reads the store when the environment's slot holds a handler the dispatch reaches while the unqualified slot holds another owner's. It reads the store and the metadata service when the unqualified slot holds the resync's handler beside exactly one shared handler under the same key. The store read is that action name's rows and the routed object's row (environmentStoredActionNames, scoped). The metadata service is read through its listing (loadMany('action')), the read the resync itself takes: the slot contract has no read by owner key and name. A read that fails is refused 503 (ADR-0110 D3) and runs nothing.
  • Unchanged. No error code is added, and packages/objectql is not changed.

Tests

One top-level describe in packages/runtime/src/action-package-addressing.test.ts holds 20 cases, on the file's shared harness. Real: ObjectQL (registry and action engine), the protocol's execution read and merged listings, the runtime's HttpDispatcher /actions door, the MCP run_action door and the shared admitted sequence. Doubled: the row store, the engine's store read, the metadata service where a case names it, and the caller's execution context.

  • 6 door pins: host code and a plugin each holding a handler on the key, with /actions/lead/approve and /actions/_env/lead/approve. The environment's own handler runs (200). A caller the environment's declaration refuses gets 403, and no handler runs.
  • 6 door pins with the routed object registered, the object serving the environment's item inside its own actions. Host code and a plugin each, at /actions/lead/approve, /actions/_env/lead/approve and MCP run_action: the environment's own handler runs.
  • 2 pins: a platform action, beside a handler whose environment item neither source holds any more, runs its own handler and is gated on its own requirements (host code and a plugin).
  • 1 pin: the declared item's handler is withdrawn before the dispatch runs; the call answers 404 and no handler runs.
  • 2 pins: a store read that fails, and a metadata-service read that fails, are refused 503 and no handler runs.
  • 3 controls:
    • the environment's item registered last;
    • a single holder: the environment's item alone, and the platform's item alone under its own requirements;
    • a platform item with no stored row, beside a handler the environment's slot still holds.

Acceptance notes

  • Unchanged by design, and stated at rule level in the changeset, these dispatch as before:
    • a package's action;
    • an environment action whose handler the environment's slot does not hold: one with no body of its own, or a body no handler is bound for;
    • an action whose key holds only its own item's handler.
  • Ownership is read from stored rows alone. An action the metadata service serves with no stored row is the platform's in that test (the classification the route's own holder census applies). Beside a shared handler under its key it keeps its dispatch: the declaration a door resolves carries nothing that tells it apart from a platform item of the same owner key and name.

Verification

Readings were taken on head 1103a1208c unless a line names another commit.

Runtime typecheck, eslint and full suite
  • pnpm --filter @objectstack/runtime typecheck: VERDICT command-exit 0.
  • eslint --no-inline-config on the three changed runtime files: exit 0, no problem. Control: the same command over action-dispatch.ts at 1a6a802bb6 reports 1 problem (1 error, 0 warnings) at 546:23.
  • vitest run --project local src/action-package-addressing.test.ts src/domains/actions-addressed-route.test.ts: Test Files 2 passed (2), Tests 221 passed (221).
  • pnpm --filter @objectstack/runtime test under the shared verify lock: Test Files 611 passed (611), Tests 11358 passed | 19 skipped (11377), VERDICT command-exit 0.
Ablation (one-shot, four legs, at 1103a12)

Each leg went through scripts/ablation-replace.mjs (anchor 1 to 0) and was then restored: blob equal to HEAD, git diff HEAD empty.

  • Leg 1, the attribution: 15 red, 5 green; then restored.
  • Leg 2, the ownership test: 6 red (the registered-object pins), 14 green; then restored.
  • Leg 3, the platform holder: 2 red, 18 green; then restored.
  • Leg 4, the dispatch's entry choice: 1 red, 19 green; then restored.
Gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 69 commands at 1103a1208c; each was run with its exit code captured before any pipe. 67 answered exit 0 in the sweep. check:type-check-debt answered exit 3 there (its closure build got no turn on the shared verify lock while this card's dogfood battery held it), and was re-run under the lock afterwards: check-type-check-coverage --re-measure: OK, VERDICT command-exit 0. check:dual-build-cjs-loads answered exit 3, PREREQUISITE NOT MET, which is NOT MEASURED (it reads every package's dist/, and only the runtime and dogfood closures are built here); CI runs it. The --ran reconciliation over the recorded exit codes: 69 derived famil(ies) accounted for — 68 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).

Dogfood battery

The title carries ! and the declaration a narrowing arm, so the full battery ran once on 1103a1208c: the @objectstack/dogfood^... closure was built, then pnpm --filter @objectstack/dogfood test ran under the shared verify lock. Result: Test Files 478 passed | 3 skipped (481), Tests 4055 passed | 68 skipped (4123), VERDICT command-exit 0.


Generated by Claude Code

Opened by the security#2 seat on the maintainer's explicit approval, after this order's own relay pr_create was refused by its session's permission check.

…m its declaration names

The environment's own action runs the handler in the environment's slot,
whichever package-less owner registered a handler under its key last; a
dispatch whose declared item's handler is gone answers the route's
routing miss.

Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj
Co-authored-by: Claude <noreply@anthropic.com>
…laration it gated on

Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj
Co-authored-by: Claude <noreply@anthropic.com>
…declaration it gated on

Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added 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 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json c513d62acdd342745bbfe29786ba4b644cd934fc.

⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 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 — 30 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 c513d62acdd342745bbfe29786ba4b644cd934fc → packageMentionDocs.

Which tree this was computed on

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

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

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

…he item its declaration names

The environment's own action is judged against its stored row whether it is
standalone, served inside its routed object's actions, or embedded in a
stored object row; one that carries a body runs the handler bound for that
body or answers the routing miss; the platform's action runs the one shared
handler when the handler above it has no source left; and the attribution
reads only the action's own rows.

Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 17, 2026
…ct in the action handler attribution

Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj
Co-authored-by: Claude <noreply@anthropic.com>
…old keeps its dispatch

The attribution reads the store only when the environment's slot holds the
handler the dispatch reaches; the changeset states the enforced composition.

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

Copy link
Copy Markdown
Contributor Author

security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj

The seat adopts the delta record below. It was rendered on this head by the same isolated reviewer at the contract-review tier that recorded the earlier FAIL. The seat holds that FAIL record privately. Mechanism detail stays with the security seat.

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 6eb78901d530900b1b8ba280817853c171c53d9b
Local-runs: none
Scope: packages/runtime/src/action-dispatch.ts, packages/runtime/src/action-execution.ts, packages/runtime/src/action-package-addressing.test.ts + packages/objectql/src/engine-actions.ts, packages/objectql/src/action-handler-coordinate.ts, packages/objectql/src/plugin.ts, packages/objectql/src/registry-object-registration.ts, docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md (cited code and ruling: read, not reviewed)

Delta record: it judges 603928d4a9..1103a1208c against the findings recorded at 603928d4a9.

  • The head 6eb78901d5 is a sync-only merge of main.
  • Its tree equals a clean merge of 1103a1208c with main.
  • The PR's patch-id against main is the same before and after the merge.
  • The four PR files are byte-identical between the two heads.

① Derived judgments

Finding State Closed by
M1 closed action-execution.ts:6305-6315; pins action-package-addressing.test.ts:2249-2291 (bare route, _env address, MCP run_action; host code and a plugin)
M2 closed (option 1) .changeset/action-route-runs-declared-item-handler.md:13-25; PR body "What changes" and "Acceptance notes"; docblock action-execution.ts:6241-6277
S1 closed action-execution.ts:6129, 6193-6195, 6297-6300, 6321-6330; action-dispatch.ts:543-549; pins test.ts:2294-2321
S2 closed by statement action-execution.ts:6264-6268, 6328-6330; changeset line 24; PR body "Acceptance notes"
S3 closed action-execution.ts:6211-6236; action-dispatch.ts:810-814
S4 closed action-execution.ts:5312-5347
  • Doors: REST bare, _env, MCP run_action and a host's dispatchAction still go through one admitted sequence. The patch adds no second path.
  • Fault path: a failed store or metadata-service read during attribution answers 503 and runs nothing. Both reads are pinned.
  • Over-refusal: none introduced, by read. A single holder, a package's action, and a platform action alone dispatch as before.

② Semver level

Unchanged and correct:

  • @objectstack/runtime: patch
  • BREAKING banner
  • one ADR-0087 marker
  • Clause-②: no (narrowing)
  • Metadata-protocol: none
  • a Skills-docs line in both the body and the changeset

The narrowing's stated extent now matches what is enforced.

③ Boundary flags

  • Dev residual (A): stated under "Not moved" in the changeset and the body. It is a declaration-layer question the maintainer has already ruled on; the follow-up is held by the security seat. Not a blocker.
  • Dev residual (B): closed for one shared handler under the key. The body's "exactly one shared handler" covers the rest.

④ Design judgment

The narrowing holds against the code it cites and against ADR-0150 D4. The environment's own item runs its own handler or the routing miss. A platform item no longer runs a handler whose environment item is gone.

  • S5 (should-fix, new, not blocking): a declaration-layer composition. [detail held by the security seat] It is folded into the residual (A) follow-up, not this PR.
  • N1 (nit, carried): an input shape that no door produces today. [detail held by the security seat]
  • N4 (nit): the body's wording on the platform route with two shared handlers. Reworded on this head; the body edit moves no code.
  • N5 (nit): one composition now takes a store read on every dispatch, and it answers 503 during a store outage. This is fail-closed and stated in the body; an operator line in the changeset is a follow-up.

Implemented-by: claude/sec2-8fmv
Reviewed-by: session_01QSeKYn5CmmdShCJifm6WYj

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj

席位核对

ACCEPT · head 6eb78901d530900b1b8ba280817853c171c53d9b · 2026-11-17T12:21Z

  • Shape: 4 files. Not governed: check-governed-merges --pr 34734 hits 0 of 4 paths, and the PR is 592 changed lines, under the human-merge threshold. Clause-②: no (narrowing), Metadata-protocol: none. Patch for @objectstack/runtime, with a BREAKING banner and one ADR-0087 marker.
  • Review: contract tier, by an isolated reviewer.
    • The FAIL at 603928d4a9 is held privately by the seat.
    • The delta PASS on this head is comment 6947874757, with tier evidence.
    • M1, M2 and S1–S4 are closed. S5 and N1 are folded into the residual (A) follow-up, which the security seat holds. N4 was reworded in the body on this head. N5 is a follow-up.
  • Head move: 1103a1208c → 6eb78901d5 is a sync-only merge of main through the relay. The patch-id is unchanged, and the PR files are byte-identical. K = 0.
  • Provenance:
    • Dispatched and L1-read by this seat.
    • The draft PR was opened by this seat on the maintainer's explicit approval, after the order's own relay pr_create was refused.
    • The body was replaced through the relay.
  • Dev evidence: runtime suite 11358 passed, full dogfood 4055 passed, ESLint clean, all on 1103a1208c. The sync merge does not move the PR files.
  • Docs drift: the bot lists name-mentions only; no page states the narrowed rule beyond the changeset and the body.
  • Check-runs at this head (at time of writing): 24 success, 18 skipped, 0 failed, 12 in progress (Test Core 1–9 of 10, Build Core, the consumer type-check gates, the CI/release lint). The merge queue re-runs the required set.
  • Landing: ready, then auto-merge into the merge queue. The advisory closes on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 12:22
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 0ad377c Nov 17, 2026
58 checks passed
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/l 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.

1 participant