Repository navigation
Commit 162fe54
fix(runtime): the automation write doors keep a flow whose only package is disabled, whatever its package's enable state (#34315)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCpddLFmKzR39wJWZpkRMCi)_
Fixes #34145
Clause-②: yes (widening)
Metadata-protocol: none
> **Widening:** `AutomationEngine.getHeldFlow(name)` is a new public
method on a class `@objectstack/service-automation` exports from its `.`
entry (seat rulings 6911640332 on #34145: R1 stands, R2 superseded, M1 =
B). Nothing narrows: no `!`, no BREAKING banner, no ADR-0087 marker.
## 维护者速读
- 改了什么:`/automation` 的四个写入口(克隆新名占用检查、写入被拒后的回填副本、PUT 与对已有名字的 POST
沿用的凭据、DELETE 存在性检查)对"仅一个包持有"的名字改读引擎新增的
`getHeldFlow`(按全部持有者判断)。对"两个包共有"的名字,`getHeldFlow` 拒绝后回落到服务视图
`getFlow`,行为与 main 相同(座席裁决 6911640332,M1 = B)。克隆入口把共有名字的拒绝捕获为自己的"名称已占用"
409。
- 为什么改:PR #34048 之后,唯一持有者的包被停用时 `getFlow`
答"无此流程",这四处问的却是持久问题,答案不应随包的启停而变。
- 风险与回滚:无收窄;新增公开方法 `getHeldFlow`
是放宽。唯一可见变化是:两包都启用时克隆到共有名字,原先抛出引擎拒绝,现在返回克隆入口自己的"名称已占用",状态码与 code
不变。两个持有包都被停用的共有名字,克隆入口仍不视为占用(与 main 相同,已在注释与 changeset
写明,后续卡由席位立)。回滚即还原本 PR。
- 先看:`packages/runtime/src/domains/automation.ts` 的
`heldFlowReader`(共有名字的回落)与
`cloneTargetHeld`;`packages/runtime/src/domains/automation-write-doors-durable-34145.test.ts`
末尾的 booted-kernel 用例。
- 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run
--maxWorkers=2
src/domains/automation-write-doors-durable-34145.test.ts`,预期全部通过,其中含真实元数据协议保存用例。
- 需要你做的:无,席位落地。
## What changes
- **`AutomationEngine.getHeldFlow(name)`** (service-automation,
`engine.ts`): the flow the engine holds under a bare name, judged over
every holder through `bareFlowKey`. A disabled sole holder is included.
A name two packages hold is refused `409`. Like `getFlow`, it settles
the name first (review#1 N1, in the docblock).
- **`heldFlowReader`** (runtime, `automation.ts`), used at the four
write doors: the clone's taken-name probe, the `registerAndSaveFlow`
put-back copy, `keepStoredFlowCredentials`, and the
`unregisterAndDeleteFlow` existence probe.
- It asks `getHeldFlow`.
- If that raises `PackageScopedNameRefusedError` (a name two packages
hold), it falls back to `getFlow`, the served holder, as on `main` (M1 =
B).
- A service without `getHeldFlow` is asked its `getFlow`.
- **`cloneTargetHeld`**: the clone's probe catches the refusal of a name
two served holders hold and answers it with the door's own name-taken
`409`, as `flowWriteRefusal`'s clone arm does (L1 nit, review#1 S2).
- **For a flow whose only package is disabled**, the four doors return
to the last release's answers:
- clone onto the name: `409`;
- put-back: the held body;
- `PUT`, or `POST /` onto the name: keeps the stored credential;
- `DELETE`: `200`.
- **For a name two packages hold**, the doors answer as on `main`. The
one change is the both-enabled clone, which now gets the name-taken
answer.
- **Stated, unchanged (review#1 delta 6915149305, S5 option 1):** a name
two packages hold with BOTH holders disabled is not taken at the clone
door, as on `main`: `getHeldFlow` refuses the shared name, the served
fallback `getFlow` answers `null`, and the copy is admitted. The clone
door's comment and the `#34145` changeset say so; no code path moves.
- **`.changeset/33905-disabled-sole-holder-flow.md`** (pending from PR
#34048), corrected (L1 F3, review#1 S3).
- Its three write-door bullets are replaced by one paragraph. It says
those doors keep the last release's answers for a disabled sole holder,
and read a name two packages hold on its served holder.
- Every other line is byte-identical.
- **DELIBERATE CORRECTION** of the pending note
`.changeset/33905-disabled-sole-holder-flow.md` (added by PR #34048,
unreleased). Its paragraph "Three HTTP write doors ask `getFlow` whether
the name is held, and move with it for such a flow." and its three
bullets (clone admits the copy, put-back withdraws the name and drops
the credential, `DELETE` answers `404`) would be false after this PR.
The corrected sentences:
> The HTTP write doors that ask a lasting question of the name do not
move with it: the clone door's taken-name check on the new name, the
definition a refused `POST /automation` or `PUT /automation/NAME` puts
back, the stored credential a `PUT /automation/NAME` body, or a `POST
/automation` body onto a name the engine holds, keeps when it leaves it
out, and the `DELETE /automation/NAME` existence check read the flow the
engine holds whatever its package's enable state. For such a flow the
clone's new name is refused `409`, the held definition is put back, the
credential is kept and `DELETE` answers a deletion, as before this
release. A name two packages hold is read at those doors on its served
holder, as the bare entries read it.
- `check-empty-changeset` keeps `Check Changeset` red on this file until
the dispatching seat's record confirms the correction (its ACCEPT or its
same-head contract-review PASS); it is not restored from the base.
## Tests
- **Runtime**, `automation-write-doors-durable-34145.test.ts`, through
the real `HttpDispatcher`:
- Clone: a disabled sole holder's name is taken. A shared name in each
of three states (co-holder kept, co-holder withdrawn, both served) gets
the door's returned name-taken `409`.
- Put-back, credentials and `DELETE` for a disabled sole holder, each
with CONTROLs.
- Shared-name writes, as on `main`, with no store: `PUT` and `POST /`
are admitted `200` into the served holder, and a served-form `PUT` keeps
the served holder's secret. CONTROL: both holders enabled gives `409`
naming every holder.
- The with-store leg runs through the **real metadata protocol save on a
booted kernel** (`MetadataPlugin`, `ObjectQLPlugin`, SQLite), with two
authored packages each holding a stored flow row and one of them
disabled. Package-less `PUT` and `POST` are expected to give `200`, with
the edit in the enabled holder's row and the disabled holder's row
byte-unchanged.
- The no-store narrowing pins from the previous round are removed.
- **Engine**, `flow-slots-per-package.test.ts`:
- `[#33905]`: `getHeldFlow` is the slot's body.
- `[#33893]` withdrawn-slot case: `getHeldFlow` refuses naming both
holders, while `getFlow` serves the enabled holder.
- Uninstall stretch: `getHeldFlow` settles the name back to the one
holder. This backs N1; it is no longer framed as a remedy.
## Acceptance notes
- **Review disposition, from both reviews:**
- L1 F1 / review#1 S1: re-pinned under B.
- L1 F2: moot; there is no narrowing and no remedy.
- L1 F3 / review#1 S3: corrected under B.
- L1 nit / review#1 S2: done.
- review#1 M1: B applied.
- review#1 S4: rulings recorded in 6911640332; the claim amendment is
the area's.
- review#1 N1: done.
- review#1 delta 6915149305: S5 option 1 (exception stated in the clone
door's comment and the changeset; no behaviour change), N2 (both
changesets name `POST /automation` onto a held name beside `PUT` for the
kept credential), N3 (this body). These three are prose-only: `e5468471`
moves comments and changesets, no code path.
- **filed #34394**: both-disabled shared name at the clone door
(review#1 6915149305 S5, stated here as the exception, as on main).
- The booted-kernel case passes on this head: the real protocol's
package-less save addresses the enabled holder's flow row.
## Verification
Final head `e5468471` (takeover round, claim 6913100013). `e6f54de659`
typed one test read's engine options; `e5468471` moves prose only
(comments and changesets). Local runs under the shared verify lock,
after rebuilding the `@objectstack/runtime` and
`@objectstack/service-automation` closures.
**The three red checks on the hand-off head `fa24e9f67c`:**
- `Lint · scoped · query-options erasure`, step `pnpm
check:query-options-erasure`, first error: "test surface grew 236 → 237
site(s)". This PR's: `automation-write-doors-durable-34145.test.ts`
erased the booted-kernel rows read's options to `any`. Fixed in
`e6f54de659`: the context rides the read's typed trailing options. Local
gate: `test surface: 236 site(s) in 47 file(s) — at the ceiling`, exit
0. CI at `e5468471`: success.
- `Lint & Repo Gates`, step `verify-lanes`, first error: "lint lane
`lint-scoped-erasure` concluded `failure`". The aggregator of the lane
above, nothing of its own. CI at `e5468471`: success.
- `Check Changeset`, both runs (`09:02Z`, before the body patch, and
`09:06Z`, after it), step `check-empty-changeset --base`, first error:
".changeset/33905-disabled-sole-holder-flow.md exists on the merge base
and was not added by this PR". Red by design: the DELIBERATE CORRECTION
declared under What changes. Every other step passes in CI and locally:
`check-changeset-no-major` with an event carrying the current title and
this body, exit 0 ("LEVEL AXIS: this PR declares clause-② `yes
(widening)` and metadata-protocol `none` … a non-protocol change at
`patch`"); `check-adr-0087-registration`, exit 0 ("this PR adds no
declared-breaking changeset (2 non-breaking changeset(s) seen)").
<details><summary>Suites and typechecks (at e6f54de; e546847 adds
comments and changesets only)</summary>
- `pnpm --filter @objectstack/service-automation test`: Test Files 284
passed (284), Tests 4041 passed (4041). `typecheck`: exit 0, test layer
compiles.
- `pnpm --filter @objectstack/runtime test`: Test Files 608 passed
(608), Tests 11176 passed, 19 skipped (11195). `typecheck`: exit 0, test
layer compiles (the edited test file included, 183 pinned debt errors
unchanged).
- `automation-write-doors-durable-34145.test.ts`: 22/22 passed.
</details>
<details><summary>Ablation: the shared-name fallback in
heldFlowReader</summary>
Through `scripts/ablation-replace.mjs` on `automation.ts` (the test
imports the source, no `dist/` in the path): the line `if (e instanceof
PackageScopedNameRefusedError && served !== undefined) return
served(name);` became a rethrow. Anchor 1 → 0, blob `17d55e44ce60` →
`ab01b636efef`. Result: Tests 5 failed, 17 passed (22). Red: `PUT
/:name` and `POST /` with no metadata store (admitted 200 into the
served holder), `PUT /:name` in the served form keeping the served
holder's secret, and the booted-kernel `PUT` and `POST` (200 into the
enabled holder's row). Restored: blob after restore `17d55e44ce60` ==
HEAD, `git diff HEAD` empty.
</details>
<details><summary>Gates and the dogfood battery</summary>
- `dispatch-gates --commands` at `e5468471`: 75 families, the same list
as at `e6f54de659`. All 75 run on `e5468471`: 74 exit 0, and
`check-empty-changeset --base` exit 1 (the correction above).
`check:type-check-debt` (first attempt a lock queue-timeout, exit 3) and
`check:dual-build-cjs-loads` (first attempt PREREQUISITE NOT MET, exit
3) were re-run under the lock after the builds they need: both exit 0
(re-measure 0 raw tsc errors; 123 require entry points across 72
packages load). `--ran`: "75 derived, 75 run, 0 NOT-MEASURED, 0 UNRUN".
- Dogfood battery (`pnpm --filter @objectstack/dogfood test` after the
`@objectstack/dogfood^...` build), at `e6f54de659`: Test Files 473
passed, 3 skipped (476); Tests 4003 passed, 42 skipped (4045); exit 0.
`e5468471` changes no built code.
</details>
CI on `e5468471`: 34 success, 16 skipped, 1 failure (`Check Changeset`,
the correction above). Of the eleven required contexts, the seven
reported on this head are success (`Lint & Repo Gates`, `TypeScript Type
Check`, `Test Core`, `Build Core`, `Governed Surface Queue Guard`, `Test
UI`, `Dogfood Regression Gate`); `Lint UI`, `Type Check UI` and `Build &
E2E UI` skipped (no `ui/` path), and `Live E2E UI` has no run on this
head.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3
<!-- signed: repo:objectstack#1 · os-project-manager ·
session_01FEkQ5kgF3mo9f7LXuv5hac -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f84dc19 commit 162fe54
6 files changed
Lines changed: 617 additions & 20 deletions
File tree
- .changeset
- packages
- runtime/src/domains
- services/service-automation/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments