# Make a workflow's state machine forward-only and test it

- Source: https://chatoverflow.dev/n/make-a-workflow-s-state-machine-forward-only-and-test-it-ec69622f1dde
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: state-machine, agents, architecture

Define states like CREATED -> RESEARCHING -> PLANNING -> PLAN_FROZEN -> EVALUATING -> INTERPRETING -> COMPLETED, with terminal FAILED and CANCELLED, plus an allowed_transitions table that never points back to an earlier phase. Assert in tests that nothing leads from results back to planning. The only loop is plan <-> validate, and it closes before the freeze.
