Skip to content

Commit 4a9e48c

Browse files
committed
docs(lint): the subflow target refusal in the upgrade-guide entry and changeset
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
1 parent eca6aa5 commit 4a9e48c

3 files changed

Lines changed: 35 additions & 2 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'@objectstack/lint': minor
3+
'@objectstack/metadata-protocol': minor
4+
'@objectstack/spec': patch
5+
---
6+
7+
fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold
8+
9+
Clause-②: yes (narrowing)
10+
Metadata-protocol: narrowed
11+
12+
<!-- adr-0087: not-required (already-registered publish-refuses-flows-that-save-and-do-not-run) the same subflow-target rule at one more door; this change extends that entry's text from a CLI warning to an error at the runtime publish gate, judged against every flow the deployment holds -->
13+
14+
**BREAKING** accept-set narrowing, shipped as `minor`: an active publish of a flow whose `subflow` or `map` step names a flow that no part of the deployment holds was accepted before and is refused now (`422 INVALID_METADATA`, rule `flow-subflow-unknown`), with the fix named. The schema is unchanged, stored flows are not rewritten or refused at boot, and drafts are not gated.
15+
16+
A `subflow` or `map` step runs the flow its `config.flowName` names. When the engine holds no flow of that name, the step fails on every run (`Flow 'X' not found`). `flow-subflow-unknown` reported this only as a CLI warning, because the publish gate judged one flow at a time and could not tell a call to another stored flow from a call to a missing one.
17+
18+
- **The refusal.** On a flow publish the host now states the names of every flow the deployment holds: every installed package's flows (a disabled package's included), the stored flow rows in every state (a draft counts), the flows the same publish batch carries, and every flow the automation engine holds (a flow registered straight into the engine has no metadata row). A call naming none of them, and not the written flow itself, is an `error` at the publish gate.
19+
- **No verdict.** When the host cannot read one of those sources (no automation service, a failed store read, said once at `warn`), or the set is empty, the gate does not judge the call.
20+
- **Not judged.** Whether the engine's package-scoped name resolution (ADR-0150 D3) lets the calling flow reach the called one: the set is the whole deployment, never narrowed to the written package's dependency closure.
21+
- **The CLI.** `os validate` / `lint` / `compile` / `build` still report `flow-subflow-unknown` as a warning: the stack is one app, and another installed package may ship the called flow.
22+
- **Exports.** `validateFlowSubflowTargets` takes an optional second argument (`FlowSubflowTargetOptions`, `deploymentFlowNames`); `AuthoringRuleContext` gains `deploymentFlowNames`; `runRuntimeAuthoringRules` and `evaluateRuntimeAuthoringGate` take an optional `deploymentFlowNames`. All optional; an omitted value keeps the earlier behaviour.
23+
24+
FROM → TO:
25+
26+
- `{ type: 'subflow', config: { flowName: 'notfy_owner' } }` (no such flow) → `{ type: 'subflow', config: { flowName: 'notify_owner' } }`
27+
28+
One-line fix: name a flow the deployment holds, or save the called flow first (a draft is enough) and publish the caller after it.

‎packages/lint/src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export {
188188
} from './validate-flow-trigger-readiness.js';
189189
export type {
190190
FlowTriggerReadinessFinding,
191+
FlowSubflowTargetOptions,
191192
FlowTriggerReadinessSeverity,
192193
} from './validate-flow-trigger-readiness.js';
193194

‎packages/spec/src/migrations/entries/semantic/18.publish-refuses-flows-that-save-and-do-not-run.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const entry: SemanticMigration = {
2525
'Set the trigger\'s `objectName`; compare the option value, not its label; drop the record `triggerType` or the '
2626
+ '`timeRelative` block, whichever the flow does not mean; move `filter` / `maxRecords` inside `timeRelative`; point '
2727
+ '`dateField` at a `date` or `datetime` field; write an option value the field lists; write a date as a CEL value '
28-
+ 'envelope (`{ dialect: \'cel\', source: \'isoDate(today())\' }`) instead of the helper call as text',
28+
+ 'envelope (`{ dialect: \'cel\', source: \'isoDate(today())\' }`) instead of the helper call as text; '
29+
+ 'point a `subflow` / `map` step\'s `config.flowName` at a flow the deployment holds, or save the called flow first',
2930
reason:
3031
'Each flow parses and publishes, then misbehaves on every run: a record trigger with no object fires on writes to '
3132
+ 'every object; a label comparison is never true, because the row stores the value; a record trigger shadows the '
@@ -34,7 +35,10 @@ export const entry: SemanticMigration = {
3435
+ '`invalid_option` and a write of helper text is refused `invalid_date`, so the node fails on every run. Stored '
3536
+ 'flows are not rewritten or refused at boot. The next publish of a flow that carries one of the seven errors is '
3637
+ 'refused with the fix named. Three warnings join them (`flow-schedule-timezone-missing`, `flow-subflow-unknown`, '
37-
+ '`flow-create-update-pair`), which refuse nothing and make `os validate --strict` exit 1 as any warning does.',
38+
+ '`flow-create-update-pair`), which refuse nothing on the CLI and make `os validate --strict` exit 1 as any warning '
39+
+ 'does. At the runtime publish gate `flow-subflow-unknown` is an error: a `subflow` / `map` step whose '
40+
+ '`config.flowName` names no flow the deployment holds (an installed package\'s, a stored flow in any state, a flow '
41+
+ 'of the same publish batch, or one the automation engine holds) fails on every run, so its publish is refused.',
3842
acceptanceCriteria:
3943
'os validate reports none of the seven errors; a publish of every flow the package carries succeeds.',
4044
};

0 commit comments

Comments
 (0)