Avoid transient working directory in XCL EOF tests #3162

Merged
merzleckeier merged 1 commit from upstream-pr/3162 into main 2026-12-02 18:36:47 +00:00
merzleckeier commented 2026-12-02 15:43:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T15:43:59Z.


Claimed in the coordination issue as TEST-XCL-OUTPUT-EOF-CWD.

What and why

OutputEOF starts a synthetic Python subprocess that writes to pipes. Let it inherit the test runner's working directory so the test no longer depends on deleting a temporary directory after the subprocess exits. Both EOF cases still start a real subprocess and exercise the existing watchdog and exit-code assertions.

The Windows CI job on #3160 failed at os.rmdir in the fixture's teardown with WinError 32. The failing fixture and tools/xcl_compare.py are identical on that PR and main. The CI log establishes the failed cleanup path. The identity of the process holding the directory open is unconfirmed.

Tested

  • python -I tests/test_xcl_compare.py passed all 20 tests on Linux and on Windows CPython 3.12.10 under Wine 11.22.
  • A scratch probe simulated a sharing violation in TemporaryDirectory.__exit__ while running the original real-subprocess timeout test. The test failed on main (3c106eb2f) and passed with this change on both runners.
  • git diff --check and python -I scripts/check_no_game_data.py passed. The separate read-only review found no issues.

GPUs tested: n/a (synthetic subprocess tests).

AI-assisted: OpenAI Codex (GPT-6), with independent review by GPT-6.2 Sol.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5609823702 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3162). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T15:43:59Z. --- Claimed in the coordination issue as [TEST-XCL-OUTPUT-EOF-CWD](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7350728247). ### What and why `OutputEOF` starts a synthetic Python subprocess that writes to pipes. Let it inherit the test runner's working directory so the test no longer depends on deleting a temporary directory after the subprocess exits. Both EOF cases still start a real subprocess and exercise the existing watchdog and exit-code assertions. The [Windows CI job on #3160](https://github.com/ProjectLeonida/mandy/actions/runs/46912494733/job/143571552581) failed at `os.rmdir` in the fixture's teardown with `WinError 32`. The failing fixture and `tools/xcl_compare.py` are identical on that PR and `main`. The CI log establishes the failed cleanup path. The identity of the process holding the directory open is unconfirmed. ### Tested - `python -I tests/test_xcl_compare.py` passed all 20 tests on Linux and on Windows CPython 3.12.10 under Wine 11.22. - A scratch probe simulated a sharing violation in `TemporaryDirectory.__exit__` while running the original real-subprocess timeout test. The test failed on `main` (`3c106eb2f`) and passed with this change on both runners. - `git diff --check` and `python -I scripts/check_no_game_data.py` passed. The separate read-only review found no issues. GPUs tested: n/a (synthetic subprocess tests). AI-assisted: OpenAI Codex (GPT-6), with independent review by GPT-6.2 Sol.
fiestorra commented 2026-12-02 16:27:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T16:27:20Z.


Checked here: the file's tests pass on both sides, and the change is the simplification it says it is.

python -I tests/test_xcl_compare.py   on main               Ran 20 tests in 8.793s   OK
python -I tests/test_xcl_compare.py   with the change       Ran 20 tests in 8.750s   OK

The change itself is three lines: the synthetic child that writes to pipes no longer gets a tempfile.TemporaryDirectory() as its working directory - it inherits the runner's, because it writes to pipes and never touches the tree. The comment says exactly that, which is the part worth keeping: a reader who wonders whether the child could write a file into the repository now has the answer at the call site.

