--- id: PIPE-4 family: RT-PIPE level: core profiles: [runtime] posture: normative-target added: "1.0" changed: "1.0" source: https://flowdrop.io/spec/rules/rt-pipe/pipe-4 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # PIPE-4 — Node statuses are keyed by workflow node id and collapse every iteration *RT-PIPE (Part II) · level: core · profiles: runtime · added in 1.0* This is what an editor looks a badge up by, so the key is the id the canvas holds. A node that ran many times still has one entry, with the per-iteration picture inside it. ## The rule > **Normative.** This is the rule. > > 1. `node_statuses` MUST be keyed by the workflow node id (the id the stored workflow gives the node). > > 2. It MUST NOT be keyed by a job identifier, a node-type identifier or an iteration-suffixed variant. > > 3. Iterations of a node produced by a loop MUST carry the plain node id, so every iteration collapses onto one entry. > > 4. `node_statuses` MUST have a key only for nodes that produced work; a node excluded from execution MUST have no entry and reads as idle. > > 5. Within a collapsed entry, `status` MUST be the status of the newest job in the group, with the later job in run order winning a tie. > > 6. Within a collapsed entry, `last_executed`, `execution_time` and `execution_time_us` MUST come from the most recent job that actually started. > > 7. They MUST be null when no job started. > > 8. `error` MUST come from that started job, otherwise from the newest. > > 9. `executions` MUST count only jobs that started. > > 10. `status_counts` MUST count every job in the group. > > 11. A job entry's `node_id` MUST carry the same ids. ## What it means `node_statuses` is keyed by the same node id the stored workflow holds, never by the id of the job record that recorded a run of it and never by the node type it is an instance of — a key derived from either of those would resolve every node on a workflow to the same identifier, or to none the editor recognises, and the badge lookup would miss. A loop producing many jobs for the same workflow node still collapses onto one entry keyed by that plain node id, with the per-iteration detail living inside the entry rather than spread across suffixed keys. Within a collapsed entry, the fields do not all come from the same job. `status` comes from the newest job in the group; `last_executed` and the execution timing come from the most recent job that actually started, because a job that was created later but never ran has no timing to offer; `error` follows that same started job rather than the newest one, so a never-started duplicate cannot surface a stale message; `executions` counts only jobs that started; and `status_counts` counts every job in the group, started or not — so a node can show one more job in its counts than it reports executions for. ## Example A node's original job completed after starting; a second job for the same node, created sixty seconds later, is marked failed without ever starting. ```json title="The status_counts of the collapsed entry" verdict="both" {"completed": 1, "failed": 1} ``` ```json title="The executions of the collapsed entry" verdict="one" 1 ``` `status` is `failed`, following the newer job; `error` is null, because the job that actually started never failed; `last_executed` and the timing are those of the job that ran. ## Why Recorded under [OPEN-25](https://flowdrop.io/spec/rulings/open-25). ## Related rules - Names: PIPE-3, PIPE-7 - Referenced by: PIPE-3, PIPE-7 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.