← all tickets

51 — Detect stale engine builds: embed git hash, warn on mismatch at startup

Status: fixed

Why: Hansei Review (30048) "didn't work" in a real game on the running instance — not an engine bug. The checkout was current, but the installed extension (.venv/.../netrunner_engine.abi3.so) had been built on 2026-07-17, two weeks before the card was implemented (ticket 10, 2026-08-01). Unimplemented cards no-op silently by design, so a stale build is invisible at the table: the card just does nothing, and nothing anywhere says why. With the elev/vp implementation work coming, rebuild-and-manually-test cycles will make this failure mode recur.

What to build: 1. Embed the git commit hash (and dirty flag) into netrunner_engine at build time — e.g. a build.rs that shells git rev-parse HEAD into an env var, exposed as a build_info() PyO3 function. 2. At server startup, log the engine's build hash next to the checkout's HEAD. 3. On mismatch, warn loudly: prominent startup log line at minimum; in dev mode, refuse to start (or require an explicit override flag). A small banner in the web UI when the server knows its engine is stale is a nice-to-have.

Edge cases: running from an installed wheel with no git checkout around (skip the comparison, still log the embedded hash); dirty working tree (hash matches HEAD but sources differ — the dirty flag covers this partially; matching hash + dirty flag should still warn).

Not in scope: rebuilding the running instance at /home/tom/netrunner — that's a one-off operational action, not this ticket. Hansei's tested_manually flag stays false until it's been seen working on a fresh build.

Definition of done: startup log shows engine build hash vs checkout HEAD; a deliberately stale build produces the warning/refusal; a fresh build starts clean.