You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 30c3ee0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(runtime): a flow start input declared a record id (`objectName`) is loaded in the caller's own scope from the declared object at every door that starts the flow by name, before the run exists
7
+
8
+
Clause-②: yes (narrowing) — a start that ran before is now refused when it hands a declared record-id input an id the caller cannot read in the declared object, an id that names no record there, or a value that is not one id. No flow shipped in this repository declares the key, and an input without the declaration answers exactly as before.
9
+
Metadata-protocol: none
10
+
11
+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped: `objectName` on a flow variable already parses, and what moves is the answer a start door gives to a caller who hands such an input a value it cannot read. Nothing at rest records that answer, so there is nothing for a migration to rewrite. -->
12
+
13
+
**The rule.** A flow start input may declare that its value is the id of a record of a named object, with `objectName` on the variable (`{ name: 'accountId', type: 'text', isInput: true, objectName: 'crm_account' }`). Every door that starts the flow by name now loads such an input from the declared object in the caller's own scope before the run exists, whether or not the flow's definition reads the input in plain sight. A record the caller cannot read there and an id that names no record get the same answer, `404 RECORD_NOT_FOUND` (the action door's own refusal), and no run is created. A value that is not one id (a string or a number) is refused `400` naming the input: `VALIDATION_FAILED` from the start check, or, at an action whose param declares a type, `VALIDATION_ERROR` from that param's own contract, which answers first. The system principal is not judged.
14
+
15
+
**Which doors.**`POST /api/v1/automation/:name/trigger` and the legacy `POST /api/v1/automation/trigger/:name`; a declared endpoint of `type: 'flow'`; an action of `type: 'flow'` over the REST action route and the MCP `run_action` tool. All of them ask the one check they already shared for inputs a definition reads in plain sight.
16
+
17
+
**Beside the definition's own reads, never in place of them.** An input declared a record id of one object and also read by the definition as an id of another (a `get_record` node's `filter.id`, say) is loaded from both, so the caller must be able to read both rows. A parent flow that hands its input on, unchanged, to a `subflow` or `map` callee whose input carries the declaration is judged by that declaration too. A `loop` or `map` that later rebinds the name does not withdraw the declaration: it is the author's word about the value the caller sent.
18
+
19
+
**What stays as it was.** An input without the declaration keeps the visible-read rule: it is judged only where the definition reads it as a record id. A start whose caller can read the declared record starts as before.
20
+
21
+
**If a start now answers 404 or 400.** Hand the declared input the id of a record the caller can read in the object the input names, or start the flow as the system principal.
22
+
23
+
`@objectstack/spec`: the `objectName` describe on a flow variable no longer says that no door applies it, and its liveness row is `live`, so `os validate` no longer warns `liveness-planned-property` on a flow that declares it.
**Planned — no door applies this yet.** The declaration parses, is refused on a
2189
-
variable that is not an input, and is linted, but no start door loads a
2190
-
declared input today: a start that hands it an id the caller cannot read still
2191
-
runs. `os validate` warns on every flow that writes it
2192
-
(`liveness-planned-property`). The contract below is what the start doors will
2193
-
enforce.
2194
-
</Callout>
2195
-
2196
-
The contract: every door that starts the flow by name (the trigger route, an
2197
-
action of `type: 'flow'` over REST and MCP `run_action`, a declared endpoint of
2187
+
Every door that starts the flow by name (the trigger route, an action of
2188
+
`type: 'flow'` over REST and MCP `run_action`, a declared endpoint of
2198
2189
`type: 'flow'`) loads a declared input from the named object in the caller's
2199
-
own scope before the run exists. An id the caller cannot read there is refused
2200
-
`404``RECORD_NOT_FOUND`; a value that is not an id is refused `400`
2201
-
`VALIDATION_FAILED` naming the input. An input without the declaration is
2202
-
judged as a record only where the flow's own definition reads it as a record id
2203
-
(see the `404` row under [running a flow via the API](#run-a-flow-via-api)).
2190
+
own scope before the run exists. An id the caller cannot read there, or one
2191
+
that names no record, is refused `404``RECORD_NOT_FOUND`, and no run is
2192
+
created; a value that is not an id is refused `400` naming the input
2193
+
(`VALIDATION_FAILED`; at an action, a param's own declared type answers first
2194
+
with `VALIDATION_ERROR`). An input without the declaration is judged as a
2195
+
record only where the flow's own definition reads it as a record id (see the
2196
+
`404` row under [running a flow via the API](#run-a-flow-via-api)). The system
2197
+
principal is not judged.
2198
+
2199
+
-**Beside the definition's own reads, never in place of them.** When the flow
2200
+
also reads the input as an id of another object (a `get_record` node's
2201
+
`filter.id`, say), the door loads it from both, and the caller must be able
2202
+
to read both rows.
2203
+
-**Followed into sub-flows.** A parent that hands its input on, unchanged, to
2204
+
a `subflow` or `map` callee whose input carries the declaration is judged by
2205
+
that declaration too.
2204
2206
2205
2207
-**Inputs only.** A variable that is not `isInput: true` receives nothing from
2206
2208
a caller, so `objectName` there is refused at parse.
@@ -2606,7 +2608,7 @@ door's own admission check, made before anything is dispatched:
2606
2608
|`404`| — | No flow by that name in this deployment | Check the name; nothing was dispatched |
2607
2609
|`403`|`PERMISSION_DENIED`| The caller is not the system principal, and the flow is declared `runAs: 'system'` with a self-triggered `type` (`autolaunched`, `record_change`, `schedule`). The same answer at every door that starts a flow by name: this route, a `type: 'flow'` action (REST and MCP `run_action`) and a declared `type: 'flow'` endpoint | Let it run on its own trigger, or call it from a parent flow's `subflow` node. If members are meant to start it, declare it `type: 'screen'` (or `'api'` for a signed inbound hook) |
2608
2610
|`403`|`PERMISSION_DENIED`| The flow declares `requiredPermissions` and the caller, not the system principal, does not hold every capability it names. Checked after the row above, at the same doors; the message names the declared and the missing capabilities | Grant the capability through a permission set's `systemPermissions`, or start the flow as someone who holds it |
2609
-
| `404` | `RECORD_NOT_FOUND` | The start names a record (`recordId`, or the object's id alias such as `crmLeadId`) that the caller, not the system principal, cannot read in its own scope, or that does not exist: the two get one answer, the one the action door gives. Checked after the two rows above, at the same doors. A record key that is not one id, or a record named with no `objectName` for a flow declared `runAs: 'system'`, is refused `400` `VALIDATION_FAILED` naming the key. Where the flow's own definition reads a start input as the id of a record of a fixed object (a `get_record`, `update_record` or `delete_record` node with a literal `objectName` whose `filter.id` or `filter.id.$eq` is the input, or whose `filter.id.$in` is; a `screen` node with a literal `objectName` whose `recordId` is the input; a `subflow` or `map` node that hands the input to a callee input the callee reads so), that input is also loaded in the caller's own scope from THAT object, whatever object the start names, or none, and whatever the flow runs as: a value the caller cannot read there gets this `404`, and a value that is not one id (or a list of ids, where the definition reads a list) is refused `400` `VALIDATION_FAILED` naming the input | Start the flow on a record the caller can read, and name the record's object (`objectName`) beside `recordId`. Hand an input the flow reads as a record id the id of a record the caller can read in the object the flow reads it from, in the shape the flow reads (one id, or a list of ids) |
2611
+
| `404` | `RECORD_NOT_FOUND` | The start names a record (`recordId`, or the object's id alias such as `crmLeadId`) that the caller, not the system principal, cannot read in its own scope, or that does not exist: the two get one answer, the one the action door gives. Checked after the two rows above, at the same doors. A record key that is not one id, or a record named with no `objectName` for a flow declared `runAs: 'system'`, is refused `400` `VALIDATION_FAILED` naming the key. Where the flow's own definition reads a start input as the id of a record of a fixed object (a `get_record`, `update_record` or `delete_record` node with a literal `objectName` whose `filter.id` or `filter.id.$eq` is the input, or whose `filter.id.$in` is; a `screen` node with a literal `objectName` whose `recordId` is the input; a `subflow` or `map` node that hands the input to a callee input the callee reads so), that input is also loaded in the caller's own scope from THAT object, whatever object the start names, or none, and whatever the flow runs as: a value the caller cannot read there gets this `404`, and a value that is not one id (or a list of ids, where the definition reads a list) is refused `400` `VALIDATION_FAILED` naming the input. An input the flow declares a record id (`objectName` on the variable, [above](#a-start-input-that-is-a-record-id)) is loaded from the declared object the same way, whether or not the definition reads it | Start the flow on a record the caller can read, and name the record's object (`objectName`) beside `recordId`. Hand an input the flow reads as a record id the id of a record the caller can read in the object the flow reads it from, in the shape the flow reads (one id, or a list of ids) |
2610
2612
|`409`|`FLOW_DISABLED`| The flow exists but is switched off | Enable it — the identical request then succeeds |
2611
2613
|`422`|`FLOW_NO_START_NODE`| The stored definition has no `start` node | Fix the flow; retrying cannot help |
2612
2614
|`422`|`FLOW_INPUT_SCHEMA_INVALID`| A node's `config` violates the `inputSchema` its own definition declares | Fix the flow; the refusal is non-retryable — even under `errorHandling.strategy: 'retry'` the engine refuses once and never enters the retry loop |
Copy file name to clipboardExpand all lines: packages/spec/liveness/flow.json
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -91,12 +91,10 @@
91
91
"evidence": "packages/services/service-automation/src/dag-traversal.ts#seedDeclaredVariables (bound when no param supplies the name, #4697)"
92
92
},
93
93
"objectName": {
94
-
"status": "planned",
95
-
"verifiedAt": "2026-11-02",
96
-
"evidence": "packages/spec/src/automation/flow.zod.ts#FlowVariableSchema (the superRefine that refuses `objectName` on a variable that is not an input — the one place the key is read today)",
97
-
"authorWarn": true,
98
-
"authorHint": "Keep it, but nothing reads it yet: no start door loads a declared input from its object until the start doors ship that check, so an id the caller cannot read still starts a run.",
99
-
"note": "PLANNED RECORD (#29442, the spec half of #29425 ruling A 6580257050): an input's declaration that its value is the id of one record of the named object. Parsed, refused on a non-input (the evidence above) and linted (`flow-input-unknown-object` in packages/lint/src/validate-flow-trigger-readiness.ts). No door reads it: the start doors' third question (packages/runtime/src/flow-start-admission.ts, `flowDeclaredRecordReads` / `refuseUnreadableFlowStartRecords` in action-execution.ts) judges only inputs the definition reads in plain sight. Carrier: the #29425 server half, Blocked-by #29442 (every start door loads a declared input in the caller's scope, 404 RECORD_NOT_FOUND / 400 VALIDATION_FAILED). Flip to `live` on the commit that cites that reader, drop `authorWarn` / `authorHint` and the describe's planned sentence in that same edit."
94
+
"status": "live",
95
+
"verifiedAt": "2026-11-05",
96
+
"evidence": "packages/runtime/src/flow-start-admission.ts#flowDeclaredRecordReads (a declared input is one read of the declared object, asked by `refuseUnreadableFlowStartRecords` in action-execution.ts at every door that starts a flow by name: loaded in the caller's scope before the run exists, 404 RECORD_NOT_FOUND / 400 naming the input)",
97
+
"note": "#29425 ruling A: an input's declaration that its value is the id of one record of the named object. Added beside every read the definition makes in plain sight, never in place of one, and followed into a callee through subflow / map hand-offs. Also refused on a non-input (packages/spec/src/automation/flow.zod.ts#FlowVariableSchema) and linted (`flow-input-unknown-object` in packages/lint/src/validate-flow-trigger-readiness.ts)."
0 commit comments