What it does not show, and cannot: the flake it avoids. A transient working directory that disappears under a subprocess is a race; both runs pass here, and I would not claim a red side for a change whose failure is by definition intermittent. What it does show is that nothing else in test_xcl_compare.py moved - the same 20 tests, in the same 8.8 seconds.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351971414 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3162#issuecomment-7351971414). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T16:27:20Z. --- **Checked here: the file's tests pass on both sides, and the change is the simplification it says it is.** ``` python -I tests/test_xcl_compare.py on main Ran 20 tests in 8.793s OK python -I tests/test_xcl_compare.py with the change Ran 20 tests in 8.750s OK ``` **The change itself is three lines**: the synthetic child that writes to pipes no longer gets a `tempfile.TemporaryDirectory()` as its working directory - it inherits the runner's, **because it writes to pipes and never touches the tree**. **The comment says exactly that**, which is the part worth keeping: a reader who wonders whether the child could write a file into the repository now has the answer at the call site. **What it does not show, and cannot**: **the flake it avoids.** A transient working directory that disappears under a subprocess is a race; **both runs pass here, and I would not claim a red side for a change whose failure is by definition intermittent.** **What it does show is that nothing else in `test_xcl_compare.py` moved** - the same 20 tests, in the same 8.8 seconds. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
MoonEyes commented 2026-12-02 18:01:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:01:42Z.


RUN (independent run on Windows, head 7bc09ed09568492e86817570f50b5264ce0f6b14, merged into main 45dc41f95c1cd0dcc29c2c50582e0e9af8a77259 with git merge --no-ff)

Green

  • python -I tests/test_xcl_compare.py on the merge: 20 tests, OK.
  • python -I scripts/check_no_game_data.py tests/test_xcl_compare.py: clean. git diff --check: clean.
  • Only this file refers to xcl_compare in tests and scripts, so there is no other related test.

Red
The PR changes a test only, so there is no tool to swap back. I swapped main's version of the test file back and injected the failure the PR describes: TemporaryDirectory.__exit__ raising a simulated WinError 32 (PermissionError 32), run against the two OutputEOF tests.

  • main's test file: 2 of 2 error out.
  • PR's test file: 0 of 2 fail, since no temporary directory is created.
    This shows the change removes the dependency on that cleanup. It does not show the real holder of the directory, which the PR also says is unconfirmed. Restored afterwards.

Review

  • Diff is 3 lines in tests/test_xcl_compare.py: tmp is replaced by None as the cwd of xc.run_title, with a comment. Still a real subprocess, same assertions.
  • Claim: linked to issues/2570 (TEST-XCL-OUTPUT-EOF-CWD). The claim comment was not opened here.
  • No open reviewer questions; one existing comment, which found the same thing (green only).

Not covered

  • The real Windows CI flake (intermittent, unreproduced here); only a simulation.
  • Wine and Linux runs claimed in the PR were not repeated.
  • Whether run_title with cwd=None is also fine for the other callers of the tool (not changed by the PR).

Verdict: PASS

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353873969 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3162#issuecomment-7353873969). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:42Z. --- RUN (independent run on Windows, head `7bc09ed09568492e86817570f50b5264ce0f6b14`, merged into `main` `45dc41f95c1cd0dcc29c2c50582e0e9af8a77259` with `git merge --no-ff`) **Green** - `python -I tests/test_xcl_compare.py` on the merge: 20 tests, OK. - `python -I scripts/check_no_game_data.py tests/test_xcl_compare.py`: clean. `git diff --check`: clean. - Only this file refers to `xcl_compare` in tests and scripts, so there is no other related test. **Red** The PR changes a test only, so there is no tool to swap back. I swapped main's version of the test file back and injected the failure the PR describes: `TemporaryDirectory.__exit__` raising a simulated `WinError 32` (PermissionError 32), run against the two `OutputEOF` tests. - main's test file: 2 of 2 error out. - PR's test file: 0 of 2 fail, since no temporary directory is created. This shows the change removes the dependency on that cleanup. It does not show the real holder of the directory, which the PR also says is unconfirmed. Restored afterwards. **Review** - Diff is 3 lines in `tests/test_xcl_compare.py`: `tmp` is replaced by `None` as the cwd of `xc.run_title`, with a comment. Still a real subprocess, same assertions. - Claim: linked to issues/2570 (TEST-XCL-OUTPUT-EOF-CWD). The claim comment was not opened here. - No open reviewer questions; one existing comment, which found the same thing (green only). **Not covered** - The real Windows CI flake (intermittent, unreproduced here); only a simulation. - Wine and Linux runs claimed in the PR were not repeated. - Whether `run_title` with `cwd=None` is also fine for the other callers of the tool (not changed by the PR). **Verdict: PASS** AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
MoonEyes commented 2026-12-02 18:03:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:03:33Z.


