Repository navigation
fix(runtime,service-automation)!: the flow doors judge the served holders, so a disabled holder's slot answers no bare name (ADR-0150 D3) - #33646
Conversation
…ders of a name two packages hold (WIP) A bare flow name an enabled and a disabled package hold reaches the enabled holder's slot; two served holders are refused naming them only; none is no flow. Durable coordinates (slot keys, run keys, dispatch key, guards) stay judged over every holder. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
📓 Docs Drift CheckThis PR changes 2 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 36 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
|
… doors and the engine's bare entries Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
…erved answers through the dispatcher, both orders Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
…changeset Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
…'s slot Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
|
domain:server#5 · os-elon-musk · session_016WV4cx5ZPCyTk8ckTsx4ut Fixes #33386, under seat ruling 6884403301 (all nine amendments) and the Q2 ruling 6888807772 (connector address IN, three conditions). |
|
Contract-review-claim: session_016WV4czb1FQB8j27FVgnMye · head 4a3db01 · 2026-11-15T08:51:59Z review#3. |
Contract reviewServed-tier: Full review of ① Derived judgmentsEach ruling item and amendment holds in the code.
Rows F1–F13 and C1–C5 match
Declaration.
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing makes ADR-0150 D3's own rule ("a disabled package holds no name") real at the flow doors and at the connector address. It brings them in line with the email send (#33361) and with the connector service, which already judged the served holders. It takes away no declared capability. Every narrowed answer is one that only a disabled package's holding produced, and re-enabling the package restores it, because no slot key, run key, dispatch key or credential scope moves (am. 7). I tried to break the holder checks:
Each is closed at the line cited in ①. No bypass was found. The three questions the area raised (the inbound hook's bare refusal, Implemented-by: VERDICT: PASS |
…isabled holder; changeset names the deferred trigger binding and no migration The changeset's "Not moved" claimed every definition write keeps a 409 naming every holder. At an address naming the disabled holder, at _env and at a third namespace the write is refused naming the served holder only, and with both holders disabled an address answers 404. The text now says so, and one pin measures it over a real SchemaRegistry in both registration orders, with HR's own address still naming both. A second pin measures that a package-less flow action and one from a package depending on both holders resume the served holder's parked run. The changeset declares amendment 3's trigger binding deferred and states in visible text that no migration is needed. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut
|
Contract-review-claim: session_016WV4czb1FQB8j27FVgnMye · head 99fca26 · 2026-11-15T09:28:13Z review#3. |
Contract reviewServed-tier: Delta review of ① Derived judgmentsThe merge leaves the PR's source exactly as reviewed. S1 is closed. The new text is true at each emitter.
The new pins would fail if the behaviour differed.
S2 is declared. The changeset ( N3 is closed. The body and the changeset agree. The table rows F15, F15b, F15c and F16, the acceptance note, the deferral and the no-migration line all match the changeset text and the code above. The declaration ( ② Semver levelUnchanged from 6891968637: ③ Boundary flags
④ Design judgmentThis delta makes no design change. The full review's judgment at Implemented-by: VERDICT: PASS |
|
domain:server#5 · os-elon-musk · session_016WV4cx5ZPCyTk8ckTsx4ut
|
…low it starts (objectstack-ai#33721) Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: none — no authorable key moves; skills/objectstack-ai/SKILL.md already teaches that an action declaring `ai.requiresConfirmation` is refused to an AI service account's own key whatever it sends and is a person's to run, and this change holds the flow such an action starts to that same rule. ## 维护者速读 - 改了什么:AI 服务账号(自身为主体、无 onBehalfOf 的 agent)经两个 trigger 路由按名启动流程时,若有 `type: 'flow'` 且 `ai.requiresConfirmation: true` 的动作指向该流程,统一回动作入口自己的 `428 ACTION_CONFIRMATION_REQUIRED`,在任何 run 产生之前拒绝,请求带不带 `confirm` 都一样;读不到动作声明时回 `503`,不放行。 - 为什么改:动作声明的确认要求应随它启动的流程一起走;账号不能替自己确认,所以按名启动与经动作启动必须是同一个答案。 - 风险与回滚:只影响 AI 服务账号经 trigger 路由的启动;人、OAuth 委托 agent、系统主体、没有被门控动作指向的流程、动作入口自身的门都不变。偏安全一侧的三种情况见 changeset(同名流程的任一持有者都算、被关闭的门控动作仍门控、合并清单未提供时账号启动一律 503)。规则 2b 与该请求的 `/actions` 入口读同一实例;前一步加载失败而后一步命中时按后一步判,这是已声明的限定,统一的逐步报错另行跟进。回滚即 revert 本 PR。 - 先看:`packages/runtime/src/flow-start-admission.ts`(`flowStartRefusal` 中规则 2b 的位置与 `DECLARATION_READ_FAILED_REFUSAL`)、`packages/runtime/src/domains/automation.ts`(`resolveSlotAsActionsDoorReads` 与 `servedActionDeclarations` 的各个读取来源)、`packages/runtime/src/flow-start-confirmation-gated-target.test.ts`。 - 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run --project local src/flow-start-confirmation-gated-target.test.ts`,预期 49 passed。 - 需要你做的:本 PR 是收紧安全行为(一类调用方不能再按名启动某些流程),需维护者本人批准后落地;另请裁定 `Metadata-protocol` 是否应为 `semantic`(若是,changeset 升为 minor)。 ## What changes The rule: **the confirmation an action declares travels with what it starts.** An AI service account (`principalKind: 'agent'`, no `onBehalfOf`) does not confirm an action for itself. When an action of `type: 'flow'` whose `target` is a flow declares `ai.requiresConfirmation: true`, a door that starts that flow by name and states the environment's action declarations refuses the account with the action door's own refusal, `428 ACTION_CONFIRMATION_REQUIRED` (its `details` naming the action, its object and the confirmation member), before any run exists, whatever the request carries. No new error code. - **`packages/runtime/src/flow-start-admission.ts`, the one flow start admission predicate `flowStartRefusal`.** - Rule 2b sits after the elevated-flow account rule and before the flow's own `requiredPermissions`. `FlowStartDoor` gains `actionDeclarations`, which is read only when the caller is an AI service account. - `confirmationGatedStarterOf` reads the declared flag alone (`=== true`), over every holder of a declaration. `confirmationGatedStartRefusal` builds the refusal. Its code and status are typed to the action door's `ActionConfirmationRefusal` through a type-only import, so the module keeps no value edge into `action-execution.ts`. - Rule 2b reads the flow's name and the declarations only, never the definition. It is asked whether or not the automation service serves `getFlow` and whether or not the probe returns a definition. Rules 1, 2 and 3 still read the definition and are asked only when it is there, as before. - A declaration read that fails is refused by the predicate itself. The refusal is `DECLARATION_READ_FAILED_REFUSAL`, a flat `503 SERVICE_UNAVAILABLE` (a standard-catalog code), whatever the failure declares. It wraps the declaration read alone, so a failure of the predicate's own flow read travels exactly as before, for every caller. - **`packages/runtime/src/domains/automation.ts`.** Every trigger route answers through one shared mapper: `POST /automation/:name/trigger`, the legacy `POST /automation/trigger/:name`, and their addressed forms. That mapper states the declarations through `servedActionDeclarations` and serves the refusal's `details`. The sources: - where the `protocol` slot serves the merged listings, its merged object and action listings alone; - otherwise, every source the bare `/actions` door resolves a declaration from on such a host: the ObjectQL registry's objects (with their embedded actions) and standalone `action` items, and the metadata service's object and standalone `action` listings. - Each of the three slots (`protocol`, `objectql`, `metadata`) goes through `resolveSlotAsActionsDoorReads`, the smallest composition of the two existing resolvers. First comes `resolveService`, the order every `/actions` read uses: the request's own kernel first on a host that routes a request to a kernel of its own, then the host's scoped factory, then its singletons. Its instance is the instance the same request's `/actions` door reads, in every host shape. Whichever leg answers, its instance is read, as the `/actions` door would serve it. Only when no leg answers does `resolveServiceOrLoud` classify the miss. A name nothing registered, or a scoped registration with no instance in this scope, is absent and contributes nothing. Any other rejection is re-raised, so a wired slot that fails to resolve throws. Both steps are scoped by the request's environment, as the door's reads are. - Each listing is read where its throw travels. Any read failure that reaches the function as a throw is the predicate's `503`. A source that answers a failed read of its own without throwing (the metadata service's plural listing, which reports a failed loader and answers the other loaders' rows) is judged on the rows it answers. - **The declared `type: 'flow'` endpoint door is not judged by rule 2b yet.** It states no declarations. `packages/runtime/src/endpoint-policy.auth-gate.pin.test.ts` pins its existing answer on the default `authRequired`: an API key alone gets `401 UNAUTHENTICATED` before its flow runs. - **The action door states no declarations either.** It keeps its own confirmation gate, unchanged. Unchanged: a person, an OAuth-delegated agent and the system principal, for whom the declarations are not read; an account starting a flow no confirmation-gated action targets; and the action door's own gate (`/actions`, MCP `run_action`). Overlap: open draft objectstack-ai#33646 edits `packages/runtime/src/domains/automation.ts` in other hunks: the address-registry imports and the bare-name admission. No hunk is shared. ## Tests `packages/runtime/src/flow-start-confirmation-gated-target.test.ts` has 49 cases, named by the rule: - **Both trigger routes refuse the account 428:** - without `confirm`, with `confirm: true`, and with `confirm: true` beside `params`; - with the gated action embedded on an object, as a metadata standalone item, in the protocol's merged listing, and in the ObjectQL registry on a host with neither listing; - on a service with no `getFlow`. - **Both trigger routes refuse the account a flat 503, and nothing runs:** - when a listing throws, including a throw that declares its own status; - when the `protocol`, `objectql` or `metadata` slot is wired and fails to resolve; - when the metadata service's standalone action listing throws. - **CONTROLS:** - a person starts the flow, and the declarations are not read for one; - a person is unchanged on a service with no `getFlow` and under each failing slot or listing; - a delegated agent starts the flow; - a flow no gated action targets is started by the account; - a gated action that targets another flow gates nothing; - the action door still answers its 428 to the account, with and without `confirm`. - **`flowStartRefusal` unit pins:** - with no `getFlow`, and with a definition the probe does not return: the account gets 428, while a person and an ungated flow are admitted; - a failure of the flow read itself rejects as before and is not answered by the 503. - **Host shapes, on real kernels:** in a kernel-resolver host, a single-environment host and SharedProjectPlugin (a scoped factory), the gated action declared on the instance the request's own `/actions` door reads refuses the account's start. In the kernel-resolver shape, a pin records today's limitation: where the request's own kernel fails to resolve the slot and the host kernel answers it, the start is judged on the host instance, as the `/actions` door would serve it. That answer changes when per-leg loud resolution lands. In each shape, a composition that merely lacks every source (in SharedProjectPlugin, a scoped factory with no instance in the scope) gains no 503, and the account starts the flow. - **`confirmationGatedStarterOf`:** reads the declared flag alone, with each fact changed in turn gating nothing, and picks the same action every time when several qualify. Ablations are one-shot, run through `scripts/ablation-replace.mjs` with the fix committed first. Every mutation landed on disk, and every restore was verified: blob equal to HEAD and `git diff HEAD` empty. | Leg | Mutation | Red | Green | |:---|:---|:---|:---| | Rule 2b's return | replaced | 10 rule cases | 13 others (at the first head) | | `metadata` slot | resolved quietly | 2 | 36 | | `protocol` slot | resolved quietly | 2 | 36 | | Registry source | disabled | 2 | — | | Rule 2b | gated behind the definition again | 4 | — | | `objectql` slot | resolved through the quiet engine probe | 2 | 40 | | Standalone metadata listing | handed back to the reading that answers its throw as empty | 2 | 40 | | Slot resolution | the classifier alone (its host-first order) | 1, the kernel-resolver host's gated pin | 47 | | Slot resolution | the request-kernel-first probe alone, with no loud classification of a miss | 6, a wired slot failing on both routes | 42 | Two more standalone-listing legs are reported but not used as the measurement. One removed the read entirely, a stronger mutation: 4 red. The other landed on disk without reproducing that reading: 42 green, a spent leg. <details><summary>Readings</summary> - At the final head (comments, changeset and pins only since 9714122): `src/flow-start-confirmation-gated-target.test.ts`, Test Files 1 passed (1), Tests 49 passed (49); `pnpm --filter @objectstack/runtime typecheck` exit 0; `check:nul-bytes`, `check:doc-authoring` and `check:issue-citations` each exit 0. At f7941c7, the two touched test files gave 69 passed, and `check:test-source-alias` and `check-adr-0087-registration --base origin/main` each exited 0. A comment and test change owes no battery, so the full runtime project, the full gate derivation and the dogfood battery stand from 9714122, below. At 9714122 (origin/main merged in cdb38cd): - `pnpm --filter @objectstack/runtime exec vitest run --project local --maxWorkers=2`: Test Files 604 passed (604), Tests 10919 passed, 19 skipped (lock VERDICT command-exit 0). - The two touched test files: Test Files 2 passed (2), Tests 68 passed (68). - `pnpm --filter @objectstack/runtime typecheck`: exit 0 (`check:test-typecheck` OK, ledger held). </details> ## Acceptance notes - The declared `type: 'flow'` endpoint door is not judged by rule 2b yet; its default `authRequired` refusal of an API key is pinned. - The action door states no declarations; its own confirmation gate judges the action it runs, unchanged. - The declarations are read from the instance the request's own `/actions` door reads: a read failure refuses the start when no step of that door's resolution order answers the name, and where a later step answers, the start is judged on that instance, as the door would serve it. - Per-leg loud resolution (a wired slot that fails on an earlier step refuses even when a later step answers) is a shared resolver change for every dispatcher door, tracked by the security lane; it is not in this PR. - The rule refuses on the safe side in three cases, each one an account start only, as the changeset states: - every holder of the flow's name counts; - a gated action that is switched off still gates; - on a host whose merged metadata listing is not served at all, every account start is refused `503`. - Rule 2b answers before rule 3, so an account that also lacks the flow's `requiredPermissions` is answered with the 428. ## Verification <details><summary>Gates</summary> - `node scripts/pm/dispatch-gates.mjs --commands` (no paths; derived at 9714122): 71 families. `--ran` with exit codes recorded: 71 derived, 71 run, 0 NOT MEASURED. `pnpm check:dual-build-cjs-loads` measured (exit 0) on a re-run after the dogfood closure finished building: 123 require entry points across 72 packages load. - `node scripts/check-adr-0087-registration.mjs --base origin/main`: exit 0. It reads 1 declared-breaking changeset as `[BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription)`. - origin/main merged in this round; the derivation reports no stale tree. - Dogfood battery at 9714122, `pnpm --filter @objectstack/dogfood test` under the lock: VERDICT command-exit 0; Test Files 467 passed, 3 skipped (470); Tests 3958 passed, 42 skipped (4000); no failure. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f)_ <!-- signed: security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…whose package is disabled (ADR-0150 D3) (objectstack-ai#33890) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCpddLFmKzR39wJWZpkRMCi)_ Fixes objectstack-ai#33748 Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: none — no published skill teaches how a trigger binding behaves while a package is disabled (`skills/objectstack-automation` names a disabled package only for a packaged flow's queue approver) > **BREAKING** for a deployment where two packages each ship a flow of the same name and one of them is disabled at runtime: that package's flow no longer runs on its trigger (record-change, schedule, time-relative, or an api inbound hook's queued post); on `main` it kept running. An event fired while the package is disabled is dropped, not replayed on enable. No key, row or binding moves, so nothing is migrated (ADR-0087: `not-required (no-migration-prescription)`). ## 维护者速读 - 改了什么:两个包各带一个同名流程时,引擎按包各持一个槽位并各自挂触发器。现在触发器触发时引擎先问该槽位的包是否仍在服务:包被停用就不运行(不写运行记录、绝不换成另一个包的同名流程),每个槽位在停用期间只记一行 info;包重新启用后,同一个触发器直接恢复运行,无需重新挂载。 - 为什么改:座席裁决 6884403301 修正 3 写明「trigger binding: no dispatch」;PR objectstack-ai#33646 落地了其余各门,唯独触发器这一路被推迟到本卡。 - 风险与回滚:破坏性收窄(标题带 `!`):停用包的槽位不再被触发器运行;停用期间触发的事件直接丢弃,重新启用后不补跑(一次性的定时或相对时间触发会丢失)。槽位键、运行键、触发器绑定、`flowDispatchHolder` 都不动(修正 7),无需迁移。只有一个包持有的流程名不受影响(与 main 相同,另列为待决问题)。回滚即还原本 PR。 - 先看:`packages/services/service-automation/src/engine.ts` 的 `triggerRun`(新增的停用判断与一次性日志)和 `isDisabledHolderSlot`(复用 `flowNameResolver` 的 `servedCaller` 读法)。 - 两分钟验证:`pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/flow-slots-per-package.test.ts`,预期 64 个全部通过,其中 `[objectstack-ai#33748]` describe 共 13 个。 - 需要你做的:无,席位落地。 ## What changes A flow name two packages hold has one engine slot per holder (ADR-0150 D4), and each slot's trigger binding is armed under its own key. Every trigger family hands the engine one callback per binding, and that callback is the run `triggerRun` builds; `activateFlowTrigger` is the only `trigger.start` call site, so record-change, schedule, time-relative and the api inbound hook (whose queue consumer calls the armed callback) all reach it. Until now that run executed the armed slot with no served check (the deferred note of PR objectstack-ai#33646). - `packages/services/service-automation/src/engine.ts`, `triggerRun`: for a slot of a shared name with a package, the engine asks at fire time whether that package is disabled (`isDisabledHolderSlot`). If it is, nothing runs, no other slot is substituted, and the trigger's callback resolves with no result, so the caller logs no failure. The skip is said once per slot at `info` while its package stays disabled (the package switch working, nothing persisted is lost), and said again after the slot has dispatched once more. Asked at fire time, not at arming time: a runtime disable leaves the slot armed, so a re-enable dispatches it again with no re-arm. - `isDisabledHolderSlot` (new, private): asks the one resolver (`flowNameResolver`) with the slot's package as the caller. Its own holding answers on the served read, and the run's read (`servedCaller`, amendment 4) answers `not-found` for it only while the package is disabled. Both readings are needed: `not-found` alone also covers a slot whose package the registry no longer holds the name for, which this rule does not judge (pinned as a CONTROL). No resolver attached: nothing is disabled, as before. - Not touched: slot keys, run keys, the trigger bindings and `flowDispatchHolder` (amendment 7), and a slot of a name one package holds (it still runs through `execute`, as on `main`). No trigger plugin changes. ## Tests `packages/services/service-automation/src/flow-slots-per-package.test.ts`, new top-level describe `[objectstack-ai#33748] a trigger binding does not dispatch a slot whose package is disabled`, on the file's real `SchemaRegistry`, the real `flowNameResolver` and a recording trigger that fires each armed binding as a matching write would: - In both registration orders, for each holder disabled: a runtime disable (both slots armed) dispatches only the served slot, the skip is said once over two fires with `{ flow, package, slot }` meta and no `error`; the slot keys, the dispatch holder and the bindings are unchanged; a re-enable dispatches both again with no new `start()`; a second disable is said again. - In both orders, both disabled: nothing dispatches, each slot said once, keys unchanged. - In both orders, for each holder: a boot disable (the disabled holder's flows not armed) never dispatches it; enabled and re-armed (the re-sync's `registerFlow`), both slots are armed under their qualified keys and both dispatch. - CONTROLs: a shared name with nothing disabled (both dispatch, nothing said); two slots whose name the registry no longer holds (the resolver answers `not-found` for both packages, nothing is disabled: both dispatch, as on `main`); a name one package holds, enabled and disabled at runtime (it dispatches either way, as on `main` today; see the open question below). ## Acceptance notes - **A name one package holds, disabled at runtime (open question, not changed).** Its slot runs through `execute`, which serves it as on `main`; PR objectstack-ai#33646 left the bare doors serving it too. Gating it here would move that answer for every single-holder package, which the ruling does not name; it is raised in the report with the four axes. In a composition whose disable door re-syncs the engine (the `metadata:reloaded` announce), the re-sync withdraws such a flow anyway. - **The served holder of a shared name stays unarmed after a boot disable or a re-sync withdraw (finding, not changed).** Measured on this engine at `1e65a389`: with one holder disabled at boot (only the served holder shipped to the engine), the served holder's lone slot is filed under the bare key and declined by the M1 guard ("another package holds a flow named 't' whose body was refused"), so its trigger never dispatches. When a runtime disable is followed by the re-sync's `withdrawFlowSlot` of the disabled holder, the served slot's key moves from `PACKAGE/NAME` to the bare name and its binding is stopped and not re-armed. Both predate this PR; the boot-disable pins here assert only the disabled holder's half. Raised in the report for a separate card. - **The inbound hook of a disabled holder's slot.** The trigger-api member's queue consumer calls the armed callback, so a queued post for that slot is skipped by the same check. What the hook door answers the sender for such a slot (`inboundHookSlot`, admission) is not moved here and was not measured. ## Verification All readings at head `0cfd82ca` (the fix at `89a737af` plus the changeset, merged with `origin/main` at `b0056382`; the merge touched no file of service-automation, the triggers or the resolver), each step under `scripts/pm/os-verify-lock.sh`, VERDICT command-exit 0. <details><summary>Tests</summary> - `pnpm --filter @objectstack/service-automation typecheck` (`check:test-typecheck: OK`) and `test`: Test Files 282 passed (282), Tests 3990 passed (3990) (3977 on `main` plus the 13 new). - Direct dependents, `test`: trigger-record-change 122, trigger-schedule 256, trigger-api 73, plugin-approvals 1652, connector-mcp 119, connector-openapi 111, connector-rest 57, connector-slack 10, client 812, example-todo 249, example-showcase 545, verify 439: all passed. `@objectstack/cli` unit layer: Test Files 421 passed (421), Tests 6000 passed (integration layer declared to CI). - `@objectstack/runtime` (not a declared dependent; its automation tests read the engine), narrowed to `src/domains/automation*`, `flow-caller-package`, `mcp-resume-run`, `action-flow-dropped-fields-relay`, `app-artifact-handlers.job-pull-run`: Test Files 48 passed (48), Tests 1032 passed. The full runtime suite is CI's. - Full dogfood battery: see the delta section below. </details> <details><summary>Ablations (each through `scripts/ablation-replace.mjs`, on `src`, which the test imports directly; restored to the HEAD blob, `git diff HEAD` empty after)</summary> Run at `fb77475f` (A1) and `89a737af` (A2 to A4); `engine.ts` and the test file are byte-identical at the head. - A1, the gate off (`if (false && this.isDisabledHolderSlot(…))`): `flow-slots-per-package.test.ts` 6 of 63 red (both orders: each holder disabled, and both disabled), e.g. `expected [ 'alpha', 'beta' ] to deeply equal [ 'beta' ]`. The boot-disable pins stay green under A1, as expected: they pin that the disabled holder is not armed, which this PR does not change. - A2, the own-holding reading dropped (only the `servedCaller` read decides): 1 of 64 red, the not-found CONTROL (`expected [] to deeply equal [ 'alpha', 'beta' ]`). - A3, the said-once reset dropped: 4 of 64 red (`expected [ … ] to have a length of 2 but got 1`). - A4, said on every fire: 6 of 64 red. </details> <details><summary>Gates</summary> - `dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `0cfd82ca`: 71 families, run after the merge, 70 exit 0; `--ran` reconciliation with exit codes recorded: 71 accounted, 70 run, 1 NOT MEASURED. `pnpm check:dual-build-cjs-loads`: NOT MEASURED, exit 3 (it reads every package's `dist/`; this worktree built only the closures above); CI runs it. - `pnpm check:type-check-debt` (re-measure under the lock): exit 0. `check-adr-0087-registration --base origin/main`, `check-changeset-no-major`, `check-empty-changeset`, `check-changeset-fixed`, `check-nul-bytes`: exit 0. - `pnpm lint`: exit 0. - The CI families: the seat reads the PR's check-runs. </details> ## Delta after review-c (verdict 6895274667, contract record 6895266928) Head `560f410d`: the declaration commit `630502c2` on top of `0cfd82ca`, merged with `origin/main` at `63e47fee` (the merge brought objectql changes, none in service-automation or the triggers). No source line of the fix changed. - **M1:** `Clause-②: no (narrowing)` on this body and the changeset; `!` in the title and the changeset summary; the **BREAKING** banner above; one ADR-0087 marker, `not-required (no-migration-prescription)` (`check-adr-0087-registration --base origin/main`: exit 0, reads the changeset as `[BREAKING+bang+clause-②-narrowing]`). `check-changeset-no-major`, `check-empty-changeset`, `check-changeset-fixed`, `check:nul-bytes`: exit 0. - **N2:** the changeset now says an event fired while the package is disabled is dropped, not replayed on enable (a one-shot schedule or time-relative fire inside the disable is lost). - **Seat fold:** the single-holder CONTROL reads "as on `main` today" (title and docblock). - **Full dogfood battery at `560f410d`**, `pnpm --filter @objectstack/dogfood test` under `os-verify-lock.sh` (no `OS_TEST_SHARD`, no path): VERDICT command-exit 0; Test Files 467 passed, 3 skipped (470); Tests 3959 passed, 42 skipped (4001); no failure. - Re-run at `560f410d` under the same lock run: service-automation typecheck + test, Test Files 282 passed (282), Tests 3990 passed (3990); trigger-record-change 122, trigger-schedule 256, trigger-api 73, all passed. - Follow-up cards named by the review are the area's to file; none is filed from this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 <!-- signed: domain:server#5 · zhuangjianguo · session_01QsR2jUZKdq3PK2Sab53cT3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…holds (objectstack-ai#33991) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbSUQWB2j9eHYsRcrCiq1X1C)_ Fixes objectstack-ai#33200 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - **改了什么:** 「设置上级」(Set Manager) 现在只拒绝真正由 SCIM 目录同步的人;只通过 SSO 登录、背后没有目录的人,管理员可以照常改上级。按钮对平台管理员在每一行用户上都显示。 - **为什么改:** 托管环境里第一次通过平台 SSO 登录的人都会被标成 `idp_provisioned`,旧规则把他们全当成「目录持有」,登录后上级就再也改不了,按上级流转的审批跟不上组织调整。按裁决记录 6895645364 选项 A 修。 - **风险与回滚:** 只放宽:以前能成功的请求没有一个变成拒绝。SCIM 判定多读一次 `sys_scim_subject`,读失败返回 500 且不写入。回滚即 revert 本 PR。 - **先看:** `admin-set-user-manager.ts` 的 refusal 5 判断(`applyUserManagerLink`);`scim-sso-adoption.ts` 新导出的 `isHeldByScimDirectory`;`sys-user.object.ts` 的 `set_user_manager` `visible`。 - **两分钟验证:** `pnpm --filter @objectstack/plugin-auth exec vitest run src/admin-set-user-manager.test.ts`,预期 38 个全过,其中 "an SSO-only identity ... is SET like a local one" 为 200 并写入 `manager_id`。 - **需要你做的:** 无,席位落地。 ## What changes Built to the maintainer ruling recorded in 6895645364 (option A: only identities a SCIM directory holds stay locked). - **`POST /api/v1/auth/admin/set-user-manager` (refusal 5).** It refused on `sys_user.source = 'idp_provisioned'` alone. ADR-0135 D4 stamps that value on every federated link without a local password, so a person who only signs in through SSO carried it with no directory behind them. The refusal now also needs a `sys_scim_subject` row. The answer for a SCIM-held identity keeps its envelope (`403 PERMISSION_DENIED`, `details.reason: 'idp_provisioned'`), and the message says to change the manager in the directory. It no longer claims a sync would revert the value, because nothing projects the SCIM `manager` attribute onto the column today. The self, cycle, depth and cross-organization refusals are unchanged. - **One predicate, imported.** `scim-sso-adoption.ts` now exports `isHeldByScimDirectory(engine, userId)`. It is the same `sys_scim_subject` read its adoption judge already ran as condition 2, moved into an exported function. The judge calls it, and so does the endpoint. A missing `sys_scim_subject` table reads as "not held" at the endpoint. Any other read failure propagates, so the mount answers 500 and writes nothing. - **The `source` term stays a conjunct.** A SCIM-provisioned user with a local password is `env_native` under D4 and was accepted before. Requiring the SCIM row alone would have refused that user, so the endpoint still checks `source` too, and no request that was served before is refused now. - **Bulk import and demo staff.** Both run `applyUserManagerLink`, so their `manager_id` links follow the same rule with no code change. The import docblock now says who is refused. - **`sys_user.set_user_manager` visibility** is `current_user.isPlatformAdmin == true`. No column on the row says "held by SCIM", so the button is shown on every row and the endpoint refuses a SCIM-held one with its message. No new field or key. - **Lint prescription.** `os explain approval-approvers-may-resolve-empty` now says the operation refuses an identity a SCIM directory holds, and that an identity that only signs in through SSO is set like any other. The docblock in `validate-approval-approvers.ts` says the same. - **Docs.** `content/docs/automation/approvals.mdx`, `content/docs/capabilities/approvals.mdx` and `content/docs/permissions/authentication.mdx` state the narrowed refusal. - ⛔ The `idp_provisioned` stamp (ADR-0135 D4) and the password refusals are untouched. ## Tests On head `fa70eaa06`: - `admin-set-user-manager.test.ts`, refusal 5 rewritten. SCIM-held SET and CLEAR give 403 `PERMISSION_DENIED` / `idp_provisioned`, write nothing, and read `sys_scim_subject` for that user. SSO-only SET and CLEAR give 200, and `update` gets `{ id, manager_id }`. An SSO-only self-assignment is still a 400 `self_assignment`. `env_native` gives 200, also with a SCIM subject, and the SCIM table is not read. A missing table gives 200. A failed read rejects and writes nothing. - `admin-import-users-manager-pass.test.ts`: a SCIM-held row is refused with `idp_provisioned`. An SSO-only row is `linked`, and `manager_id` is written. The no-fork pin also asserts that the importer spells neither `sys_scim_subject` nor `isHeldByScimDirectory`. - `demo-staff.test.ts`: the refusal fixture is now a SCIM-held identity. - `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`: the action is offered on an `idp_provisioned` row and on the sparse face. It is hidden from a non-admin. It reads no record column, which has a positive control on the standing term. - `validate-approval-approvers.test.ts`: the new prescription is present, and the old `source 'idp_provisioned'` sentence is absent. <details><summary>Suite runs</summary> - `@objectstack/plugin-auth` full suite (locked, before the demo-staff fixture fix): 276/277 files. The one red was `demo-staff.test.ts`, whose fixture is fixed in the next commit. Re-run: `demo-staff.test.ts` + `demo-staff-provisioning.test.ts` 32/32. - Targeted: plugin-auth 3 files 76/76; platform-objects 2 files 169/169; lint 1 file 64/64. - `@objectstack/platform-objects` full: 122 files, 1994 tests passed. `@objectstack/lint` full: 212 files, 9026 tests passed. - Typecheck exit 0 for plugin-auth (all three legs, incl. `check:test-typecheck`), platform-objects and lint. - Dependent: `@objectstack/runtime` `platform-admin-action-gate.test.ts` 16/16. </details> <details><summary>Ablations (each mutation landed by ablation-replace.mjs, restored to the HEAD blob)</summary> - A1, refuse on `source` alone (the old predicate): 7 red, incl. every SSO-only pin in both endpoint and import suites. - A2, no refusal 5 at all: 4 red, incl. SCIM-held SET, CLEAR and the import row. - A3, refuse on the SCIM row alone (drop the `source` conjunct): 1 red, "env_native ... even one that owns a SCIM subject". - A4, swallow every SCIM read failure: 1 red, "a FAILED SCIM-subject read is never read as no directory". - A5, put the `record.source` term back on `visible`: 5 red across `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`. - A6, put the old lint sentence back: 1 red, "GRADES the routes". - A7, missing table rethrows: 1 red, "a missing sys_scim_subject table means no directory". </details> ## Acceptance notes - SCIM-held users stay unchangeable from both sides until the SCIM `manager` projection lands. The ruling records this and the separate card objectstack-ai#33918 carries it. - The action's `helpText` still lists the four other refusals and not the SCIM one. The endpoint message names the directory. Changing `helpText` would move nine translation bundles, so it is left as it is. - `details.reason` keeps the value `idp_provisioned` so no client keyed on it changes. Only the predicate behind it narrowed. ## Verification - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 105 derived families. 101 exit 0. 3 exit 3 (prerequisite not met, NOT MEASURED, left to CI): `check:skill-examples`, `check:dual-build-cjs-loads`, `check:i18n`. 1 not run: `check:type-check-debt`, because the verify lock was held by another run for more than 60 minutes. `--ran` reconciliation agrees. - `--tier`: no path-derived mandate. The same verdict as merged objectstack-ai#33646 and objectstack-ai#33769. - eslint on the changed `.ts` files: exit 0. `check-nul-bytes`: OK. - `git merge-tree --write-tree` of this head against `origin/main`, objectstack-ai#33956, objectstack-ai#33268 and branch `claude/area-A2-33828`: clean, no conflicted paths. Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
…er of a name two packages hold (objectstack-ai#34092) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbBePzY6g11h3hyWk5ud4vWy)_ Fixes objectstack-ai#33832 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:两个包同名的仪表板、报表(以及同类"按包寻址、但元数据服务按名字只存一份"的类型)在删除一条记录后,注册表自动修复不再把"最后注册的那个包"的内容塞进裸槽位。 - 为什么改:元数据服务对这些类型每个名字只留最后注册的一份,修复时拿它当基线等于在两个包之间"猜一个"(违反 ADR-0150 D3)。真实启动实测:删除后注册表的裸查找改答最后注册的包,列表里同一项出现两次;对外的读接口(裸读 409、按包读各自内容、列表接口)不受影响。 - 风险与回滚:只在注册表里有两个及以上持有包时跳过基线读取,单持有包照旧恢复;回滚即 revert 本 PR。 - 先看:`packages/metadata-protocol/src/protocol-registry-hydration.ts` 的 `readHealBaseline` 开头新增的判断,再看 `packages/objectql/src/protocol-registry-heal-packageless-refusal.test.ts` 末尾新增的 describe。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/protocol-registry-heal-packageless-refusal.test.ts`(需先构建 metadata-protocol),预期 12 个用例全绿。 - 需要你做的:无,席位落地。 ## What changes Ruling: ADR-0150 D3 (a bare read never picks between holders) and epic ruling 6818436831, which says of this heal: "Nothing picks a holder and no baseline is registered. The next bare read is the 409 naming exactly the two holders." Seat ruling 6812637203 Q2 ruled the same footing: "the removed row's entry in the bare slot is retired and no baseline is registered." `readHealBaseline` (the delete heal's tier 2) now returns a settled miss, before any service read, for a type that is addressed by `(package, name)` (`isPackageScopedType`) but is stored in the metadata service by name alone (outside `PACKAGE_SLOTTED_STORE_TYPES`), when the registry holds the name for two or more packages (`packageScopedHoldersOf`, disabled packages counted). For those types the service keeps only the item registered last and answers it to a read naming any package or none, so its answer there is a pick. Tier 3 then retires only the removed row's own bare-slot entry (its verb refuses a packaged artifact). A name one package holds is read as before. The types this reaches: `dashboard`, `report`, `page`, `app`, `book`, `analytics_cube`, `hook`, `job`, `sharing_rule`, `queue`, `assignment_rule`. Pinned: `dashboard` and `report`, the card's two. No change to `protocol.ts`, to `applyRegistryWriteThrough`, to `restoreArtifactRegistryView`'s catch branch, to the objectql registry, or to any spec surface. ### The premise, measured on a real boot (H2 first) A kernel booted from a compiled artifact with three package bodies (alpha and beta each ship `dashboard mix_dash` and `report mix_rep`; a third, `other`, ships neither), the way `createStandaloneStack` composes it (`MetadataPlugin`'s artifact door plus `AppPlugin` over the same bundle). Both registration orders, both kernel shapes (`environmentId: env_local` with DB hydration, and none), 8 boots, at `45dee177`. A scratch rig, not committed. - **The card's exact shape does not form on a real boot.** Every boot registered both holders in composite slots (`com.qa.alpha:mix_dash`, `com.qa.beta:mix_dash`). The metadata service kept only the body registered last, and answered it both bare and for `other`. - **The pick does form.** `PUT` of `dashboard mix_dash` naming `other` was accepted (row stored, bound to `other`, kept out of the bare slot). Its delete answered `success: true`, logged nothing, and left the last-registered holder's body in the bare slot. After that `registry.getItem(type, name)` answered that holder (it answered the first-registered one before), and `registry.listItems(type)` listed that holder twice (3 entries for 2 holders). For `report` the save was refused (the rig's dataset did not exist), and the delete with no row still ran the heal and planted the same entry. - **What did not move:** the protocol reads. The bare read was the 409 naming both holders, each holder's read served its own item, the read naming `other` was refused, and the protocol list showed each holder once, before and after. The composite slots answer them. So the card's symptom (a holder's read refused naming the other) is unreachable on a real boot, while its mechanism (tier 2 registers a picked holder) reproduces there. This PR takes the fix route for the mechanism. ### FROM → TO | Reading after the delete of a non-holder's row, two holders, either order | FROM (`45dee177`) | TO | |:--|:--|:--| | Registry bare slot of the name | the last-registered holder's item | empty | | `registry.listItems(type)` entries of the name | 3 (that holder twice) | 2 (each holder once) | | `registry.getItem(type, name)` | the last-registered holder | the registry's first-composite fallback, as before the delete (follows from the empty bare slot; not re-read on the rig) | | Protocol reads: bare / each holder / non-holder / list | 409 both / own / 409 / each once | unchanged | | Heal log line | none | none | | One holder (CONTROL) | that holder's baseline registered | unchanged | `Clause-②: no`: no accepted or served answer of any door moves; only the registry's internal bare slot does. ## Tests `packages/objectql/src/protocol-registry-heal-packageless-refusal.test.ts` (the shared real-registry heal harness), one new top-level describe on a real `SchemaRegistry` and a real `MetadataManager`, in the real boot's shape: each holder in its composite slot, the service keeping the last-registered one, the non-holder's stored row hydrated by `loadMetaFromDb` and kept out of the bare slot. - `dashboard` and `report`, each in both registration orders: after `deleteMetaItem` naming the non-holder, the bare slot is empty, the registry lists each holder once, each holder's read serves its own item, the bare read is the 409 naming both holders in registration order, and the heal logs nothing. - CONTROL, `dashboard` with one holder: the same delete still registers that holder's baseline in the bare slot. **Ablation**, once, with the fix committed first. objectql pins resolve `@objectstack/metadata-protocol` through `dist/`, so each leg was rebuilt and preflighted. - Mutation through `scripts/ablation-replace.mjs`: the guard's `return` line replaced by a marker assignment (anchor 1 → 0, blob `5b888bd3` → `8f51c415`). `pnpm --filter @objectstack/metadata-protocol build` exit 0; `ablation-dist-preflight` exit 0 (marker in `dist/index.js` and `dist/index.cjs`). - Mutated run: **4 failed, 8 passed (12)**. All four two-holder cases failed at the bare-slot assertion: `expected 'shipped:com.acme.beta' to be undefined` (alpha first) and `expected 'shipped:com.acme.alpha' to be undefined` (beta first). The CONTROL and the 7 existing cases passed. - Restore: blob back to `5b888bd3` = HEAD, `git diff HEAD` empty, rebuilt (exit 0), `ablation-dist-preflight --absent` exit 0 (marker absent from all 24 built files, tree clean). Restored run: 12 passed (12). ## Acceptance notes - The no-composite shape the card measured (holders only in the metadata service) does not form on a real boot: every real boot above registered both holders in composite slots. In that harness shape the service holds one item for the name (the other was overwritten), so the registry knows no second holder and this change does not move it. Recorded, not filed. - A delete naming a package that stores no row of the name answered `success: true` and ran the heal (the `report` rig above). With this change it registers nothing for a two-holder name. Recorded for the seat, not filed. ## Verification Readings at the heads named. `HEAD` `929fc53e43` is the final head (origin/main merged in twice; the second merge brought objectstack-ai#33851's edits to the same file, in other functions). <details><summary>Package suites and typechecks</summary> - At `9c4f75f36e` (first merge of main), under the verify lock: `@objectstack/metadata-protocol` typecheck exit 0, test exit 0 (341 files passed, 9 skipped; 22894 tests passed, 43 skipped). `@objectstack/objectql` typecheck exit 0, test exit 0 (596 files, 13177 tests). Direct dependents: `@objectstack/rest` test exit 0 (412 files; 8442 passed, 332 skipped), `@objectstack/runtime` test exit 0 (605 files; 10958 passed, 19 skipped). - At `929fc53e43`, after the second merge (closure rebuilt, exit 0): the heal harness `protocol-registry-heal-packageless-refusal.test.ts` 12/12; metadata-protocol `protocol.registry-heal-package-read.test.ts` plus `protocol.revert-commit-honest-outcome.test.ts` (objectstack-ai#33851's pins on the same walk) 48/48; metadata-protocol and objectql typecheck exit 0. The full suites were not re-run at this head; CI's `Test Core` runs them. </details> <details><summary>Derived gates</summary> - `dispatch-gates --commands --repo objectstack-ai/objectstack` at `929fc53e43`: 67 families derived; 65 run unlocked, each exit 0 (the PR-body gates read this body through `GITHUB_EVENT_PATH`); `check:type-check-debt` run under the verify lock, exit 0 (0 raw tsc errors above the ledger). `check:dual-build-cjs-loads` NOT MEASURED (needs a full-repo `dist/`), left to CI. `--ran` reconciliation: 67 derived, 66 run, 0 not measured, 1 unrun (that one). - ESLint (`--no-inline-config`) over the two touched source and test files: exit 0. </details> <details><summary>Declaration self-check</summary> `Clause-②: no` and `Metadata-protocol: none`, as claimed: no door's accepted or served answer moves (the protocol reads were read before and after on the real boot), no export or spec surface changes, so no `!`, no BREAKING banner and no ADR-0087 marker. `dispatch-gates --tier`: no path-derived mandate, 117 changed lines. Compared with objectstack-ai#33646 (`yes (narrowing)` with `!`: served → refused answers) and objectstack-ai#33769 (`yes (widening)`: new exports): neither shape applies here. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12 Co-authored-by: Claude <noreply@anthropic.com>
…s hold refuses as the plain read does, naming the holders as details.candidates (ADR-0150 D3/D5) (objectstack-ai#33885) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_ Fixes objectstack-ai#32622 Fixes objectstack-ai#32914 Clause-②: no (narrowing) — narrowed: a layered read naming no package, of a name two or more served packages register in code, no longer serves the holder that registered first. The REST `/layers` door on a host that wires no engine for its door chain goes from 200 to 409 naming the holders, and the in-process `getMetaItemLayered` goes from resolving to throwing `PackageScopedNameRefusedError`. The REST `/published` door on a host with no `objectQLProvider` goes to 409 without `details.candidates`. Before, it served the name's package-unbound active row (200) when one stands, and otherwise its published exit (the metadata service's `getPublished` answer, or 501 when the host resolves none). The dispatcher's `/published` swallows the refusal. With no such row it serves its snapshot as before; with one, it moves from that row to the code snapshot (read from the tree). A name one package holds, and every read naming the package, answer as before. Metadata-protocol: none Skills-docs: none — no skill under `skills/` names the layered or published door, and the docs that do (`content/docs/ui/apps.mdx`, `content/docs/references/api/rest-server.mdx`, `content/docs/concepts/metadata-lifecycle.mdx`, `content/docs/plugins/adding-a-metadata-type.mdx`) name the routes without teaching how a name two packages hold is answered there, so no sentence there turns false; the generated `content/docs/references/api/protocol.mdx` describes `packageId` as scoping a same-name collision, which still holds. ## 维护者速读 - 改了什么:按名字读元数据的分层视图(`GET /meta/TYPE/NAME/layers`,以及进程内的 `getMetaItemLayered`),遇到两个包都持有同名项、又没指定包时,现在和普通读一样答 409,并在 `details.candidates` 里列出两个包;以前 REST 在某些部署形态下、以及进程内调用,会悄悄返回先注册的那个包。 - 为什么改:同一个名字,普通读答 409 点名两包,分层读却按注册顺序挑一个(或只给一句话不给结构化候选),调用方无法知道该选哪个包,违反 ADR-0150 D3/D5“歧义要报告、不许猜、要列候选”。 - 风险与回滚:这是收窄(BREAKING):没给 door chain 接引擎的部署上,两包同名、不指定包的 `/layers` 由 200(先注册包的分层)变为 409;进程内 `getMetaItemLayered` 由返回先注册包变为抛 `PackageScopedNameRefusedError`,调用方需改为指定包。只影响“两个包同名且没指定包”的分层读;单一持有者、带 `?package=` 的读、存储行持有者在禁用包旁的进程内读都不变;第一方触达 0。回滚即 revert 本 PR。 - 先看:`packages/metadata-protocol/src/protocol-meta-layered-reads.ts`(`getMetaItemLayered` 新增的 `resolveItem` 判定,和 `withPackageCandidates`);`packages/rest/src/meta-item-read-routes.ts`(`/layers` 路由 catch 加 `packageScopedCandidates`);`packages/rest/src/meta-layers-ambiguous-package.test.ts` 新增的 describe。 - 两分钟验证:`pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/meta-layers-ambiguous-package.test.ts`,预期 12 个用例全绿(两包同名的 `/layers` 两种写法答 409 带 `details.candidates`,进程内读抛同样的拒绝,单持有者照常返回)。 - 需要你做的:无,席位落地。 ## What changes **BREAKING** (`Clause-②: no (narrowing)`, patch level, `Metadata-protocol: none`): three answers move, the three bold rows of the table below. FROM 200 with the first-registered holder's layers TO 409 `RESOURCE_CONFLICT` with `details.candidates`, on REST `/layers` where no engine is wired for the door chain; FROM resolving the first-registered holder TO throwing `PackageScopedNameRefusedError`, in process; FROM the package-unbound active row (200) or the published exit TO 409 without `details.candidates`, on REST `/published` where no `objectQLProvider` is wired (review-b F1 and review#2 S3, measured below). The fix for a caller: name the package. The changeset carries the banner and `adr-0087: not-required (no-migration-prescription)`: no key, stored row, layer or export changes shape. Measured first on `main` `a557fa38` (real `RestServer`, real protocol, real `SchemaRegistry`; two packages registering the dashboard `sales`, no stored row): | door | before | after | |---|---|---| | plain `GET /meta/dashboard/sales` | 409 `RESOURCE_CONFLICT` with `details.candidates` | unchanged | | REST `/layers`, engine wired for the door chain | 409, sentence only (no `details`) | 409 with `details.candidates` | | REST `/layers`, no engine wired (no service copy, or a service copy of one holder) | **200, the first-registered holder's layers** | 409 with `details.candidates` | | in process `getMetaItemLayered({ type, name })` | **resolves, the first-registered holder's layers** | throws `PackageScopedNameRefusedError` (409, `refusal.candidates` naming both) | | REST `/published`, no `objectQLProvider` | **the published exit: the metadata service's `getPublished` answer, or 501 `NOT_IMPLEMENTED` when the host resolves no metadata service** | 409 `RESOURCE_CONFLICT`, no `details` | | REST `/published`, no `objectQLProvider`, the name also has a package-unbound active row | **200, that row** | 409 `RESOURCE_CONFLICT`, no `details` | | REST `/published`, engine wired | 409 `RESOURCE_CONFLICT`, no `details` | unchanged | | dispatcher `/published`, engine registry not reachable, no package-unbound row | the snapshot (the throw is swallowed) | unchanged (not pinned) | | dispatcher `/published`, the same, with a package-unbound active row | **that row** (read from the tree) | the code snapshot: the throw is swallowed (read from the tree, not pinned) | | `?package=` of either holder, and a name one package holds | served | unchanged | - **`getMetaItemLayered` (objectstack-ai#32914, and the REST pick folded into objectstack-ai#32622 from objectstack-ai#32624).** Naming no package, a type addressed by package is judged by the registry's package-scoped resolver (`registry.resolveItem(type, name, null, member)`), as `getMetaItem` judges it (`packagelessScopedRead`), before any layer is read and whatever the metadata service holds. Only the judgment is taken; a name one holder holds keeps the layers it had. Stored-row holders are not this judgment's: the door refuses them in step 1c, as contract review S1 on objectstack-ai#33130 settled, and the in-process read in that state still resolves (the `[objectstack-ai#32354]` pin is unchanged and green). - **REST `/layers` catch (objectstack-ai#32622).** `handleRouteError(res, error, undefined, { packageScopedCandidates: true })`, as the plain read's catch (objectstack-ai#32201). The deprecated `?layers=true` spelling already answered through that catch. The dispatcher already carried the candidates (`errorFromThrown`). - **Step 1c's refusal (objectstack-ai#32622).** The package-less writes' refusal the layered door answers for a name whose active rows two packages hold (objectstack-ai#28337) keeps its sentence, code, status and `?package=` remedy, and now carries its holders as a package-scoped refusal by shape (`refusal.status: 'refused'`, `candidates` in the `/actions` shape), so both transports answer `details.candidates`. The save and delete doors do not move. This is the item the objectstack-ai#32607 seat re-ruling left to this card ("Carrying `details.candidates` on `/layers` remains objectstack-ai#32622's job", 6820653691). - `protocol.ts`: docblock only (9 lines, under the seat's 14:45Z rule change). `packagelessLayeredReadRefusal`'s docblock now says the refusal carries its holders as `refusal.candidates`, and that `getMetaItemLayered`'s in-process readers meet the registry's refusal of a name two packages register in code. The emitted `dist/index.js` and `dist/index.cjs` differ from `HEAD~1`'s in those comment lines alone (two builds, raw diff). A later commit adds the `@throws` for the two-holder refusal to `getMetaItemLayered`'s docblock (review-b N2, 4 lines). ## Tests - `packages/rest/src/meta-layers-ambiguous-package.test.ts`, new describe `[objectstack-ai#32622, objectstack-ai#32914] a name two packages register, read naming no package`: 3 compositions (engine wired; no engine wired; no engine wired with a metadata-service copy of the first holder) x 2 registration orders, both spellings answer 409 `RESOURCE_CONFLICT` with both holders as `details.candidates` and serve neither holder; in process the layered read refuses (`code` + `status` + `refusal.candidates`) in every composition and each `packageId` read still serves its holder; CONTROL: a name one package registers is served in process and on both spellings, and `?package=` serves its holder. - `[objectstack-ai#28337]` pins on both transports (`rest/.../meta-layers-ambiguous-package.test.ts`, `runtime/.../meta-layers-ambiguous-package.test.ts`, RestServer and hono): the envelope is now the writes' envelope plus `details`, with both holders as `details.candidates`; the writes' answer is asserted to carry no `details`. - `[objectstack-ai#32354]` ruling-Q2 pins (`rest/.../meta-disabled-package-doors.test.ts`, `runtime/.../meta-disabled-holder-served-stack.test.ts`): `/layers` now asserts `details.candidates` naming only the served holders. - `metadata-protocol/.../protocol.packageless-layered-read-refusal.test.ts`: the step-1c refusal carries `refusal.candidates`; the save's refusal carries none. - `rest/.../meta-qualified-item-route.test.ts`, new top-level describe `objectstack-ai#32622 — the other /layers refusal exits carry details.candidates` (review#2 S1). It covers two exits. The bare action read with the platform's item beside A's answers `[A, platform]`. `/layers?package=` of a package holding none answers `[A]`. Each is asserted equal to the item read's candidates. The stale `objectstack-ai#32365` comment there is corrected: `/layers` carries the candidates, `/published` its text. S1 ablation (the `/layers` catch without `packageScopedCandidates`, rest source): both new cases red (`AssertionError: {"error":"The action \"approve\" is held by 2 holders …` and `… is not held by package \"com.acme.gamma\" …`), 2 failed of 325; restored with blob equal to HEAD and `git diff HEAD` empty; baseline 325/325. <details><summary>Ablations (each leg restored; blob == HEAD proven by ablation-replace)</summary> HEAD `6e50dbd5c7`. Baseline green: rest 62/62, metadata-protocol 3/3, runtime 367/367 (the three files above per package). - **A2, the `/layers` catch without `packageScopedCandidates`** (rest source, read from `src`): 9 red, e.g. `/layers: expected [] to deeply equal [ 'package:app.alpha_demo', …(1) ]` and the ruling-Q2 pin `expected [] to deeply equal [ Array(2) ]`; the in-process and CONTROL cases stay green, as expected. - **A1, `getMetaItemLayered` without the resolver judgment** (metadata-protocol rebuilt, marker `ABLATED_32914` present in 2 built files): 6 red, the no-engine cases `/layers: … "label":"app.alpha_demo code" …: expected [ 200, … ] to deeply equal [ 409, 'RESOURCE_CONFLICT' ]` and the in-process cases `expected [ undefined, undefined ] to deeply equal [ 'RESOURCE_CONFLICT', 409 ]`; the engine-wired cases stay green (the door's owner step refuses there), as expected. - **A3, step 1c's refusal without its candidates** (metadata-protocol rebuilt, marker `ABLATED_32622` present): metadata-protocol `expected undefined to be 'refused'`; rest `expected [ 'code', 'error' ] to deeply equal [ 'code', 'details', 'error' ]`; runtime RestServer and hono twins red the same way (hono: `[ 'code', 'httpStatus', 'message' ]`). A first A3 attempt was refused by `ablation-replace` (its replacement contained the anchor, so the anchor count did not drop) and restored at once; its green readings were a no-op and are discarded. - Restore leg: metadata-protocol rebuilt, both markers absent from all 24 built files, working tree clean. </details> ## Acceptance notes - review-b F1 is closed on the prose faces: the `/published` rows are in the changeset banner, the `Clause-②` line and the table. Its follow-up card objectstack-ai#34101 was filed, then closed as not planned by triage under the p3 standard. So the REST and dispatcher `/published` answers stay different (REST 409 without `details.candidates`; the dispatcher swallows the throw and serves the snapshot), and neither is pinned. Recorded here as accepted. - review-b N1 / review#2 N1: `echoSecurityCatalogMutation` recovers from the refusal only when the event names no address. At a package-unbound address of a `permission` name two packages register, the echo now throws where it used to read and skip; the projector runner and the boot pass catch it and warn. No grant, lock or served answer changes (read). Its carrier objectstack-ai#34101 is closed, so it is recorded here as accepted. - review#2 S1 is folded (Tests above). review#2 S3 is folded: the stored-row FROM and the dispatcher row are in the changeset, the `Clause-②` line and the table. REST was measured (see the S3 block under Verification); the dispatcher rows are read from the tree. - review#2 S2 (read, not measured): "Step 1c's `details.candidates` are the packages the active rows are bound to (`packagelessAddress().candidates`), not the holders the plain read judges." Where a package's row stands beside its own customization pair's row (the objectstack-ai#32662 scope-note (b) state), the plain read serves that package's row, while bare `/layers` answers 409 and now names the pair as `{ kind: 'package' }`; a row the reads decline is named the same way. Not folded and no card, under the p3 standard. - review#2 S4 (read, not measured): "The layered read takes the resolver's judgment and not its answer." For a name that an overridable baseline and one other package both hold (`email_template`, baseline `com.objectstack.service.email`), the plain read serves the other package. With no metadata-service copy, the layered read's code layer is still the artifact lookup's first composite, by registration order. Not introduced by this diff. Not folded and no card, under the p3 standard. - review#2 N2 (pin breadth: candidates compared sorted, `dashboard` only, no bundle member, no dispatcher pin on a boot with no service copy) is recorded as accepted. N3 (body staleness) is fixed in this body. - Declaration re-read after the diff, on the area seat's order: the claim declared `Clause-②: no`; measured, two answers move (the bold rows above), so the PR body and the changeset now declare `Clause-②: no (narrowing)` with the BREAKING banner, the `!` title and the ADR-0087 marker, after the objectstack-ai#33646 precedent. On the composition that wires the engine (the default `RestServer` host) the door already answered 409. No gate reads the claim comment's line (the queue and level gates read this body and the changesets), so the claim comments were not amended. - The in-process readers already handle the refusal: the packaged-permission-set lock gate and the security catalog echo catch a 409 naming package candidates and read each holder at its package (ADR-0150 D4, objectstack-ai#31698). - `git merge-tree --write-tree --name-only` of this head against the open PRs sharing a file and `origin/main`: objectstack-ai#33898 (`64c5d88452`, shares `protocol.ts` and `meta-qualified-item-read.test.ts`), objectstack-ai#33889 (`bdb3a20a71`, shares `meta-disabled-holder-served-stack.test.ts`) and `origin/main` (`895783a1e8`) each exit 0, no conflicted path. objectstack-ai#33898's `protocol.ts` hunks sit near lines 322 and 7089; the docblock here is near line 4205. ## Verification <details><summary>REST /published FROM and TO (review-b F1), measured at e516f35</summary> A throwaway probe beside the REST pins, not committed. It used the same real protocol and real `SchemaRegistry`, with two packages registering the dashboard `sales`, `GET /meta/dashboard/sales/published` naming no package, both registration orders. TO is the head as built. FROM is the head with `getMetaItemLayered`'s resolver call ablated (`ablation-replace` landed, the marker present in 2 built files, then restored: blob equal to HEAD, marker absent from all 24 built files). | composition | FROM | TO | |---|---|---| | engine wired (`objectQLProvider`) | 409 `RESOURCE_CONFLICT`, `details` null | 409 `RESOURCE_CONFLICT`, `details` null | | no `objectQLProvider`, no metadata service | 501 `NOT_IMPLEMENTED` ("Nothing is runtime-published for this item, and this kernel has no code/package store …") | 409 `RESOURCE_CONFLICT`, `details` null | | no `objectQLProvider`, the protocol's service holding a copy of the first holder (two shapes) | 501 `NOT_IMPLEMENTED` (the REST host resolves no metadata service of its own) | 409 `RESOURCE_CONFLICT`, `details` null | The FROM on a host whose REST metadata service has `getPublished` (the service's answer, served 200) was NOT MEASURED. The probe shape for it, which stubs the host's `resolveMetadataService`, never got the verify lock: four 540 s waits behind pid 16926, a `pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=1` holding over 60 minutes. That row is read from the tree (`meta-item-history-routes.ts`, the fallthrough after the overlay read). Each VERDICT command-exit 0. </details> <details><summary>REST /published with a package-unbound active row (review#2 S3), measured at 9dd398c</summary> A throwaway probe beside the REST pins, deleted and never committed. Same real protocol and `SchemaRegistry`. A package-less `saveMetaItem` stores the dashboard `sales` as a package-unbound active row (`[sales, null, active]`). Then two packages register `sales` in code, both registration orders, and the RestServer has no `objectQLProvider`. TO is the head as built. FROM is the head with the resolver call ablated: the marker was present in 2 built files, then restored, with the blob equal to HEAD and the marker absent from all 24 built files. | door | FROM | TO | |---|---|---| | `GET /meta/dashboard/sales/published` | 200, the package-unbound row (`env row`) | 409 `RESOURCE_CONFLICT`, `details` null | | `GET /meta/dashboard/sales` (plain read) | 409 with `details.candidates` naming both | the same | VERDICT command-exit 0. The dispatcher rows are read from the tree, not measured. </details> <details><summary>Dogfood battery, on fa7fb66</summary> Built `@objectstack/dogfood^...` (turbo, VERDICT command-exit 0), then under the lock `pnpm --filter @objectstack/dogfood test` with no `OS_TEST_SHARD` and no path: VERDICT command-exit 0, Test Files 467 passed, 3 skipped (470); Tests 3959 passed, 42 skipped (4001). The final head adds only the `protocol.ts` docblock commit; the emitted JS differs from `fa7fb66a7c`'s in comment lines alone, so the battery reading covers the head's executable bytes. The final head adds a changeset edit and the 4-line `@throws` docblock, again comment-only. </details> <details><summary>Packages, on head 6e50dbd (before merging main) and on 02d6109 (after it)</summary> On `6e50dbd5c7`, under the verify lock (VERDICT command-exit 0): typecheck and test green for metadata-protocol (22883 passed), rest (8451), runtime (10874), plugin-security (6681), objectql (13110), service-automation (3976), client (812), cloud-connection (1217), plugin-auth (5465), plugin-email (1018), service-messaging (966), service-package (144), plugin-dev tests (89). organizations, plugin-approvals, verify, cli and three typechecks went red there on `Cannot find module` / `Failed to resolve entry` for packages this worktree had not built (build state, not this diff). On `02d6109dde` (one merge of `origin/main`, no conflict, no touched file moved upstream), after building the whole closure of those packages (turbo exit 0), under the lock (VERDICT command-exit 0): the targeted files rest 62/62, metadata-protocol 3/3, runtime 367/367; typecheck green for all 17 packages (metadata-protocol, rest, runtime, plugin-security, objectql, service-automation, client, cloud-connection, organizations, plugin-approvals, plugin-auth, plugin-dev, plugin-email, service-messaging, service-package, verify, cli); tests green for service-automation (3977), organizations (252), plugin-approvals (1652), plugin-dev (89), verify (439), cli unit (6000). </details> <details><summary>Gates</summary> The derived set (`dispatch-gates.mjs --commands`, 70 commands) ran on `d0a5dbd220`: 67 exit 0. `check:test-source-alias` was red on a runtime pin file this PR edits (a dynamic `@objectstack/metadata` load in a clocked window); fixed in `6e50dbd5c7` (module-top import), re-run exit 0. `check:dual-build-cjs-loads` and `check:type-check-debt`: PREREQUISITE NOT MET locally (no full build; the lock queue), so NOT MEASURED here; CI runs both. PR body gates on this body: closing-keyword-parity, partof-closing-keyword, changeset-no-major and adr-0087-registration exit 0. ESLint on the changed files exit 0. The union on the final head is cited in the report on objectstack-ai#32622. On `e516f3534b`, re-derived (74 commands, the `protocol.ts` touch adds `check:adr-symbol-anchors`, `check:facade-delegation-only`, `check:filter-alias-parity`, `check:wildcard-fallthrough`): 73 exit 0; `check:type-check-debt` exit 3 PREREQUISITE NOT MET (its build lost the lock queue), NOT MEASURED, CI runs it. `dispatch-gates --ran`: 74 accounted, 73 run, 1 NOT-MEASURED, 0 UNRUN. `check-platform-checklist --changed-from origin/main` exit 0. On this body: changeset-no-major (LEVEL AXIS reads `no (narrowing)` + `none` at patch), adr-0087-registration (1 declared-breaking changeset, `not-required (no-migration-prescription)`), closing-keyword-parity and partof-closing-keyword exit 0. On the final head `e57e7c0566` (the `/published` banner row and the `@throws` docblock): the 74 derived commands again gave 73 exit 0, with `check:type-check-debt` exit 3 PREREQUISITE NOT MET, so NOT MEASURED. `--ran` accounted for 74 (73 run, 1 NOT-MEASURED, 0 UNRUN). `check-platform-checklist --changed-from origin/main` exit 0. Changeset gates (adr-0087-registration, changeset-no-major, empty-changeset, changeset-fixed, nul-bytes) exit 0. `git merge-tree --write-tree --name-only` against `origin/main` `e71ecc1b32` exit 0, so it still merges clean now that objectstack-ai#33898 is merged; objectstack-ai#33889 `bdb3a20a71` exit 0. CI `Test Core (3/8)` on `e57e7c0566` failed twice: run 43743965993, job 132903743253, and the lane's one re-run, job 132914286588. Both times the only failed task was `packages/qa/scenarios` `run-date.test.ts`, on vitest's 5000 ms timeout. The first run failed `2028-03-31` at 6278 ms. The re-run failed `2028-02-28` at 5619 ms and `2028-02-29` at 6907 ms, while `2028-03-31` passed there at 4615 ms. A different case each time, and no assertion failed. The test imports only `@objectstack/spec` and the scenarios package's own sources, which this diff does not touch. The same file failed the same way on `main` without this PR: the merge-queue run of the unrelated objectql-only objectstack-ai#33902 (run 43747969462, job 132917233366, Test Core 4/8) failed `2028-02-28` at 5719 ms. `main`'s push run does not run scenarios at all (affected-only shards). Locally, on the branch merged with `origin/main` at `9dd398cda0`, the file passed 3 of 3 runs (34/34 each, about 5.4 s of tests). The scenarios closure is byte-identical to `main` there (`git diff origin/main -- packages/qa/scenarios packages/spec docs/qa` is empty). Read: a load timeout that is `main`'s, not this PR's. No rerun from here. On the final head `a2b29893d0`, two merges of `origin/main` landed, both clean. `9dd398cda0` came first. `a2b29893d0` contains objectstack-ai#34104 (`e9fb09871d`), the fix for those run-date timeouts (p0 objectstack-ai#34081). Under the lock, at that head: - build closure exit 0; - targeted pins: metadata-protocol 3/3, rest 389/389 (the S1 describe included), runtime 421/421, scenarios `run-date.test.ts` 35/35; - typecheck exit 0 for metadata-protocol, rest and runtime. Between the two merges, the runtime typecheck went red once, on `meta-object-publish-column-changes.test.ts` (`TursoDriver` not assignable to `SqlDriver`). The cause was build state: `@objectstack/driver-turso` is a peer dependency, so it is outside `runtime^...`, and its `dist` was older than `driver-sql`'s. It went green once `driver-turso` was built. Derived gates on that head: - 75 commands, 74 exit 0; - `check:type-check-debt` exit 3 PREREQUISITE NOT MET, so NOT MEASURED; - `--ran` exit 0; - `check-platform-checklist` exit 0; - changeset gates exit 0; - `git merge-tree` against `origin/main` `bf594ebd72` exit 0. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Elon · project thread
Fixes #33386
Clause-②: yes (narrowing) — widened: a bare flow or connector name an enabled and a disabled package hold, read with no package or from a caller whose closure holds both, is served the enabled holder's slot or instance where it was refused naming both. Narrowed: the disabled holder's own callers, a caller reaching the name only through it, its address and its runs find no flow; refusals name only the packages that serve the name. With no holder of the name disabled, every answer is unchanged.
Metadata-protocol: none
维护者速读
/automation的按名门(裸名、命名空间地址、_env)、连接器连接门、流程动作/端点、启动准入的记录读取走查、MCP 恢复门,以及引擎的裸入口(execute/getFlow/toggleFlow)和运行中的子流程调用,改为只按"仍在服务的持有包"判断:剩一个就走它自己的槽位,剩两个以上 409 只点名在服务的包,一个不剩就是"没有该流程"。停用包自己的调用方拿不到流程,也绝不会被换成别的包的流程。_env或第三命名空间的地址上,409 只点名在服务的包,两个都停用时地址答 404;在服务包自己的地址上仍点名全部持有者。停用包的触发器仍会触发它的槽位(与 main 相同),延后到 fix(service-automation): a runtime-disabled holder's trigger binding still dispatches its flow slot (ADR-0150 D3, #33386 amendment 3) #33748。回滚即还原本 PR。packages/services/service-automation/src/engine.ts的resolveFlowKey/servedBareFlowKey(引擎裸入口与子流程调用);packages/runtime/src/flow-slot-view.ts的servedFlowResolution与absentFlowView(修正 4:停用包自己的调用方);packages/runtime/src/domains/automation-address.ts的bareNameAdmission与admitAutomationAddress。pnpm --filter @objectstack/runtime exec vitest run src/flow-caller-package.test.ts src/domains/automation-addressed-route.test.ts,预期全部通过;其中[#33386]两个 describe 按两种注册顺序逐行断言下表。What changes
A flow name two packages hold has one engine slot per holder (ADR-0150 D4/D9, #31696), and a connector name one instance per holder (#31699). Every door that reads such a name now judges the served holders (a disabled package holds no name, ADR-0150 D3), under seat ruling 6884403301 and its nine amendments, and the Q2 ruling 6888807772 for the connector address:
packages/runtime/src/domains/automation-address.ts:bareNameAdmission(new) judges a bare by-name door. It answers the one served holder's slot, or a 409 naming the served holders, or nothing (the bare path, which answers its own 404).admitAutomationAddressjudges the qualifier over the served holders. The slot is still chosen when the name is held by two or more packages over every holder, because the slots are keyed that way (amendment 7).bareNameRefusal(over every holder) is unchanged and still read by the MCP resume door to tell a run row's slot.packages/runtime/src/domains/automation.ts: the admission arm serves a bare name's single served holder from its slot (flowSlotView) or instance (ConnectorConnectionRequest.package), the same way its address is served. A bare flow name on an engine with no slot entries keeps the bare service, whose bare entries judge the served holders themselves.packages/runtime/src/flow-slot-view.ts:flowServiceForCaller,flowWalkReads(rootPackage,callee) andflowHolderForCallerjudge a name two packages hold over the served holders. A caller whose own holding is the disabled one gets no flow (absentFlowView, new), never a closure holder's (amendment 4).runSlotPackageno longer answers a key's own package when that package is not among the holders the caller judges by (amendment 3).endpointPackageOfstays judged over every holder: it names the package an endpoint belongs to, and the flow is then resolved for that package.packages/services/service-automation/src/engine.ts:resolveFlowKeyjudges a name two slots hold over the served holders (servedCaller). One served holder gives its slot, two or more are refused naming them, and none isabsent(no flow).execute,getFlowandtoggleFlowread it (servedBareFlowKey, amendment 9). The removal and history entries (unregisterFlow,withdrawFlow,rollbackFlow,getFlowVersionHistory) keepbareFlowKey, over every holder. The subflow guards' recorded arming verdicts (flowCallKey) ask{ durable: true }, over every holder, as before.packages/services/service-automation/src/plugin.ts:flowNameResolvertakesservedCaller. A caller whose own holding answers, inside a disabled package, getsnot-found. Without that option the resolver answers as before, so the activation ledger'sstillHoldsstill finds a disabled package's own flow.Clause-② table
CRM and HR each hold the flow
convert(one engine slot each) and the connectormail(one instance each). OPS depends on CRM, BOTH depends on both, NONE on neither. Every row is pinned in both registration orders, and with HR disabled too (symmetric). With nothing disabled, every row answers asmaindoes (the CONTROLs).main)/automation/convertread, trigger, toggle, runs;/automation/trigger/convert; engineexecute/getFlow/toggleFlow; a flow action with no packageambiguous-in-closurenaming bothoutside-closurenaming HR/automation/crm/convert/…,/automation/trigger/crm/convertnot-held-by-qualifiernaming HR/automation/_env/convert/…, a third namespace/automation/convert/runs/:runId[/…]), a run filed under CRM's slot keyresume_runof a run filed under CRM's slot key, through CRM's or HR's flow actionrootPackage) for the bare namenull_envtake the bare path, which answers not foundflowSlotKey), run keys,flowDispatchHolder, the credential channel'sat()/isShared, the subflow guards' verdicts,bareNameRefusalPUT/DELETE /automation/:ns/convert,POST …/convert/clone) at an address naming CRM, at_env, at a third namespaceresume_runof HR's parked run through a package-less flow action, or through BOTH's (depends on CRM and HR)/automation/connectors/crm/mail/connection(names the disabled holder)not-held-by-qualifiernaming HR; the service is not asked/automation/connectors/hr/mail/connection(names the served holder)package: HR)/automation/connectors/mail/connection(bare)package: HR)/automation/connectors/_env/mail/connection, a third namespace_env_envreach the service with no packageQ2 condition 2 (legacy package-less row). C2 was checked against a legacy connection row that names no package (
connector-connection-door.test.ts, the case "a package-less row a second (disabled) holder makes no one package's"). Through the served holder's package, the service answers that state with the same 409 ("stored-references bind") as it answers the bare read, and the row stays. The address names the served holder's slot before and after this PR, so C2 does not move. The new case pins that answer, and it is the answer C3 now hands the bare door in that state (before: the door's own 409 naming both). Condition 3: the service's address case for the disabled holder (404) is kept as it is.A name one package holds, or none, is judged as before (CONTROLs). First-party count: no first-party composition ships a flow or connector name two packages hold and disables one of them.
Deferred: amendment 3's trigger binding (a runtime-disabled holder's trigger still fires its slot, as on main) → #33748.
No migration. No schema key, stored row, slot key, run key or dispatch key changes, so there is nothing to rewrite: the answers that move follow a reversible package state. The changeset says the same in visible text.
Tests
packages/runtime/src/flow-caller-package.test.ts: the R4-G parity describe, whose premise this card reverses, is replaced bythe #31696 flow doors judge the served holders (ADR-0150 D3, #33386). It runs over a realSchemaRegistry(disablePackage, the served filter), with an engine double whose bare entries judge the served holders. Per registration order it has a CONTROL with nothing disabled, CRM disabled and HR disabled (each a full answer table over six callers, four namespaces and_env: rows F1 to F8 and F12 to F14), both disabled (F13), one disabled holder (CONTROL), and no holder (CONTROL).packages/runtime/src/domains/automation-addressed-route.test.ts:[#33386] the by-name doors judge the served holders…, through the realHttpDispatcherover a realSchemaRegistry, in both orders. It covers the flow rows F1, F6, F7 and F8, the definition writes F15 to F15c, and the connector rows C1 to C5.packages/runtime/src/domains/automation-run-doors-per-slot.test.ts:[#33386] the run doors while a holder is disabledcovers rows F9 and F10 at all five run doors, with both disabled.packages/runtime/src/mcp-resume-run.test.ts: rows F11 and F16, and the CONTROL (HR's run through HR's action).packages/services/service-automation/src/flow-slots-per-package.test.ts: the engine's R4-G parity describe is replaced by[#33386] a run of a name two slots hold judges the served holders. It runs on the real engine and the realflowNameResolverover a realSchemaRegistry, with a runtime disable (both slots armed) and a boot disable (one armed), in both orders. It covers F1 to F5, the slot keys and dispatch key unmoved (F14), and both disabled (execute/getFlow/toggleFlow: not found).packages/services/service-automation/src/connector-connection-door.test.ts: the Q2 condition 2 case (above).codeRESOURCE_CONFLICT, status 409) and candidates.Acceptance notes
PUT/DELETE /automation/:ns/:nameand the clone, at the served holder's own address, keep their 409 naming every holder (F15b). At an address naming the disabled holder, at_envor at a third namespace, the address admission now refuses them 409 naming the served holder only (F15), and with both holders disabled an address answers 404 (F15c). An earlier draft of this note and of the changeset said every such write keeps its 409 naming every holder; that was wrong and is corrected. A bare definition write (PUT /automation/convert) is refused by the metadata store over its stored rows (flowWriteRefusal), which this PR does not touch; it is not pinned here.triggerRunexecutes the armed slot key with no served check), as onmain; nothing is substituted. Deferred by the seat to fix(service-automation): a runtime-disabled holder's trigger binding still dispatches its flow slot (ADR-0150 D3, #33386 amendment 3) #33748.inboundHookSlot,/automation/hooks/:name). Its bare form for a name two slots hold stays refused, and its log names every holder. The ruling's nine amendments do not name it. It is an anonymous door whose refusal is logged, not answered. A design question, raised in the report.endpointPackageOf. An endpoint's own package is read over every holder of itsapiname, and the endpoint's flow is then resolved for that package (served, F3/F4). Anapiname two packages hold, one disabled, still names no package there. Raised in the report.flowCallKey: arming verdicts recorded at registration) keep reading over every holder. A disable re-judges nothing, so a served reading there would record a verdict the next enable contradicts (AGENTS.md, startup registry reads).Verification
At head
99fca269(review#3 should-fixes, on top of a merge oforigin/mainat9bb45bb9). Since4a3db01conly tests and text changed:.changeset/33386-flow-doors-served-holders.md(+6/-1),automation-addressed-route.test.ts(+31/-2: one pin, F15 to F15c, and a body argument for its call helper),mcp-resume-run.test.ts(+19: F16). No source file changed, so the dependents and the dogfood battery were not re-run.pnpm --filter @objectstack/runtime test: Test Files 603 passed (603), Tests 10902 passed, 19 skipped (10921). VERDICT command-exit 0.pnpm --filter @objectstack/service-automation test: Test Files 282 passed (282), Tests 3977 passed (3977). VERDICT command-exit 0.pnpm --filter @objectstack/service-automation --filter @objectstack/runtime typecheck: VERDICT command-exit 0 (bothcheck:test-typecheck: OK).check-adr-0087-registration --base origin/main,check-changeset-no-major,check-empty-changeset,check-changeset-fixed,check-nul-bytes,eslint --no-inline-configon the two touched tests: each exit 0.The readings below are at
4a3db01c(after mergingorigin/mainatdd291b83), unless named.Status: done. All nine amendments of ruling 6884403301 and the three Q2 conditions are implemented and pinned, except amendment 3's trigger binding, deferred to #33748 (table rows above; amendment 9's engine bare entries
execute/getFlow/toggleFlowmove in this PR). Not done: see the last list.Tests (lock VERDICT per step, every step exit 0)
pnpm --filter @objectstack/runtime test: Test Files 603 passed (603), Tests 10857 passed, 19 skipped (10876).pnpm --filter @objectstack/service-automation test: Test Files 282 passed (282), Tests 3977 passed (3977).pnpm --filter @objectstack/service-automation --filter @objectstack/runtime typecheck: exit 0 (bothcheck:test-typecheck: OK).src/mcp-resume-run.test.ts: 45 passed.test: hono 258, example-crm 51, connector-mcp 119, connector-openapi 111, connector-rest 57, connector-slack 10, plugin-dev 89, cloud-connection 1211, trigger-record-change 122, trigger-schedule 256, client 812, plugin-approvals 1652, example-todo 249, example-showcase 545, http-conformance 292, verify 437: all passed.@objectstack/cliunit layer: Test Files 421 passed (421), Tests 5979 passed (integration layer declared to CI).objectstack-blank: NOT MEASURED, reason: not a workspace project (the filter matches nothing).pnpm --filter @objectstack/dogfood testat4a3db01c: Test Files 467 passed, 3 skipped (470); Tests 3958 passed, 42 skipped (4000).eslint --no-inline-configon the touched files: exit 0.Ablations (each through `scripts/ablation-replace.mjs`, restored to the HEAD blob; `git diff HEAD` empty after)
Run at
e4729b39(pre-merge; the four source files are identical at the head):resolveFlowKeyasks over every holder ({ includeDisabledPackages: true }for the run):flow-slots-per-package.test.ts10 of 51 red.admitAutomationAddressjudges a shared name over every holder: runtime 3 files, 22 of 158 red.servedFlowResolutionwithout the disabled-own-caller branch (amendment 4): 6 of 158 red.servedCallerbranch disabled:flow-slots-per-package.test.ts6 of 51 red.bareNameAdmissionreads the served resolution over every holder: 22 of 158 red.Gates
dispatch-gates.mjs --commands, 74 at4a3db01c): 71 exit 0.check-adr-0087-registration --base origin/mainexit 0 (not-required (no-migration-prescription)read).node scripts/check-plugin-teardown-shape.mjs --self-test: NOT MEASURED, exit 3 PREREQUISITE (the shallow clone cannot reach its pinned positive control).pnpm check:dual-build-cjs-loads: NOT MEASURED, it reads every package'sdist/; CI runs it.pnpm check:type-check-debt: exit 0 ate4729b39; NOT MEASURED at4a3db01c(its closure build lost the lock to the dogfood run, then the re-run was stopped at hand-over).Not done
check:type-check-debtre-run at the head (exit 0 ate4729b39; NOT MEASURED since). The CI families at99fca269: the seat reads the PR's check-runs.endpointPackageOffor anapiname two packages hold, and a one-holder disabled name at the bare doors (Acceptance notes).🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut