Repository navigation
fix(runtime)!: an action route runs the handler of the item whose declaration it gated on - #34734
Conversation
…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>
📓 Docs Drift CheckThis PR changes 1 package(s): 20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 30 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 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
|
…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>
…r attribution Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…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>
|
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 reviewServed-tier: Delta record: it judges
① Derived judgments
② Semver levelUnchanged and correct:
The narrowing's stated extent now matches what is enforced. ③ Boundary flags
④ Design judgmentThe 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.
Implemented-by: VERDICT: PASS |
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill under
skills/**and no hand-written page undercontent/docs/**teaches which handler runs when two package-less owners register one under an action's key.维护者速读
actions里的那一份,或嵌在存储对象行中),只要环境槽位里有为它绑定的处理器,就运行该处理器;派发那一刻该处理器已不在,则按路由既有的"未找到"作答(404),不运行任何其他处理器。平台动作的键上若压着一个来源已不存在的环境处理器,则运行该键下唯一的共享处理器。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_envaddress, MCPrun_actionand a host'sdispatchAction. For a script dispatch whose declaration names no package,attributeActionHandler(action-execution.ts) attributes the handler to a holder:actionsby 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.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:
executeAttributedAction), so the handler that runs is the one the choice read. The owner gate judges the attributed coordinate.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 refused503(ADR-0110 D3) and runs nothing.packages/objectqlis not changed.Tests
One top-level describe in
packages/runtime/src/action-package-addressing.test.tsholds 20 cases, on the file's shared harness. Real:ObjectQL(registry and action engine), the protocol's execution read and merged listings, the runtime'sHttpDispatcher/actionsdoor, the MCPrun_actiondoor 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./actions/lead/approveand/actions/_env/lead/approve. The environment's own handler runs (200). A caller the environment's declaration refuses gets 403, and no handler runs.actions. Host code and a plugin each, at/actions/lead/approve,/actions/_env/lead/approveand MCPrun_action: the environment's own handler runs.Acceptance notes
bodyof its own, or abodyno handler is bound for;Verification
Readings were taken on head
1103a1208cunless a line names another commit.Runtime typecheck, eslint and full suite
pnpm --filter @objectstack/runtime typecheck:VERDICT command-exit 0.eslint --no-inline-configon the three changed runtime files: exit 0, no problem. Control: the same command overaction-dispatch.tsat1a6a802bb6reports1 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 testunder 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 HEADempty.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 69 commands at1103a1208c; each was run with its exit code captured before any pipe. 67 answered exit 0 in the sweep.check:type-check-debtanswered 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-loadsanswered exit 3, PREREQUISITE NOT MET, which is NOT MEASURED (it reads every package'sdist/, and only the runtime and dogfood closures are built here); CI runs it. The--ranreconciliation 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 on1103a1208c: the@objectstack/dogfood^...closure was built, thenpnpm --filter @objectstack/dogfood testran 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_createwas refused by its session's permission check.