FlowDrop Workflow Specification 1.0-draft

A ForEach node initializes its iterator once and completes on an empty list

The rule

Normative: this is the rule
  1. A ForEach node initializes its iterator on the round where the state carries none, and requires items to iterate.
  2. A value that is not a list is wrapped as a single item, and the items are re-indexed so that iteration is positional.
  3. An empty list completes the node immediately rather than entering the loop.
  4. On completion the node emits its defined output set, including the results collected across the rounds it ran.

What it means

An empty list is not a loop that runs zero times — it is completion on the first round, with the node's whole defined output set produced immediately, current item included as absent rather than left unset. A value that is not a list at all is not refused either: it is wrapped as the one item a single round iterates, re-indexed the same way any list would be, so a round that receives a bare scalar behaves exactly like a round over a one-item list.

Example

A ForEach launched with no items
{"items": []}
What it emits on that roundcompleted
{"loop_active": false, "current_item": null, "total_count": 0, "collected_results": []}
A ForEach launched with one scalar, not a list
{"items": "scalar_value"}
What it emits on that roundwrapped
{"current_item": "scalar_value", "current_index": 0, "total_count": 1, "is_first": true, "is_last": true}
Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0-draft · SG-4 · changed in spec 1.0