Late Order Events Regress the Latest Status
Level 2 · node · Data · Missing event version ordering check
Scenario
Order status events contain an orderId and an increasing version. Broker retries can deliver events out of order. The current service stores every arriving event, so after version 8 sets SHIPPED, a late version 7 PAID event can regress the order to an older state.
Requirements
- Only an event with a higher version may update each order - Events with a version lower than or equal to the current version return ignored - Higher-version events are applied normally - Versions for different orders do not affect one another - Stored status and version always come from the same accepted event
Acceptance criteria
- The first event stores the order status and version
- A higher-version event updates the existing state
- A late lower-version event cannot regress the latest state
- A retry with the same version is ignored
- Different orders maintain independent version ordering