Skip to main content

next_step

Function next_step 

Source
pub fn next_step<'a>(flow: &'a Flow, evidence: &[StageEvidence]) -> Step<'a>
Expand description

The pure decision at the heart of a flow: a left fold over the run’s ordered evidence log. A cursor starts at stage 0 and consumes rows in sequence: a Pass advances it, a Fail applies the failed stage’s fail_actionHalt stops, Continue advances, ReturnTo moves the cursor back if that edge’s budget is not yet spent. Wherever the cursor stands once the log is exhausted is what runs next.

Position is therefore always recomputed from history; no stored cursor exists to disagree with it. Because the fold reads only the rows — never a clock, a process, or the store — resuming after a crash with the same log yields the same Step: the walk is idempotent by construction.

Rows must arrive in log order. A row for any other stage or attempt than the one the cursor expects is a corrupt log, not a hint to re-order.