Teaching Case — A Machine and a Coin Toss
Two transitions leave `Review` on the same event and nothing tells them apart. The document does not say which one runs, so this is not a state machine: it is a state machine and a coin toss, and it draws as two perfectly ordinary arrows leaving one box. The engine also refuses the false positive next door — the fork out of `Draft` carries a guard on each branch, which makes it deterministic, and the engine says nothing about it.
What this template contains
- Source
- 13 lines
Make it your own.
title "Review workflow"
state Draft
state Review
state Approved final
state Rejected final
state Escalated
initial Draft
transition Draft -> Review on "submit" [complete]
transition Draft -> Draft on "submit" [incomplete] / list gaps
transition Review -> Approved on "decide"
transition Review -> Rejected on "decide"
transition Review -> Escalated on "escalate" [over threshold]
transition Escalated -> Approved on "override"