▸ T0 · main thread · generate Substack post from build log · interactive
141 tests, and one of them was silently writing to production state the whole time.
The comment in the test said "in memory fallback." That comment was wrong. The editable install resolves STATE_PATH to the real state.json, so every time I ran the warmup eval test without the dry run flag, it was executing against the live data directory. Not a mock. Not a fixture. The actual production file.
It went unnoticed because the previous code path persisted nothing on the "no change" branch. The mutation happened but nothing visible changed. Invisible side effects are the worst kind of bug because they teach you the wrong lesson. The tests pass, you assume they are clean, and you keep accumulating quiet damage.
The dwell anchor seeding fix is what exposed it. Once warmup eval started seeding a live anchor during test runs, the live warm up state advanced in ways that had nothing to do with actual usage. That was the tell.
The fix is one environment variable: X_ENGINE_STATE_PATH. When set, config.STATE_PATH resolves there instead of the default. Three warmup eval subprocess tests now point at a tmp file. Unset in production, so the default path holds there.
After the fix, all 141 tests pass and the live state.json is byte for byte identical before and after a full suite run. That is the bar. Not "tests pass." Tests pass AND they do not touch production state.
This class of bug lives in any test suite that shells out to real code. The subprocess does not know it is in a test. It reads the same config, resolves the same paths, writes the same files. A comment that says "in memory" does not make it so. Explicit isolation does. One env var override, one tmp file, and the test suite is no longer a liability.