22 Feb 2026
The Flight Recorder: Deterministic Replay & Bug Reconstruction
A bug that happens at minute 14 of a chaotic scenario is a nightmare to debug — unless you can play it back like a movie. We built a deterministic replay engine that captures, shares, and reconstructs any simulation session with bit-perfect accuracy.
As we added more concurrent actors — patients, doctors, room timers — we hit the classic distributed systems problem: a bug would appear once in a session and vanish when we tried to recreate it.
The fix was architectural. Every session is now a pure function of its inputs, recorded as an event stream:
- Both the simulation heartbeat and every user command are recorded with high-resolution timestamps, maintaining perfect causality on playback.
- Random ID generation replaced with a deterministic system — every room and patient has the same identity across every replay.
- Each session produces a portable JSON flight log that can be exported and replayed to jump to any moment in the scenario.
For the simulation, this lays the groundwork for post-drill debriefs — scrubbing back through decisions, seeing exactly where a treatment plan succeeded or failed.