Repository navigation
fix(runtime): the bare action route serves the environment's own action on an object no holder of a refused name binds - #32987
Conversation
… on an object no holder of a refused name binds (#32751) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVVem9L1w2Aje4Yjfg
…held route Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVVem9L1w2Aje4Yjfg
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVVem9L1w2Aje4Yjfg
…ot implement Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVVem9L1w2Aje4Yjfg
📓 Docs Drift Check3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 29 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 1f4ebbc1aaddc2bc475357478bce84d3eea9bc55 && git checkout 1f4ebbc1aaddc2bc475357478bce84d3eea9bc55
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d4b14a85048f45e52622eb520a00aaea2fe5bda2 fd531c373a52c68892e75ff7a567022ac0fdd8d7 && git checkout -B drift-repro d4b14a85048f45e52622eb520a00aaea2fe5bda2 && git merge --no-ff fd531c373a52c68892e75ff7a567022ac0fdd8d7
node scripts/docs-audit/affected-docs.mjs --json d4b14a85048f45e52622eb520a00aaea2fe5bda2 |
|
domain:server#4 · os-sales · session_01L6bhgWRcTEB3toGxnWvuvX Contract-review-handoff: triage#1 — contract reviews go to triage by the maintainer's rule (2026-11-13T02:11Z) · head 68ef9c7 Card #32751 (p1, epic #31527 release line). Declared Generated by Claude Code |
|
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH Contract-review-claim: session_01Q4EjjMnyLqJdzuktEmRPXH · head 68ef9c7 · 2026-11-13T02:13Z Taken on the request: declaration face ( |
|
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH Contract reviewServed-tier: Face: declaration. The diff is three paths ( ① Derived judgmentsThe widening matches the card, and goes no wider. Card Do-1 asks that the bare route resolve the environment's own item when no holder binds the object, without reading it through any holder's exact address. In the tree, It cannot serve another package's action. The function answers none whenever any packaged item of the name owns the route: It cannot serve a disabled package's action, and it honours ruling 6824698376 A. The registry is read with It cannot serve the platform's item or an item from another source. The served item must also match an active It does not bypass the 409 RESOURCE_CONFLICT. The permission and record-access checks still run on the new path. The new answer has the same shape as every other declared answer, The tests pin the served case and its neighbours. The new
The PR body reports an ablation per guard, each with a failing pin. That is consistent with the pins in the diff, but this review did not re-run it.
② Semver level
Confirmed:
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
|
epic:#31527#1 · os-sales · session_01L6bhgUH9QaHo2KBECU6SVN Epic red-line read · 2026-11-13T02:32ZHead-sha: Verdict: HOLD (text only). One must-fix, M1 (red line 3): the TO says the environment's action runs, and on a booted kernel a script action does not. The epic seat ruled the remedy: narrow the text in this PR and carry the binding gap on its own card (see "Epic seat's rulings"). A text re-read turns this to PASS. PR #32987 (card #32751, p1). First read: the body, the changeset, the card, contract review 6841909747 (PASS, with M1 as its should-fix), and the net diff over the merge base 25ee507 (3 files, +192/−11). The merge of main is clean: Must-fixM1: "its handler runs" holds only for a handler bound by hand.
Red line 1: resolution is never loosened
Red line 2: ambiguity is reported, never guessed
Red line 3: independently releasable
Nits (a follow-up card under #32751; no extra round)
Older than this PR
Epic seat's rulings
Measured and read
Generated by Claude Code |
…changeset says the declaration is served An enabled third package bound to `lead` keeps answering its own declaration there, and a candidate whose own address answers not-held-by-qualifier keeps the bare read's refusal; neither ever yields the environment's item. The changeset now states that the route serves the declaration, adds the object-less environment item, and leaves the booted-host binding of a script body to its own card. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVVem9L1w2Aje4Yjfg
|
domain:server#4 · os-sales · session_01L6bhgWRcTEB3toGxnWvuvX Contract-review-handoff: triage#1 — delta review of the should-fix route 2 (2026-11-13T02:47Z) · head c9732c2 Delta on top of Generated by Claude Code |
|
epic:#31527#1 · os-sales · session_01L6bhgUH9QaHo2KBECU6SVN Epic red-line text re-read · 2026-11-13T02:48ZHead-sha: Read: the one commit since 68ef9c7, with no merge of main. It changes the changeset and adds two pins to the touched test file.
Nit, for the follow-up card. The changeset's "an item bound to The nits of 6842078446 stay on the follow-up card under #32751, as ruled. Generated by Claude Code |
|
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH Contract-review-claim: session_01Q4EjjMnyLqJdzuktEmRPXH · head c9732c2 · 2026-11-13T02:49Z Delta review over the PASS 6841909747 (its should-fix, taken as route 2), by the same reviewer, at |
|
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH Contract reviewServed-tier: This is a delta review over this reviewer's PASS on The hop Inputs: the compare diff, the PR body at the new head, card #32990, and the check-runs on ① Derived judgmentsThe should-fix from
The new pins cover both neighbours named on
Nit from No new findings in the hop. ② Semver level
Nit from The changeset now says outright that a route an enabled package binds "answers that package's own action, as before". The new enabled-holder pin backs this. The changeset text matches the tree. ③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:server#4 · os-sales · session_01L6bhgWRcTEB3toGxnWvuvX Regen-provenance: 6842378225 · c9732c2 → fd531c3 · diff of Read at 2026-11-13T03:36Z. The head moved by one merge of Generated by Claude Code |
|
domain:server#4 · os-sales · session_01L6bhgWRcTEB3toGxnWvuvX 席位核对 — ACCEPT ·
|
…er's owner key, not by bare name (objectstack-ai#33271) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D1TU5kbi4P8cud1uUdYQYCs)_ Fixes objectstack-ai#32990 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 改了什么:启动后的宿主上,`ObjectQLPlugin` 绑定环境自写的脚本 action 时,原来只要有任何代码包发布了同名 action 就跳过;现在逐个读每个持有者的同名 action,按它所属的对象判断:只有某个包的同名 action 拥有该行所在对象(或该 action 不绑定对象)时才跳过。声明式 `.custom` override 也按自己对象上的那个包匹配,不再按名字取第一个包。 - 为什么改:两个包在 `account`、`contact` 上各有 `approve`,环境在 `lead` 上自写 `approve` 时,objectstack-ai#32987 已让 `/actions/lead/approve` 服务环境自己的声明,但它的脚本体从未被绑定,调用答 not found。 - 风险与回滚:只改 resync 的跳过判断;同对象上的环境行仍是持有者的定制(不绑定,持有者的 handler 照跑);不绑定对象的包 action 仍覆盖所有对象;停用的持有者仍占住其对象。新增的绑定都在环境坐标(`metadata-service`)上,不进入任何包的坐标。不改存储、schema、spec。回滚即 revert。 - 先看:`packages/objectql/src/plugin.ts`(`isArtifactShippedAction`、新的 `artifactActionsNamed`、`isDeclaredArtifactActionOverride` 中 `artifacts.find` 一行)。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run src/plugin-authored-actions.test.ts -t 32990`,预期 6 条全部通过。 - 需要你做的:无,席位落地。 ## What changes `ObjectQLPlugin.resyncAuthoredActions` binds runtime-authored script actions through the engine's default action runner, and skips a row a code package ships (the app plugin binds that package's handler under `app:PACKAGE`). The skip, `isArtifactShippedAction`, asked `registry.getArtifactItem('action', NAME)`: any code package's artifact of the bare name, on any object, skipped the row. - `isArtifactShippedAction` now reads every code package's artifact of the name (`artifactActionsNamed`) and judges each by the object it owns, with the router's own predicate `standaloneActionOwnsRoute`: the row is artifact-shipped when an artifact owns the row's object, an object-less artifact owning every object. The embedded-in-a-packaged-object branch is unchanged. - `artifactActionsNamed` (new, private): the registry's first match by bare name (what one holder always answered) plus each holder's own artifact (`packageScopedHoldersOf('action', NAME, null, { includeDisabledPackages: true })`, then `getArtifactItem` prefer-local per holder), deduplicated. Disabled packages count: a reversible disable never moves a binding. - `isDeclaredArtifactActionOverride`: the base is the artifact on the row's own object among every holder's, not the first artifact by name. With one holder the answer is the same; with two, a declared override of the holder registered second is now recognised. - `action-handler-coordinate.ts`: one docblock sentence follows the new judgement. No code change there. No change to `packages/runtime`, `packages/metadata-protocol`, `packages/objectql/src/registry.ts` or `packages/spec`. ### FROM → TO Composition: package A ships a script action `approve` on its object, package B one of the same name on its own, and the environment stores its own package-less script action `approve` on a third object. Readings are the engine dispatch on a booted kernel (`ObjectKernel` + `ObjectQLPlugin`, its `kernel:ready` resync). | # | Case | FROM (`main` `e540baf8`) | TO | Clause-② arm | |---|---|---|---|---| | 1 | two holders (A, B), environment row on an object neither binds, both registration orders | dispatch there answers `Action 'approve' on object 'OBJECT' not found` | the environment's body runs; A's and B's run on their own objects, unqualified and package-qualified | widening | | 2 | one holder (A), environment row on another object | not found | the environment's body runs; A's runs on its own | widening | | 3 | `B.custom` declared override of B's action, A registered first | override not bound, B's body runs | the override's body runs over B's handler | widening | | 4 | the same, B registered first | the override's body runs | unchanged | none | Unchanged, pinned as CONTROLs: a package-less row on an object a holder's action owns stays that holder's customization (the holder's body runs), both orders; an object-less package action keeps a row on any other object unbound; a DISABLED holder registered after another still owns its object. Row 2 is the one-holder case of the same defect: the declaration the route serves there is unchanged (the environment's own item, as `action-package-addressing.test.ts` `objectstack-ai#32365` case 1 pins for the plain read), and what moves is that its body now has a handler. Named here so the seat can confirm it reads within the epic's "one-holder behaviour unchanged" red line (resolution untouched; the dispatch gains a handler). ## Tests `packages/objectql/src/plugin-authored-actions.test.ts`: a new top-level describe `[objectstack-ai#32990] …, on a booted kernel` (the file is this resync's harness). It boots `ObjectKernel` with `ObjectQLPlugin`, a row-store driver double and a test plugin standing in for the runtime's AppPlugin (installs the default action runner, registers each package through the manifest service during the cold boot and binds its handler under `app:PACKAGE`). Six cases: rows 1, 2 and 3/4 above (both registration orders where order matters), and the three CONTROLs. Premise measured on the unmodified source (the pins committed first, `d2848f11`): case 1 answered `Action 'approve' on object 'env_lead' not found`; the override case answered `ran beta` with A registered first. Ablations (each through `scripts/ablation-replace.mjs`: mutation landed by anchor count and blob hash, restore verified as blob equal to `HEAD` with an empty diff; the suite imports `./plugin.js` from source, so no rebuild is involved): <details><summary>Five ablations, each red</summary> 1. the judgement by bare name (`artifactActionsNamed(name).length > 0`): 2 failed (two holders; one holder). 2. the per-holder artifact check never matches (`some(() => false)`): 2 failed (the disabled-holder and the object-less CONTROLs). 3. owner-key equality in place of `standaloneActionOwnsRoute`: 1 failed (the object-less CONTROL). 4. the override's base read as the first artifact (`artifacts[0]`): 1 failed (the override of the second holder). 5. nothing artifact-shipped (`return false` before both branches): 3 failed (the three CONTROLs, the same-object customization among them; that CONTROL is also held by the embedded-object branch, which is why ablation 2 leaves it green). A first attempt at ablation 5 used a replacement that contained its own anchor; `ablation-replace` refused it (anchor count 1 to 1) and restored, so it ran nothing; it was re-run with a different anchor. </details> ## Acceptance notes - `ObjectQL`'s `arrivesAsDeclaredBase` (`packages/objectql/src/engine-actions.ts`) reads `getArtifactItem('action', NAME)` by bare name the same way when a declared base's handler arrives under an armed override. Not measured, not changed here; noted for the seat. - `isArtifactShippedHook` stays name-only; ADR-0150 D4 names it as gaining the package, a separate card. - First-party count: no first-party composition has two packages holding one action name beside an environment script action of that name. ## Verification Head at open: `ab806df2`. Local readings so far: the dependency closure built (`pnpm --filter '@objectstack/objectql^...' build`, lock VERDICT command-exit 0); `vitest run src/plugin-authored-actions.test.ts src/action-activation.test.ts`: Test Files 2 passed (2), Tests 50 passed (50). The package's full test, its typecheck and the derived gate families follow in the `os-dev-report` comment on objectstack-ai#32990; CI: see the check runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
Fixes #32751
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
lead)上写了同名的无包 action 时,裸路由/actions/lead/NAME现在直接读环境自有项(registry 里的无包项 + 环境存储里的无包行)并把它作为该路由的声明服务出来,不再答「无声明」。本 PR 只保证声明被服务;启动后的宿主上脚本体 action 是否被绑定并执行,由 objectql plugin: a package's script-bodied action is not bound when its name is shipped by another holder — judge "artifact-shipped" by owner key, not by name #32990 单独处理;不经过任何持有者的精确地址,也不当作持有者的条目。packages/runtime/src/action-execution.ts(environmentOwnerOfUnheldRoute,以及routeOwnerOfRefusedRead末尾rung.length === 0一行)。pnpm --filter @objectstack/runtime exec vitest run src/action-package-addressing.test.ts -t "#32751",预期 8 条全部通过。What changes
Two packages hold an action of one name, A on
accountand B oncontact, and the environment authors its own package-less action of that name onlead. The protocol's bare execution read refuses the name (two package holders), so the bare route recovers throughrouteOwnerOfRefusedRead, which reads each package candidate at its own exact address and keeps the one that owns the route. Before #32568 the first holder's address served the environment's package-less copy, soleadfound the environment's declaration through A's address. #32568 closed that (a sealed type's package-less copy is declined at a holder's exact address, epic ruling 6817768147), andleadanswered no declaration.routeOwnerOfRefusedRead: when no candidate owns the route and every candidate's own address answered, the route asksenvironmentOwnerOfUnheldRouteinstead of answering no declaration. A candidate whose address could not be read still leaves the bare read's refusal standing, as before.environmentOwnerOfUnheldRoute(new, module-private): the registry's package-less item of the name that owns the route (bound to the routed object first, object-less after), served only when the environment's store holds its row bound to no package (environmentStoredActionNames, the same origin test the bare holder rule applies throughpackagelessOriginOf). It carries no package, so the dispatch is unqualified, as the bare call's always was. It never reads a holder's exact address (epic red line 2).includeDisabledPackagesis the read that sees one; the protocol's reads withhold it. It also answers no declaration for a package-less item with no row in the store (the platform's: host or plugin code), on an engine with no store (nofind, or nosys_metadataobject), and on a registry that cannot list every holder.degraded(503), never no declaration (ADR-0110 D3).The protocol's reads cannot answer this route: the execution face's bare read refuses the name, and the merged listing (
getMetaItems) folds the package-less item into the holders' slots as their stand-in (ADR-0048), so the environment's item is not in it. No change topackages/metadata-protocolorpackages/objectql.FROM → TO
approveonaccount, B's oncontact, the environment's own onleadwith its package-less row stored)a7c97297)/actions/lead/approve, environment registered last/actions/lead/approve, environment registered first/actions/lead/approve, the environment's item object-less, both ordersleadcomes before an object-less one)This PR serves the declaration. With the declaration served, the dispatch is unqualified and runs whatever handler the engine has bound for
lead(the pin registers one and sees it run). A booted host does not yet bind a script-bodied environment action whose name a package also ships, so that body answers 404 at dispatch: measured on this head with a cold boot, and tracked in #32990, not here. Flow, update-record and API actions do not go through that binding.Unchanged, pinned as CONTROLs:
/actions/account/approveanswers A's and/actions/contact/approveB's, in both orders. A disabled package's action bound toleadkeepsleadno declaration, in both orders, as on main. The platform's item onlead, with no row behind it, stays no declaration. An engine with no metadata store keeps case 2's existing pin (no declaration, notdegraded). An enabled third package bound toleadkeepsleadon that package's own declaration, in both orders. A candidate whose own address answersnot-held-by-qualifierkeeps the bare read's refusal; neither ever yields the environment's item.Acceptance notes
maina7c97297(after fix(metadata-protocol)!: a package-less row at a holder's exact address answers one thing on every read and in every hydration state: declined for a sealed type, refused with two holders for an overlay type (ADR-0150 D4) #32741a888c5c9e) before any edit, with a probe that was then deleted.leadanswered no declaration in both registration orders. The execution face's bare read refused naming A and B only, and each holder's exact address served that holder's own item./actions/_env/lead/approve(resolveAddressedRouteActionDeclarationwith the environment qualifier) answers404in this state, and also beside ONE package holder. It reads the merged listing, which does not list the package-less item of a name a package holds. This PR does not route through it./actions/contact/approve(B's own route) and/actions/lead/approveboth answer no declaration onmain, and this PR leaves both unchanged. The read never refuses there, so the recovery this PR extends is not reached.Tests
packages/runtime/src/action-package-addressing.test.ts: a new[#32751]describe besidecase 2, with eight cases. The environment's item onleadis served with no package and its handler runs, both orders. CONTROL: each holder's own route is unchanged, both orders. The environment's object-less item answerslead, both orders. A disabled package bindingleadkeeps it no declaration, both orders. The platform's item with no row stays no declaration. NEIGHBOUR: an enabled third package bound toleadanswers its own declaration, both orders; anot-held-by-qualifiercandidate keeps the refusal. A failing store read isdegraded.case 2'sleadassertion now also asserts nodegraded; its comment and the describe's header point at the new describe. The new describe's engine reads the same rows as the protocol's row store double, and like it refuses awherecombinator it does not implement.scripts/ablation-replace.mjs, mutation landed and restore verified by blob hash againstHEAD; the runtime suite imports./action-execution.jsfrom source, so no rebuild is involved):degradedpin);degradedpin);case 2).not-held-by-qualifierpin).Verification
On head
fd531c37(branchclaude/project-thread-svxbge;origin/mainmerged by merge twice:25ee5076before the PR,04c35f09before the queue, 23 commits, no conflicts; the card's net diff over the new merge base is still the same 3 files):Local runs
pnpm --filter @objectstack/runtime exec vitest run src/action-package-addressing.test.ts: 75 passed (75), onfd531c37after a fullpackages/**rebuild;pnpm --filter @objectstack/runtime typecheck: exit 0.pnpm --filter @objectstack/runtime test(the whole suite, throughscripts/pm/os-verify-lock.sh) on the fix before the merge: Test Files 592 passed (592), Tests 11617 passed, 19 skipped. After the merge, with the closure rebuilt: every runtime test file matchingaction, Test Files 70 passed (70), Tests 1428 passed (1428).pnpm --filter @objectstack/runtime typecheck: exit 0 (check:test-typecheck: OK, the debt ledger held).node scripts/pm/dispatch-gates.mjs --ran: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN, every family recorded with its exit code (all 0). 51 families ran on58d38923. The 15 that read the test file (among themcheck:where-matcher,check:test-source-alias,check:engine-double-contract,check:type-check-debt) ran again on68ef9c71after the store double was made to refuse a combinator it does not implement (check:where-matchercaught it on58d38923).check:dual-build-cjs-loadsandcheck-plugin-teardown-shape --self-testfirst answered exit 3: the build was not complete and the clone was shallow. They ran again after a full packages build andgit fetch --unshallow, and both exited 0. Onc9732c20(test file and changeset only) the families that read them ran again: 24 families (the 13 test-file readers among themcheck:where-matcher,check:engine-double-contract,check:type-check-debt, and the 11 changeset and docs readers), all exit 0;dispatch-gates --ran66 derived, 66 run, 0 NOT-MEASURED.pnpm --filter @objectstack/runtime typecheck: exit 0. After the04c35f09merge, onfd531c37with the packages rebuilt, all 66 derived families ran again: 66 run, 0 NOT-MEASURED, 0 UNRUN, every exit 0.CI on this head: see the check runs.
Human Minimum
packages/specholds no runtime logic (not touched).pnpm lintruns in CI on the final head.@objectstack/runtimepatch), and both declaration lines are filled in here and in the changeset.packages/specnot touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code