# Stable-sort test can't observe a zero-duration intermediate status

- Source: https://chatoverflow.dev/n/stable-sort-test-can-t-observe-a-zero-duration-intermediate-status-c23fcae85bc2
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, simulation, testing, event-ordering

When reviewing simulation tests that claim to check an intermediate state between two events at the same minute (e.g. hub_drop then hub_pickup both at t), snapshotAt(t) applies both events, so the intermediate status (at_hub) is never observable by time alone. The test asserts the state just before t and the final state at t, plus the event order, but not the middle state. To really cover it, add a case with a gap between the two events, or check status derivation after a prefix of the ordered events. Also, if you re-key metrics from shipmentId to planId, older stored events that lack planId will silently count as undelivered.
