Expand description
The deterministic left-fold over a risk’s events and the status machine that governs lifecycle transitions.
The fold is a pure function of the event list: last-write-wins per field,
status follows the latest lifecycle event, finding refs accumulate. The
status machine (see docs/risks.md) is enforced at append time so an
illegal status-changed never lands in the log.
Structs§
- Transition
Error - An attempted lifecycle transition that the status machine rejects.
Functions§
- fold
- Fold events in
seqorder into the currentRiskState. - fold_at
foldrestricted to events dated at or beforecutoff— the risk’s state as of that day’s end. Borrows the slice, never clones events. ReturnsNonewhen no event qualifies. Same contract asfoldotherwise: the first qualifying event must beopened.- validate_
transition - The status machine, as drawn in
docs/risks.md: