I know this is a big commit…
There are some tests that aren’t testable yet, such as testing that an active state transitions to cancelled/failed states. This is due to the inability to wait during some states like SaleFilling. The tests would likely need to be redesigned, but I don’t think it’s worth pursuing the fully declarative model further as it is too hard to debug.
The declarative state machine DOES work, however.
The main point for keeping this commit is for the learnings about the state machine to bring fwd into the branch used in 306.