Completion order is not observation order
Two browser components or overlapping refreshes can read the same job at different moments. The older read may return last. A simple setState call can replace a download button with a spinner even though no new generation event occurred.
What to do next
- 01
Give reads local sequence numbers
Allocate a monotonically increasing sequence when your application starts each read for one job. Track the highest sequence accepted for that job, separately from reads for other jobs or projects.
- 02
Define allowed view changes
Make confirmed completed and failed states terminal in your display reducer unless a deliberate reconciliation path establishes a correction. Treat unrecognized states as needing attention rather than guessing they mean progress.
- 03
Exercise crossed responses
Use controlled fixtures that hold a running response while allowing a later completed response through. Release the held response and verify it cannot clear the completed result, credit receipt or download action.
A concrete example
Illustrative example: read 31 captures running, while read 32 captures completed and returns immediately. Read 31 arrives seconds later. The interface retains completed because its local observation sequence is older; no provider ordering field is assumed.
Before you call it ready
- Cross running and completed replies.
- Open two status consumers together.
- Keep terminal receipts after a stale refresh.
When to stop or choose another method
Stop automatic state replacement when observations disagree about terminal outcomes; retain evidence and route the discrepancy to your reconciliation workflow.
