import InfoBox from '../components/InfoBox.astro';

The automated gameplay recording pipeline was passing its dry runs but failing in the real browser. The tracing script relied on a hand-rolled duplicate of the game's direction and collision logic. When a previous fix changed how the engine persists a snake's pre-crash heading in PvP, the duplicate never picked it up, causing the tool to predict safety where the real engine found a collision. 

The fix was to stop duplicating the logic and import the real engine instead. By running the tracing script through `tsx`, the dry-run tooling can now resolve and execute the actual `WordProcessor` and `SnakeManager` files that drive the game. This structurally prevents the tooling from disagreeing with what the browser will do.

<InfoBox variant="note">
The tracer still hand-rolls combo detection and PvP turn orchestration. These are recording-specific concerns used to ensure the generated video highlights specific mechanics, not core engine logic that risks drifting.
</InfoBox>

While closing the accuracy gap, the recording script also needed predictability for the Daily Challenge mode. Previously, the opening words of the daily recording had to be manually re-derived every calendar day to ensure the snake actually ate that day's seeded apple. This was slow and brittle.

The solution was to abandon the real date-seeded apple queue during recordings and replace it with a pinned synthetic queue. Using the same `devGameOverrides` mechanism built for combo testing, the script now forces the apple to spawn exactly where the existing opening words already end. The recording no longer reflects the real day's layout, a conscious tradeoff for a script that can run unattended.

To finish the stabilization, the script's `node` invocations were replaced with `tsx` across the board, and the PvP guest's final word sequence was redesigned to guarantee a game-ending loss of all three lives from the newly accurate frozen-snake heading. The recording pipeline is now a reliable, zero-maintenance asset generator.