Developer discovers test silently wrote to production state file due to false isolation comment
A test labeled with an 'in memory fallback' comment was actually running against a live production state file, not an isolated environment, because an editable pip install resolved the state path at import time to the real file. The bug went undetected because the code path being tested was a no-op — warm-up state requiring no updates wrote nothing back, so the production file remained unchanged and no harm was visible. The problem surfaced when a new code change caused that same path to write a test timestamp to the live state file, violating the principle that tests must not touch production data. The fix introduced an environment variable, X_ENGINE_STATE_PATH, allowing subprocess tests to override the config path and point to a temporary fixture file instead. The developer verified full isolation by running all 141 tests and confirming the production state file was byte-for-byte identical before and after the suite.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in