Repository navigation
fix(tests): refuse test writes under the real home - #4857
Conversation
Test recordAll runs are on the final code (head Before the fix: the final test file with the support code of
After the fix:
Fail-to-pass
The replay puts the Other open pull requestsNo open pull request changes a file of this change. Live stepsNone. The change touches no cluster, ConfigMap or Secret. |
…outside a run fail
…file system call The guard resolved each written path with os.path.realpath, which calls os.lstat. Three worktree tests replace os.lstat with a function that removes a file, so the removal started the guard again until the recursion limit. The guard now makes the written path absolute and normalized with no file system call, and compares it with the given and the resolved form of each root.
ef80c71 to
9e70a36
Compare
Fix round: the home write guard and the replaced
|
The plain-Python helper test of the hermetic floor (#4857) started its child process with `python -I`. `-I` drops `PYTHONPATH`. The Service image test job finds pytest and the test dependencies only on `PYTHONPATH`, so the child stopped at `import pytest`, and `Service Image Tests` failed on main and on the release pull request. The child now starts with `-P -s`: the working directory stays off the import path, the user site directory stays out, and `PYTHONPATH` stays. The guard and the helpers do not change. Closes #4891 Change: `openspec/changes/archive/2026-11-12-4891-helper-test-keeps-pythonpath/`
🤖 I have created a release *beep* *boop* --- ## [0.115.0](v0.114.1...v0.115.0) (2026-11-12) ### Features * **design:** add the design tokens and their build ([#4811](#4811)) ([db4b19a](db4b19a)) * **roadmap:** find symbol definitions with tree-sitter ([#4820](#4820)) ([3b3fddc](3b3fddc)) ### Bug Fixes * **ai:** the gateway group that answered decides the local label ([#4907](#4907)) ([0da637f](0da637f)) * **ci:** replay a changed gate check in fail-to-pass ([#4898](#4898)) ([59bfc57](59bfc57)) * **config:** read each config file as YAML 1.2 ([#4858](#4858)) ([c3130a3](c3130a3)) * **roadmap:** loosen the caps that turn a stage refusal into a loss ([#4869](#4869)) ([4492fc3](4492fc3)) * **roadmap:** refine reads a dependency named by title ([#4877](#4877)) ([2829f9c](2829f9c)) * **roadmap:** refine sends a judge refusal to an agent round ([#4874](#4874)) ([e4fc6a9](e4fc6a9)) * **tests:** refuse test writes under the real home ([#4857](#4857)) ([0f6ac1b](0f6ac1b)) * **tests:** the plain-Python helper test keeps PYTHONPATH ([#4914](#4914)) ([99c109d](99c109d)) ### Performance Improvements * **ci:** direct pytest runs wait for a gate slot ([#4901](#4901)) ([e80db62](e80db62)) * **roadmap:** status lane reads the snapshot, skips idle stops ([#4887](#4887)) ([f285cf8](f285cf8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
link_at_pin, called from plain Python, wrote a stub over 18 real tools under the real home. In pytest, the floor refused a write under the real home only for a config file or a spend ledger.tests/support/home_write_guard.pyadds a PEP 578 audit hook. It fails a test that writes, renames onto or removes a file under the real home, outside the run's temporary directory, the checkout and the interpreter, also when the code catches the failure. The hook calls no function that a test can replace, such asos.lstat.isolate_homerecords the real home for each xdist worker.hold_to_the_runrefuses a path outside the active pytest run, or with no run.link_at_pinandglobal_configcall it.tests/support/file_changes.py.docs/TESTING.mdnames the guard and the helper rule.Closes #4739
Change:
openspec/changes/archive/2026-11-11-4739-test-helpers-write-to-the-real/