Repository navigation
Commit 1216abf
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
File tree
- .changeset
- packages/spec/src/migrations/entries/semantic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 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 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 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 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments