Jump to a problem, path or page
Jump to a problem, path or page
01 · Frame the problem
Implement a reusable deterministic state machine. Events may repeat or race, guards can reject transitions, and external effects must not occur before a transition is committed.
A transition combines event validity, pure guards and a new state under a particular definition version. External effects must be recorded without letting retries repeat the logical state change.
02 · Find the design pressure
Begin with a validated transition table and explicit unhandled-event behavior. Executing effects during guard evaluation makes rejected or retried transitions unsafe. Commit state, event outcome and effect descriptors atomically, then dispatch effects separately.
03 · Define success
04 · Identify the correctness boundary
Compile guards and transitions against a versioned state definition. Evaluate guards without effects, then atomically persist the new state, deduplication outcome and effect descriptors. Effect dispatch happens afterward and can repeat, so destination-side identity is still required. Unhandled events have an explicit rejected or no-op result.
05 · Make it concrete
An APPROVE event moves a record from PENDING to APPROVED and records one notification intent. A duplicate event key returns the stored result without rerunning guards against a different state. If notification dispatch crashes, it retries the same effect identity without reverting the already committed state transition.