Skip to content

Commit 1216abf

Browse files
docs(spec): upgrade-guide entries for the flow-start-node-missing and flow-node-unreachable refusals (#32345) (#32597)
Fixes #32345 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:在协议 18 的升级指南里补两条语义迁移条目,一条规则一条:`flow-start-node-missing-refused`(流程顶层没有 start 节点)与 `flow-node-unreachable-refused`(有节点从 start 出发沿边走不到)。每条写明以前能存、现在拒绝什么、怎么改,以及发版前已存的行会怎样。 - 为什么改:这两条 lint 规则已经在流程的正式保存与发布时拒绝以前能存下的流程,属于收窄,但升级指南和 `os migrate meta` 里没有对应条目,升级的作者无处查。门禁放行它们,只是因为检测器读不到散文式的改法,不代表不欠条目。 - 风险与回滚:只加两个数据文件和一个 changeset,另把三份待发 changeset 的 ADR-0087 标记由 `not-required` 改为 `registered`(见 DELIBERATE CORRECTION 一节,Check Changeset 因此按设计变红、待席位确认);不动任何 schema、导出或判定;回滚即 revert。 - 先看:`packages/spec/src/migrations/entries/semantic/18.flow-start-node-missing-refused.ts` 与 `18.flow-node-unreachable-refused.ts` 的 `reason` 字段中「Rows stored before this release」一段(这是实测读数,风险点在措辞是否与运行时一致);其次 changeset。 - 两分钟验证:`pnpm --filter @objectstack/spec run check:spec-changes`,预期打印 `aggregate 107 converted / 568 migrated`(原为 566,多出的 2 条即本 PR)。 - 需要你做的:无,席位落地。 ## What changes Two ADR-0087 D3 semantic entries, shaped like `18.picklist-binding-unknown-refused.ts`, one per runtime-gate flow narrowing: - `packages/spec/src/migrations/entries/semantic/18.flow-start-node-missing-refused.ts` (rule `flow-start-node-missing`). Fix: add a node with `type: 'start'` to the top-level `nodes` and an edge from it to the first step. - `packages/spec/src/migrations/entries/semantic/18.flow-node-unreachable-refused.ts` (rule `flow-node-unreachable`). Fix: wire the node from the start node, or delete it; a second start node is deleted. - `.changeset/32345-flow-narrowing-semantic-entries.md`, `@objectstack/spec` patch. The entries ship in the package through the generated `registry.ts`, so this publishes. Each entry says what used to store, what is refused now (`os validate` / `os build` / `os lint` / `os verify`, and `422 INVALID_METADATA` at the flow live save, publish and restore doors, a draft still saving and its read carrying the finding), the fix, and what happens to rows stored before the release. No `conversionIds` (no D2 conversion exists or can exist) and no `relevantWhen` (the surface includes flow rows stored in `sys_metadata`, which the stack-declares question cannot see), as in the picklist precedent. The prefix is `18`: `PROTOCOL_VERSION` is `18.0.0` at the base, and both rule changesets (`.changeset/31224-flow-node-unreachable.md`, `.changeset/32289-flow-start-node-missing.md`) are still pending, so they ship in the next `@objectstack/lint` 18.x minor. ### The "rows stored before the release" sentences, and where each was read <details><summary>flow-start-node-missing: kept and readable, not armed; live re-save refused</summary> - Boot: the engine's first registration check refuses a flow with no top-level start node: `packages/services/service-automation/src/flow-registration-checks.ts:226` (in `registrationChecks`, :217-250) calls `validateStartNode` (:297-316). The boot pull and the cold-boot bind log `[Automation] failed to register flow` / `[Automation] cold-boot flow bind: failed to register flow` and go on (`packages/services/service-automation/src/plugin.ts:2537`, :5786, after the round-1 merge of `origin/main`). That engine refusal is the pending `.changeset/32142-flow-start-node-required.md`, which ships in the same release. - Read: the stored row is served unchanged beside `registration: refused`. The real composition pins this in `packages/services/service-automation/src/flow-refused-registration-read.integration.test.ts:212-252` (kernel `running`, `getFlow` null, `status: 'active'` read back, `registration.state === 'refused'`, reason opens with the engine's words). Its save-door half (:253-272) pins the live refusal and the draft that still saves. - Re-save: the gate charges a finding located on the written item to that write "whatever the stored row held. Re-saving a row is writing it": `packages/lint/src/runtime-gate.ts:56-58`. Drafts are never gated: `packages/metadata-protocol/src/runtime-authoring-gate.ts:32-36`, :1293. - Escape hatch: `OS_ALLOW_UNLINTED_METADATA_WRITES=1` turns the refusal into a `console.warn`: `packages/metadata-protocol/src/runtime-authoring-gate.ts:120`, :1452-1468. </details> <details><summary>flow-node-unreachable: registers, arms and runs as before; live re-save refused</summary> - Boot: no registration check judges reachability. The six checks in `registrationChecks` (`flow-registration-checks.ts:217-250`) are start node, undeclared config keys, decision modes, expressions, the api trigger secret and the after-save inline retry. `git grep -n -i unreachable -- packages/services/service-automation/src ':!*.test.ts'` names no reachability check, only a comment at `flow-registration-checks.ts:294` pointing at `os lint`. The authoring rules run only at the write doors: `evaluateRuntimeAuthoringGate` has its two call sites in `packages/metadata-protocol/src/protocol-authoring-gate.ts:327` and :468. - The node still never runs: `packages/lint/src/lint-flow-patterns.ts:1889-1897` ("registers, publishes, reports itself configured and never runs"). - Re-save, drafts and the hatch: the same reads as above. - Not measured at run time: booting a stored unreachable-node flow means building the 39-package closure of `@objectstack/service-automation` in a shared container. This half is read from code, at the lines above. </details> ## Tests Round 0, run at head `8d48db47`, on the spec only, which has no workspace dependencies: <details><summary>spec migrations, full spec test and typecheck</summary> - `pnpm gen:migration-registry && pnpm exec vitest run --project local --maxWorkers=2 src/migrations` (in `packages/spec`, under the verify lock): `Test Files 5 passed (5)`, `Tests 198 passed (198)`, `VERDICT command-exit 0`. Run in this form because a bare `--` before the filter is dropped by vitest. - `pnpm --filter @objectstack/spec run typecheck && pnpm --filter @objectstack/spec run test` (under the lock): `registry.ts is current (568 semantic, …)`, tsc clean, `check:test-typecheck: OK`, `Test Files 836 passed (836)`, `Tests 26711 passed | 1 todo (26712)`, `VERDICT command-exit 0`. - Chain probe (`applyMetaMigrations({ flows: [] }, 17, 18)` through tsx, scratch only): 491 todos, both new ids among them, neither in `absentTodos`. A probe from 18 to 18 gives 0 todos. So a consumer already on 18 meets these entries through the release's `spec-changes.json` `migrated` delta and the upgrade guide page, not through an `os migrate meta` hop. No new test file. These are data entries, and the registry-integrity, acceptance-criteria and spec-changes tests in `src/migrations/` already enumerate every entry. No tested behaviour changed, so there is no ablation. </details> ## Acceptance notes - **Item 2 (the gate question) is decided by the seat, not carried here.** The seat took the measured option A in claim addendum 6817391278 on #32345: a changeset declaring `Metadata-protocol: narrowed` may no longer use `not-required (no-migration-prescription)`. It is filed as #32601. This PR does not touch `scripts/check-adr-0087-registration.mjs`. - Contract review record 6817432684 (PASS on `8d48db47`) nit 5 stays as worded: the unreachable entry's acceptance check is a live re-save. There is no read-only check for an active row today, and the review accepted this deviation. ## Round 1 (contract review 6817432684 and claim addendum 6817391278) What moved on head `9559d689`. It sits on a merge of `origin/main` at `e5428312`, commit `2744f6e0`, a clean merge that touches no file of this PR. - **Finding 1 (should-fix): the restore doors.** Both entries' `surface` now name the restore doors, as the picklist precedent does: `POST /api/v1/meta/flow/NAME/rollback` and `POST /api/v1/packages/PKG/commits/COMMIT/revert`. Each "Rows stored before this release" paragraph gains a clause: a history version stored before the release that holds the shape can no longer be restored (the same 422). I read the path on the tree. `restoredBodyWriter` (`protocol-authoring-gate.ts:108-126`, the restore limb of `rollbackMetaItem` and `revertCommit` per `protocol-class-head.ts`) calls `refuseRestoredBodyTheSaveDoorRefuses`, which calls `assertRuntimeAuthoringRules` with `state: 'active'` at `protocol-authoring-gate.ts:163`. The rollback route is `POST {metaPath}/:type/:name/rollback` (`packages/rest/src/meta-item-history-routes.ts`), and the commit revert is `POST /packages/:id/commits/:commitId/revert` (`packages/runtime/src/route-ledger.ts:560`). - **Nit 2: `os verify`.** It is named beside `os validate` / `os build` / `os lint`. `packages/cli/src/commands/verify.ts:45` imports `judgeAuthorTimeRules`, and `VERIFY_RULE_COMMAND = 'validate'` (`utils/author-time-rules.ts:89`). - **Nit 3: the draft.** It now reads "A draft save (mode=draft) runs no rule and still stores …; the finding is on the draft read's _diagnostics", matching the pin ("with the finding on its draft read", `flow-refused-registration-read.integration.test.ts`). - **Nit 4: the artifact case.** The start-less stored-rows paragraph now covers a start-less flow in an artifact built earlier. The boot pull registers the ObjectQL registry's flows, which `AppPlugin` fills from the manifest (`plugin.ts:2480-2483`), and warns `[Automation] failed to register flow` on a refusal (`plugin.ts:2537`). - **Addendum 6817391278: the three rule changesets register the entries.** See the DELIBERATE CORRECTION section below. ## Round 2 (delta review 6817706509) What moved on head `a2378032`. It sits on merge `a47e1a4a` of `origin/main` at `874166b6`, a clean merge that touches no file of this PR. Only the two entry files changed; the changesets were not touched again. - **Finding 1 (should-fix): the automation write doors.** `18.flow-start-node-missing-refused.ts` now names `POST /api/v1/automation` and `PUT /api/v1/automation/NAME` in `surface`, and its `reason` gives their answer: `400 VALIDATION_FAILED`, with the engine's words, and nothing registered or stored. I read the path on the tree. The two routes are `packages/runtime/src/domains/automation.ts:3726` (`parts.length === 0 && m === 'POST'`) and `:4800` (`parts.length === 1 && m === 'PUT'`). Each calls `registerAndSaveFlow` (`:2528`), which runs `registerFlow` before it saves and maps the throw through `flowDefinitionRefusal` to `VALIDATION_FAILED_STATUS` (`:2552-2556`; `packages/types/src/validation-failure.ts:45` holds `400` and code `VALIDATION_FAILED`). `registerFlow` throws the first registration-check refusal as a plain `Error` (`packages/services/service-automation/src/engine.ts:5155-5157`), and `validateStartNode` comes first in that list. - **The registration paths 32142 names.** The stored-rows paragraph now names all four with their warn lines (`packages/services/service-automation/src/plugin.ts`). The boot pull and the `kernel:ready` bind were already covered (`:2537`, `:5786`). Newly named are the `metadata:reloaded` re-sync (`[Automation] flow re-sync: failed to register flow`, `:5707`) and the metadata-change sync (`[Automation] a flow changed in the metadata store could not be registered`, `:5990`, which records the refusal). - **Nit 2: the third restore door.** Both entries now name `POST /api/v1/packages/PKG/rollback` (`packages/runtime/src/route-ledger.ts:563`). Its handler, `rollbackToPackageCommit` (`packages/metadata-protocol/src/protocol-package-commits.ts:1717`), calls `revertCommit` once per commit. - **Nit 3: the hatch.** Both entries now read "turns the save, publish and restore refusal into a logged warning". It is the same `evaluateRuntimeAuthoringGate` exit. The start-less entry also says the hatch does not cover the automation doors' 400: that is the engine's registration check, and `automation.ts` never calls the authoring gate and never reads the variable. - **Not changed.** `18.flow-node-unreachable-refused.ts` names no automation door. Reachability is not a registration check, so `POST /api/v1/automation` and `PUT /api/v1/automation/NAME` still register such a flow. ## DELIBERATE CORRECTION This PR rewrites the ADR-0087 disposition marker in three pending release notes that it did not add. The two entries this PR registers made each marker false, so `check-empty-changeset` refuses them by design. ⛔ Do not restore them. The seat confirms on its own record. Only the marker line moves in each note; the line is an HTML comment and renders as nothing in a changelog. It is quoted below without its comment delimiters. - `.changeset/31224-flow-node-unreachable.md`, line 11 - before: `adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed or renamed: FlowSchema keeps its shape and meaning, and lint now refuses a graph whose node no edge from the start node reaches. Such a node never ran (a run starts at the start node and follows edges), so there is no rewrite that keeps what the author meant: the author wires the node in or deletes it, and the finding says which node.` - after: `adr-0087: registered flow-node-unreachable-refused` - `.changeset/32289-flow-start-node-missing.md`, line 11 - before: `adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed or renamed: FlowSchema keeps its shape and meaning, and lint now refuses a flow whose top-level nodes hold no start node. Such a flow never ran (a run begins at the start node, and the engine already refuses to register it), and no rewrite keeps what the author meant: the start node carries the trigger, which only the author knows.` - after: `adr-0087: registered flow-start-node-missing-refused` - `.changeset/32142-flow-start-node-required.md`, line 11 - before: `adr-0087: not-required (no-migration-prescription) no key, value or spelling is retired and no stored row can be rewritten mechanically: a start node carries the flow's trigger, which only its author knows, so the refusal text names the cure and `os migrate meta --stored` lists each such row` - after: `adr-0087: registered flow-start-node-missing-refused` Each new marker is spelled as `readDisposition` in `scripts/check-adr-0087-registration.mjs` accepts it (`registered` then the id), and both ids resolve in the registry at head. `node scripts/check-adr-0087-registration.mjs --base origin/main` exits 0: "this PR adds no declared-breaking changeset (4 non-breaking changeset(s) seen)". The three are breaking at base and modified, so they are skipped as inherited stock. ## Verification <details><summary>round 2, head a237803</summary> Exit codes were captured before any pipe: - exit 0: `pnpm gen:migration-registry && pnpm exec vitest run --project local --maxWorkers=2 src/migrations` (spec, under the verify lock): `Test Files 5 passed (5)`, `Tests 198 passed (198)`, `VERDICT command-exit 0`. - exit 0: `node scripts/check-adr-0087-registration.mjs --base origin/main` ("no declared-breaking changeset (4 non-breaking changeset(s) seen)"); spec `check:spec-changes` (`aggregate 107 converted / 568 migrated`) and `check:upgrade-guide`; `pnpm check:nul-bytes`, `check:doc-authoring`, `check:future-spec-major`; `pnpm exec eslint --no-inline-config` on the two entry files. - Still red by design: Check Changeset, from `check-empty-changeset`'s DELIBERATE CORRECTION refusal. Round 2 does not touch the three notes. </details> <details><summary>round 1, head 9559d68 (superseded)</summary> Exit codes were captured before any pipe: - exit 0: `pnpm gen:migration-registry && pnpm exec vitest run --project local --maxWorkers=2 src/migrations` (spec, under the verify lock): `Test Files 5 passed (5)`, `Tests 198 passed (198)`, `VERDICT command-exit 0`. - exit 0: `node scripts/check-adr-0087-registration.mjs --base origin/main`; spec `check:spec-changes` (`aggregate 107 converted / 568 migrated`) and `check:upgrade-guide`; `pnpm check:nul-bytes`, `check:doc-authoring`, `check:closed-ceremony-text`, `check:future-spec-major`, `check:changeset-gate-self-tests`; `node scripts/check-changeset-no-major.mjs --base origin/main`; `pnpm exec eslint --no-inline-config` on the two entry files. - exit 1, expected: `node scripts/check-empty-changeset.mjs --base origin/main`. It is the DELIBERATE CORRECTION refusal on the three notes above, and it is why Check Changeset is red until the seat confirms. - Not re-run on this head: the spec `check:api-surface` / `check:docs` / `check:exported-any` family and the full spec suite. Round 1 changes only string prose in two data entries and three changeset comments, which reach no export, schema or `.describe()`. CI's Lint and Type Check jobs carry them. </details> <details><summary>round 0: local gate subset (seat-derived list plus the registry readers), head 8d48db4</summary> Exit codes were captured before any pipe: - exit 0: `pnpm --filter @objectstack/spec run` `check:api-surface`, `check:authorable-surface`, `check:browser-reachable-entries`, `check:docs`, `check:dual-source-exports`, `check:duration-unit-keys`, `check:empty-state`, `check:entry-nameability`, `check:export-origins`, `check:exported-any`, `check:spec-changes` (`aggregate 107 converted / 568 migrated`), `check:upgrade-guide`, `check:liveness`. - exit 0: `pnpm` `check:changeset-gate-self-tests`, `check:ci-filter-parity`, `check:closed-ceremony-text`, `check:cross-package-test-inputs`, `check:dispatcher-error-vocabulary`, `check:doc-authoring` (`504 files clean`), `check:dts-closure`, `check:issue-citations`, `check:nul-bytes`, `check:future-spec-major`. - exit 0: `pnpm --filter @objectstack/lint run check:doc-formula-expressions`. The first run exited 3 (PREREQUISITE NOT MET: no lint or formula `dist`); it passed after `turbo run build --filter=@objectstack/formula --filter=@objectstack/lint`. - exit 0: `node scripts/check-adr-0087-registration.mjs --base origin/main` (`this PR adds no declared-breaking changeset (1 non-breaking changeset(s) seen)`), `node scripts/check-changeset-no-major.mjs --base origin/main`, `node scripts/check-empty-changeset.mjs --base origin/main`. - NOT MEASURED: `pnpm check:dual-build-cjs-loads`. It exited 3 (PREREQUISITE NOT MET) because it needs every workspace package built, so CI's Lint & Repo Gates carries it. - `dispatch-gates --ran`: 79 derived, 27 run, 52 left unrun, 3 run outside the derivation. The local subset was narrowed to the seat's dispatch list on purpose, and CI runs the full farm. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_017xRBcSbLCxEmyHf9upz3pz)_ <!-- signed: domain:spec#2 · sunhaolin · session_017xRBcSbLCxEmyHf9upz3pz --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0f98e69 commit 1216abf

6 files changed

Lines changed: 123 additions & 3 deletions

‎.changeset/31224-flow-node-unreachable.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Clause-②: yes (narrowing) — `os validate`, `os build`, `os lint` and the flo
88
Metadata-protocol: narrowed
99
Skills-docs: none — `skills/**` and `content/docs/**` teach only wired top-level flows; the edgeless examples in `content/docs/automation/flows.mdx` are region bodies, which this rule does not judge. The reasoning ships as the `os explain flow-node-unreachable` entry.
1010

11-
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed or renamed: FlowSchema keeps its shape and meaning, and lint now refuses a graph whose node no edge from the start node reaches. Such a node never ran (a run starts at the start node and follows edges), so there is no rewrite that keeps what the author meant: the author wires the node in or deletes it, and the finding says which node. -->
11+
<!-- adr-0087: registered flow-node-unreachable-refused -->
1212

1313
**BREAKING** accept-set narrowing in `os validate` / `os build` / `os lint` and at the flow publish doors (`PUT /api/v1/meta/flow/NAME` live save, the per-item and package publish; Studio, REST and MCP authors), through the gating `lintFlowPatterns` rule.
1414

‎.changeset/32142-flow-start-node-required.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Clause-②: no (narrowing) — `AutomationEngine.registerFlow` refuses a definit
88
Metadata-protocol: narrowed
99
Skills-docs: none — every flow `skills/objectstack-automation` teaches already opens with a start node, and the refusal text carries the cure.
1010

11-
<!-- adr-0087: not-required (no-migration-prescription) no key, value or spelling is retired and no stored row can be rewritten mechanically: a start node carries the flow's trigger, which only its author knows, so the refusal text names the cure and `os migrate meta --stored` lists each such row -->
11+
<!-- adr-0087: registered flow-start-node-missing-refused -->
1212

1313
**BREAKING** accept-set narrowing at every door that registers a flow: the automation write doors (`POST /api/v1/automation`, `PUT /api/v1/automation/NAME`), the boot pull, the `kernel:ready` bind and the metadata-change sync.
1414

‎.changeset/32289-flow-start-node-missing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Clause-②: yes (narrowing) — `os validate`, `os build`, `os lint` and the flo
88
Metadata-protocol: narrowed
99
Skills-docs: none — no page in `skills/**` or `content/docs/**` says a flow with no start node is refused at the parse or stored; every flow they teach opens with a start node. The trigger tables that still promise `422 FLOW_NO_START_NODE` for a stored start-less flow are follow-up #32288's. The reasoning ships as the `os explain flow-start-node-missing` entry.
1010

11-
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed or renamed: FlowSchema keeps its shape and meaning, and lint now refuses a flow whose top-level nodes hold no start node. Such a flow never ran (a run begins at the start node, and the engine already refuses to register it), and no rewrite keeps what the author meant: the start node carries the trigger, which only the author knows. -->
11+
<!-- adr-0087: registered flow-start-node-missing-refused -->
1212

1313
**BREAKING** accept-set narrowing in `os validate` / `os build` / `os lint` and at the flow doors (`PUT /api/v1/meta/flow/NAME` live save, the per-item and package publish; Studio, REST and MCP authors), through the gating `lintFlowPatterns` rule.
1414

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the protocol upgrade guide names the two flow shapes the authoring rules now refuse at a live save and a publish, a flow with no top-level start node and a node no edge from the start node reaches (#32345)
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **What.** Two new semantic migration entries in protocol 18's step of the upgrade guide and `os migrate meta`, one per rule: `flow-start-node-missing-refused` (rule `flow-start-node-missing`) and `flow-node-unreachable-refused` (rule `flow-node-unreachable`). Each says what used to store, what is refused now (`os validate` / `os build` / `os lint`, and `422 INVALID_METADATA` at the flow live save and publish doors, while a draft still saves with the finding), and the fix.
11+
- **The fix each names.** For a flow with no start node: add a node with `type: 'start'` to the top-level `nodes` and an edge from it to the first step. For an unreached node: wire it from the start node, or delete it; a second start node is deleted.
12+
- **Rows stored before the release.** A start-less row stays stored and readable but is not armed: the engine refuses to register it, and the metadata read serves it beside `registration: refused`. A row holding an unreached node still registers and runs as before, and the node still never runs. For both, a live re-save is refused until fixed, a stored draft is judged at publish, and deleting the flow or saving it as a draft still works.
13+
- **No automatic rewrite.** The start node carries the trigger, and whether an unreached step was meant to run is the author's judgement.
14+
- **Not changed.** No schema, export or accepted input moves: the two refusals ship with `@objectstack/lint`, and these are their guide entries.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { SemanticMigration } from '../../types.js';
4+
5+
// The upgrade-guide entry of the authoring rule `flow-node-unreachable`
6+
// (`@objectstack/lint`). No D2 conversion: an unreached node never ran, so
7+
// wiring it in changes what the flow does and deleting it does not, and only
8+
// the author knows which was meant.
9+
export const entry: SemanticMigration = {
10+
id: 'flow-node-unreachable-refused',
11+
surface:
12+
'automation.Flow.nodes and automation.Flow.edges on a flow saved live or published through the metadata '
13+
+ 'doors (PUT /api/v1/meta/flow/NAME live save, the per-item publish, POST /api/v1/packages/PKG/publish-drafts, '
14+
+ 'and the restore doors POST /api/v1/meta/flow/NAME/rollback, POST /api/v1/packages/PKG/commits/COMMIT/revert '
15+
+ 'and POST /api/v1/packages/PKG/rollback; '
16+
+ 'Studio, REST and MCP authors) and on a flow os validate / os build / os lint / os verify judge: a top-level node that no '
17+
+ 'edge path from the flow\'s first start node reaches, a second start node included. Every edge type counts '
18+
+ 'as a path (default, conditional, fault, back); a boundary_event node and the nodes only it leads to, and '
19+
+ 'the nodes inside a loop, parallel or try_catch region body, are not judged',
20+
replacement:
21+
'Wire the node from the start node: add an edge into it from a node that runs. Or delete the node. A second '
22+
+ 'start node is deleted, and what followed it is wired from a node that runs',
23+
reason:
24+
'A run starts at the flow\'s first start node and follows edges; nothing else schedules a top-level node. A '
25+
+ 'node no edge path from the start node reaches (an edge forgotten while wiring, a node left behind when its '
26+
+ 'in-edges were deleted) parsed, built, was stored live by the metadata save door and published, registered '
27+
+ 'and reported itself as configured, and never ran. The authoring rule flow-node-unreachable (severity error) '
28+
+ 'now refuses it in os validate, os build, os lint and os verify, and a live save, a publish and a restore answer 422 '
29+
+ 'INVALID_METADATA with the rule in issues[], at `flow \'NAME\' · node \'ID\' (TYPE)`, one finding per node. '
30+
+ 'A draft save (mode=draft) runs no rule and still stores, so a designer that deletes a node and leaves its '
31+
+ 'successor unwired can keep saving; the finding is on the draft read\'s _diagnostics. '
32+
+ 'Rows stored before this release: a flow row in sys_metadata, or a flow in an artifact built earlier, that '
33+
+ 'holds an unreached node still registers at boot, arms its trigger and runs as it did before, and the '
34+
+ 'unreached node still never runs: no engine registration check judges reachability, and the authoring '
35+
+ 'rules run at the save and publish doors and in the CLI, not at boot. A live re-save of that row is '
36+
+ 'refused until the node is wired or deleted, because the gate charges a write with the written flow\'s own '
37+
+ 'findings whatever the stored row held; a draft stored earlier is judged at its publish and blocks its '
38+
+ 'package\'s publish until fixed; a history version stored before the release that holds an unreached node can '
39+
+ 'no longer be restored (the same 422); deleting the flow, or saving it as a draft, still works. '
40+
+ 'OS_ALLOW_UNLINTED_METADATA_WRITES=1 turns the save, publish and restore refusal into a logged warning for a '
41+
+ 'migration window. There is no mechanical rewrite: the node never ran, so deleting it keeps what the flow '
42+
+ 'did and wiring it in changes it, and whether the author meant the step to run is a judgement about the flow.',
43+
acceptanceCriteria:
44+
'Run `objectstack validate` over every stack authored in config files and confirm no flow-node-unreachable '
45+
+ 'finding. For each stored flow, re-save it live (PUT /api/v1/meta/flow/NAME) and confirm it answers 200 '
46+
+ 'rather than 422 naming flow-node-unreachable; for each node it named, an edge now leads to it from the start '
47+
+ 'node, or it is gone. POST /api/v1/packages/PKG/publish-drafts publishes the package that holds the flow.',
48+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { SemanticMigration } from '../../types.js';
4+
5+
// The upgrade-guide entry of the authoring rule `flow-start-node-missing`
6+
// (`@objectstack/lint`). No D2 conversion: the start node carries the flow's
7+
// trigger, which only the author knows, so no rewrite keeps what the flow
8+
// was meant to do.
9+
export const entry: SemanticMigration = {
10+
id: 'flow-start-node-missing-refused',
11+
surface:
12+
'automation.Flow.nodes on a flow saved live or published through the metadata doors '
13+
+ '(PUT /api/v1/meta/flow/NAME live save, the per-item publish, POST /api/v1/packages/PKG/publish-drafts, '
14+
+ 'and the restore doors POST /api/v1/meta/flow/NAME/rollback, POST /api/v1/packages/PKG/commits/COMMIT/revert '
15+
+ 'and POST /api/v1/packages/PKG/rollback; '
16+
+ 'Studio, REST and MCP authors), on a flow registered through the automation write doors (POST /api/v1/automation, '
17+
+ 'PUT /api/v1/automation/NAME), and on a flow os validate / os build / os lint / os verify judge: a flow whose top-level '
18+
+ 'nodes hold no node of type start, an empty list included. A start node inside a loop, parallel or '
19+
+ 'try_catch region body does not count',
20+
replacement:
21+
'Add a node with `type: \'start\'` to the flow\'s top-level `nodes` and an edge from it to the first step. '
22+
+ 'A record-change or schedule flow declares its trigger in that start node\'s `config`',
23+
reason:
24+
'A run begins at the flow\'s first top-level start node and follows edges from there; nothing else '
25+
+ 'schedules a top-level node. FlowSchema requires no start node, so a flow whose top-level nodes held none '
26+
+ 'parsed, built, was stored live by the metadata save door (200) and published, and could never run: every '
27+
+ 'trigger and every explicit run was refused with FLOW_NO_START_NODE, and the automation engine now refuses '
28+
+ 'to register it. The authoring rule flow-start-node-missing (severity error) now refuses it in os validate, '
29+
+ 'os build, os lint and os verify, and a live save, a publish and a restore answer 422 INVALID_METADATA with the rule in issues[], '
30+
+ 'at `flow \'NAME\' · nodes`, naming the node types found. The automation write doors (POST /api/v1/automation, '
31+
+ 'PUT /api/v1/automation/NAME) register the flow before they store it, so the engine\'s registration check '
32+
+ 'refuses it first and the door answers 400 VALIDATION_FAILED with the engine\'s words ("Flow \'NAME\' '
33+
+ 'rejected: the flow\'s top-level `nodes` hold no `start` node …") and registers and stores nothing. A draft save (mode=draft) runs no rule and still '
34+
+ 'stores, so a designer can keep saving mid-edit; the finding is on the draft read\'s _diagnostics. A flow with two start nodes is not '
35+
+ 'this rule: it runs from the first, and flow-node-unreachable names the extra one. '
36+
+ 'Rows stored before this release: a start-less flow row in sys_metadata stays stored and readable, and a '
37+
+ 'start-less flow in an artifact built earlier still loads. The '
38+
+ 'boot completes and the flow is not armed: the engine refuses to register it with a warn naming the flow '
39+
+ '(the boot pull `[Automation] failed to register flow`, the kernel:ready bind `[Automation] cold-boot flow bind: '
40+
+ 'failed to register flow`, the metadata:reloaded re-sync `[Automation] flow re-sync: failed to register flow`, '
41+
+ 'and the metadata-change sync `[Automation] a flow changed in the metadata store could not be registered`), '
42+
+ 'and the metadata read serves the stored row unchanged beside `registration: refused` and the engine\'s '
43+
+ 'words naming the missing start node. A live re-save of that row is refused until a start node is added, '
44+
+ 'because the gate charges a write with the written flow\'s own findings whatever the stored row held; a '
45+
+ 'draft stored earlier is judged at its publish and blocks its package\'s publish until fixed; a history '
46+
+ 'version stored before the release that holds no start node can no longer be restored (the same 422); '
47+
+ 'deleting the flow, or saving it as a draft, still works. OS_ALLOW_UNLINTED_METADATA_WRITES=1 turns the save, publish and '
48+
+ 'restore refusal into a logged warning for a migration window; it does not cover the automation write doors\' '
49+
+ '400, which is the engine\'s registration check and reads no such variable, and the engine still refuses to '
50+
+ 'register the flow. '
51+
+ 'There is no mechanical rewrite: the start node carries the trigger, which only the author knows.',
52+
acceptanceCriteria:
53+
'Run `objectstack validate` over every stack authored in config files and confirm no flow-start-node-missing '
54+
+ 'finding. For stored flows, GET /api/v1/meta/flow/NAME for each flow and confirm none reads '
55+
+ '`registration: refused` for a missing start node, and boot the stack with no `failed to register flow` '
56+
+ 'warn naming it. PUT /api/v1/meta/flow/NAME with a top-level start node wired to the first step answers '
57+
+ '200, and POST /api/v1/packages/PKG/publish-drafts publishes the package that holds it.',
58+
};

0 commit comments

Comments
 (0)