Tagged state-machine
2 pieces
- · 10 min read
Accept Is Binding, So Accept Has To Be Idempotent
When a counterparty can accept an executable quote from a phone, the accept action will be repeated. A tap on poor signal that appears to do nothing gets tapped again, clients retry on timeout, and proxies replay. Unless an idempotency key is checked before the state transition is applied, the second attempt creates a second binding trade against someone who believes they agreed once.
- · 11 min read
Model the Trade, Not the Screens
When quote, acceptance and settlement exist as three screens calling services ad hoc, the acceptance and the trade record can disagree, and a double tap can execute twice. An explicit state machine with defined transitions makes the impossible combination unrepresentable rather than merely unlikely. An append-only record of transitions lets settlement and reporting be projections of one history instead of two copies that drift apart.