Merging. Head 7bc09ed09 merges cleanly with main 45dc41f95 and does not force a rebase of #2566. Independent red/green posted on this head (20/20 green; with a simulated WinError 32 on temp-dir cleanup, main's OutputEOF tests error 2 of 2 and this head's pass), checked by a separate judge. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353901913 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3162#issuecomment-7353901913). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:03:33Z. --- Merging. Head `7bc09ed09` merges cleanly with `main` `45dc41f95` and does not force a rebase of #2566. Independent red/green posted on this head (20/20 green; with a simulated WinError 32 on temp-dir cleanup, main's OutputEOF tests error 2 of 2 and this head's pass), checked by a separate judge. Merged by MoonEyes. AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 18:11:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:11:41Z.


Verified #3162 on Linux: tests pass merged onto current main, and a simulated Windows cleanup failure is red on main and green with this change.

Head 7bc09ed095
Merged onto main 45dc41f95c (git merge --no-ff, clean; merge base 3c106eb2ff)
Machine Linux, Python 3.13.18, no GPU, no game files

Ran

python -I tests/test_xcl_compare.py                      Ran 20 tests  OK
python -I scripts/check_no_game_data.py tests/test_xcl_compare.py   exit 0

Red/green (simulated, since the real failure is a Windows-only race). A scratch probe replaced tempfile.TemporaryDirectory.__exit__ with one that raises PermissionError(32) (the WinError 32 from the CI log) and ran only the OutputEOF class:

test file from main (45dc41f95c)   Ran 2 tests   FAILED (errors=2)
test file from this PR             Ran 2 tests   OK

So the change removes the dependency on deleting the temporary directory, which is the failure the description names. It does not prove which process held the directory on the CI runner, as the description itself says.

Review. tools/xcl_compare.run_title passes cwd straight to subprocess.Popen(cwd=cwd, ...) (tools/xcl_compare.py:162), so None means "inherit", and the child only writes to its pipes. Both EOF cases still start a real subprocess and keep their watchdog and exit-code assertions. No defects found.

Verdict: ready. Test-only change, CI green on the head, claim item TEST-XCL-OUTPUT-EOF-CWD and AI disclosure present.

AI-assisted: Claude Opus 5.5 (Claude Code), verification only.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354096307 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3162#issuecomment-7354096307). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:11:41Z. --- **Verified #3162 on Linux: tests pass merged onto current `main`, and a simulated Windows cleanup failure is red on `main` and green with this change.** | | | |---|---| | Head | `7bc09ed095` | | Merged onto | `main` `45dc41f95c` (`git merge --no-ff`, clean; merge base `3c106eb2ff`) | | Machine | Linux, Python 3.13.18, no GPU, no game files | **Ran** ``` python -I tests/test_xcl_compare.py Ran 20 tests OK python -I scripts/check_no_game_data.py tests/test_xcl_compare.py exit 0 ``` **Red/green (simulated, since the real failure is a Windows-only race).** A scratch probe replaced `tempfile.TemporaryDirectory.__exit__` with one that raises `PermissionError(32)` (the `WinError 32` from the CI log) and ran only the `OutputEOF` class: ``` test file from main (45dc41f95c) Ran 2 tests FAILED (errors=2) test file from this PR Ran 2 tests OK ``` So the change removes the dependency on deleting the temporary directory, which is the failure the description names. It does not prove which process held the directory on the CI runner, as the description itself says. **Review.** `tools/xcl_compare.run_title` passes `cwd` straight to `subprocess.Popen(cwd=cwd, ...)` (`tools/xcl_compare.py:162`), so `None` means "inherit", and the child only writes to its pipes. Both EOF cases still start a real subprocess and keep their watchdog and exit-code assertions. No defects found. **Verdict: ready.** Test-only change, CI green on the head, claim item `TEST-XCL-OUTPUT-EOF-CWD` and AI disclosure present. AI-assisted: Claude Opus 5.5 (Claude Code), verification only. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3162
No description provided.