tests: a locked recorder.exe no longer hides the cmake batch case's result (TEST-CMAKE-BATCH-CLEANUP) #1439

Merged
Anonymous78e merged 1 commit from upstream-pr/1439 into main 2026-12-01 15:15:57 +00:00
Anonymous78e commented 2026-11-25 00:16:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Anonymous78e on 2026-11-25T00:16:05Z.


Claimed in the coordination issue as: TEST-CMAKE-BATCH-CLEANUP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7148310075)

What and why

Part (3) of @GTAVIB4GTAVI's parallel-load finding (#14). Parts (1) and (2) are #1410 and #1002.

tests/test_build_runtime_cmake.py builds each case in tempfile.TemporaryDirectory(dir=self.base) and copies a recorder.exe into it, which a child process runs. When Windows still holds that image at cleanup (antivirus, a late handle close), shutil.rmtree raises PermissionError: [WinError 5] and that error replaces the case's own result, as reported:

PermissionError: [WinError 5] Access is denied: ...\caret^dir\tools ^ & 東京\recorder.exe

Both temp folders, the per-case one and the class one that holds the compiled recorder, now pass ignore_cleanup_errors=True (Python 3.10+; the project needs 3.12+), so the assertion stays in charge. Nothing else changes.

Tested

Windows 11 Pro 26H2, CPython 3.13.15, on main 1154976d4:

  • The mechanism, deterministically: a file held open inside a TemporaryDirectory whose body fails an assertion.

    exception that surfaces
    no flag (as on main) PermissionError: [WinError 32] ...
    ignore_cleanup_errors=True AssertionError: the case's own assertion
  • python -I tests/test_build_runtime_cmake.py: 1 test (27 subtests) OK in 11 s with this change.

  • scripts/check_no_game_data.py on the file: clean.

GPUs tested: n/a

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5482622199 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439). Originally posted by [Anonymous78e](https://github.com/Anonymous78e) on 2026-11-25T00:16:05Z. --- Claimed in the coordination issue as: TEST-CMAKE-BATCH-CLEANUP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7148310075) ### What and why Part (3) of @GTAVIB4GTAVI's parallel-load finding ([#14](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147794650)). Parts (1) and (2) are #1410 and #1002. `tests/test_build_runtime_cmake.py` builds each case in `tempfile.TemporaryDirectory(dir=self.base)` and copies a `recorder.exe` into it, which a child process runs. When Windows still holds that image at cleanup (antivirus, a late handle close), `shutil.rmtree` raises `PermissionError: [WinError 5]` and that error replaces the case's own result, as reported: ``` PermissionError: [WinError 5] Access is denied: ...\caret^dir\tools ^ & 東京\recorder.exe ``` Both temp folders, the per-case one and the class one that holds the compiled recorder, now pass `ignore_cleanup_errors=True` (Python 3.10+; the project needs 3.12+), so the assertion stays in charge. Nothing else changes. ### Tested Windows 11 Pro 26H2, CPython 3.13.15, on `main` 1154976d4: - The mechanism, deterministically: a file held open inside a `TemporaryDirectory` whose body fails an assertion. | | exception that surfaces | |---|---| | no flag (as on `main`) | `PermissionError: [WinError 32] ...` | | `ignore_cleanup_errors=True` | `AssertionError: the case's own assertion` | - `python -I tests/test_build_runtime_cmake.py`: 1 test (27 subtests) OK in 11 s with this change. - `scripts/check_no_game_data.py` on the file: clean. GPUs tested: n/a AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo
PierreEbele commented 2026-11-25 15:28:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T15:28:11Z.


Reviewed 751de4d16: both TemporaryDirectory calls in test_build_runtime_cmake.py now pass ignore_cleanup_errors=True, so a still-locked recorder.exe at cleanup can no longer replace (or masquerade as) a case's result: both the class-level folder and each subTest's copied recorder. Could not run the suite here (Windows-only: csc.exe and powershell.exe; on this Linux box it exits OK (skipped=1) and compiles clean); fault injection also cannot reproduce the lock here, so this is a code-reading review: I verified the mechanism by reading tempfile's routing: cleanup() forwards the flag and every raise site in rmtree's onexc, including the locked-file PermissionError branch, is behind if not ignore_errors; README pins Python 3.12+ and the ci check job runs this file on windows-latest. Leaked leonida_cmake* folders when cleanup does fail are the accepted trade-off. No findings.

AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166890656 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1439#issuecomment-7166890656). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T15:28:11Z. --- Reviewed 751de4d16: both TemporaryDirectory calls in test_build_runtime_cmake.py now pass ignore_cleanup_errors=True, so a still-locked recorder.exe at cleanup can no longer replace (or masquerade as) a case's result: both the class-level folder and each subTest's copied recorder. Could not run the suite here (Windows-only: csc.exe and powershell.exe; on this Linux box it exits `OK (skipped=1)` and compiles clean); fault injection also cannot reproduce the lock here, so this is a code-reading review: I verified the mechanism by reading tempfile's routing: cleanup() forwards the flag and every raise site in _rmtree's onexc, including the locked-file PermissionError branch, is behind `if not ignore_errors`; README pins Python 3.12+ and the ci check job runs this file on windows-latest. Leaked leonida_cmake_* folders when cleanup does fail are the accepted trade-off. No findings. AI-assisted review. **Recommendation:** Merge
OreoFR commented 2026-11-28 21:50:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:50:48Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head 751de4d16
  • Test: python -I tests/test_build_runtime_cmake.py
  • Red on main: 1 OK
  • Green with the PR: 1 OK
  • Verdict: NO RED (no recorder.exe was locked during the test)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246316190 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439#issuecomment-7246316190). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:50:48Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `751de4d16` - Test: `python -I tests/test_build_runtime_cmake.py` - Red on main: 1 OK - Green with the PR: 1 OK - Verdict: NO RED (no recorder.exe was locked during the test) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 00:55:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T00:55:28Z.


#1439 | head 751de4d16c (merged cleanly onto origin/main a3484ceebc) | Windows 11 (10.0.26200.9974, NTFS), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11 + NTFS)

  • Diff & safety audit: Inspected 100% of the diff (+4/-2 in tests/test_build_runtime_cmake.py) passing ignore_cleanup_errors=True to both tempfile.TemporaryDirectory calls in CMakeBatchTest. python -I scripts/check_no_game_data.py tests/test_build_runtime_cmake.py passed (rc=0).
  • Red -> Green on Windows 11 (origin/main a3484ceebc vs #1439 + origin/main):
    • Red (Windows NTFS locked .exe teardown): Verified on Windows 11 NTFS that leaving an open handle on recorder.exe inside a tempfile.TemporaryDirectory() block raises PermissionError ([WinError 32]) during __exit__ when ignore_cleanup_errors=True is omitted, masking any assertion outcome from the body, whereas TemporaryDirectory(ignore_cleanup_errors=True) exits cleanly without masking test assertions.
    • Green (#1439 + origin/main, native Windows csc.exe + cmd.exe batch matrix): python -I tests/test_build_runtime_cmake.py -> 1/1 (OK, 0 skipped, 31.23s), executing the full Windows-only CMakeBatchTest .exe / .cmd / .bat and failure-mode subtest matrix end-to-end.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248444294 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439#issuecomment-7248444294). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T00:55:28Z. --- #1439 | head 751de4d16c774016997db420e6ae0128cc9a1aff (merged cleanly onto origin/main a3484ceebc) | Windows 11 (10.0.26200.9974, NTFS), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11 + NTFS) - **Diff & safety audit**: Inspected 100% of the diff (`+4/-2` in `tests/test_build_runtime_cmake.py`) passing `ignore_cleanup_errors=True` to both `tempfile.TemporaryDirectory` calls in `CMakeBatchTest`. `python -I scripts/check_no_game_data.py tests/test_build_runtime_cmake.py` passed (`rc=0`). - **Red -> Green on Windows 11 (`origin/main` `a3484ceebc` vs `#1439 + origin/main`)**: - **Red (Windows NTFS locked `.exe` teardown)**: Verified on Windows 11 NTFS that leaving an open handle on `recorder.exe` inside a `tempfile.TemporaryDirectory()` block raises `PermissionError` (`[WinError 32]`) during `__exit__` when `ignore_cleanup_errors=True` is omitted, masking any assertion outcome from the body, whereas `TemporaryDirectory(ignore_cleanup_errors=True)` exits cleanly without masking test assertions. - **Green (`#1439 + origin/main`, native Windows `csc.exe` + `cmd.exe` batch matrix)**: `python -I tests/test_build_runtime_cmake.py` -> **`1/1` (`OK`, `0` skipped, `31.23s`)**, executing the full Windows-only `CMakeBatchTest` `.exe` / `.cmd` / `.bat` and failure-mode subtest matrix end-to-end.
TheGeogeo commented 2026-11-29 14:17:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:17:16Z.


Correction: not in main. Its squash commit 44a715d10 landed on 2026-11-27, but 00131bb85 ("main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia") restored tests/test_build_runtime_cmake.py the same day, so main does not have this change. I took the earlier verdict from the history (git cherry and the squash title), not from the tree. Re-checked on main c22a0a732: git merge-tree --write-tree of main and this branch gives a tree that still differs from main in tests/test_build_runtime_cmake.py.

New verdict: ready for testing. It merges cleanly with main c22a0a732.

This pull request was closed on the basis of our earlier, wrong verdict. Its change is not on main, so the author or a maintainer can reopen it.

AI-assisted (Claude Code).


Earlier comment, superseded by the correction above:

Already in main: squashed as 44a715d10 (2026-11-27, "PR #1439: tests: a locked recorder.exe no longer hides the cmake batch case's result (TEST-CMAKE-BATCH-CLEANUP)"), which is in main 3535eb5c4. git cherry finds this branch's commit there, so nothing is left to merge here.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257185999 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439#issuecomment-7257185999). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T14:17:16Z. --- **Correction: not in `main`.** Its squash commit `44a715d10` landed on 2026-11-27, but `00131bb85` ("main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia") restored `tests/test_build_runtime_cmake.py` the same day, so `main` does not have this change. I took the earlier verdict from the history (`git cherry` and the squash title), not from the tree. Re-checked on `main` `c22a0a732`: `git merge-tree --write-tree` of `main` and this branch gives a tree that still differs from `main` in `tests/test_build_runtime_cmake.py`. New verdict: ready for testing. It merges cleanly with `main` `c22a0a732`. This pull request was closed on the basis of our earlier, wrong verdict. Its change is not on main, so the author or a maintainer can reopen it. AI-assisted (Claude Code). --- *Earlier comment, superseded by the correction above:* Already in main: squashed as `44a715d10` (2026-11-27, "PR #1439: tests: a locked recorder.exe no longer hides the cmake batch case's result (TEST-CMAKE-BATCH-CLEANUP)"), which is in `main` `3535eb5c4`. `git cherry` finds this branch's commit there, so nothing is left to merge here. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 14:30:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:30:13Z.


Closing: this landed on main as 44a715d10 ("PR #1439: tests: a locked recorder.exe no longer hides..."), checked in main just now. Thanks for the fix!

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257352899 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439#issuecomment-7257352899). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:30:13Z. --- Closing: this landed on main as 44a715d10 ("PR #1439: tests: a locked recorder.exe no longer hides..."), checked in main just now. Thanks for the fix!
MoonEyes commented 2026-11-29 14:58:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:58:04Z.


Correction: I closed this as already on main, and that was wrong. Its commit did land, but 00131bb85 (27/11, "main keeps its own runtime, tools and tests") removed those lines again, so main does not have this change today. I tried to reopen it, but GitHub refuses: you are at this repository's open pull request limit. You can reopen it yourself once one of your PRs is merged or closed, or say here if you want a maintainer to carry it forward with your commits. Sorry for the noise.

AI-assisted: yes (checked line by line against current main)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257714811 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439#issuecomment-7257714811). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:58:04Z. --- Correction: I closed this as already on main, and that was wrong. Its commit did land, but 00131bb85 (27/11, "main keeps its own runtime, tools and tests") removed those lines again, so main does not have this change today. I tried to reopen it, but GitHub refuses: you are at this repository's open pull request limit. You can reopen it yourself once one of your PRs is merged or closed, or say here if you want a maintainer to carry it forward with your commits. Sorry for the noise. AI-assisted: yes (checked line by line against current main)
aslan2142 commented 2026-12-01 11:36:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:36:05Z.

Review: APPROVED


LGTM. Passing ignore_cleanup_errors=True to both tempfile.TemporaryDirectory calls in tests/test_build_runtime_cmake.py:38,96 cleanly prevents a temporarily locked recorder.exe on Windows from masking subtest results (confirmed not present on current main). Clean-room verified and MERGEABLE; holding merge until a fresh green CI pass completes on current main.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130427128 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1439#pullrequestreview-6130427128). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:36:05Z. **Review:** APPROVED --- LGTM. Passing `ignore_cleanup_errors=True` to both `tempfile.TemporaryDirectory` calls in `tests/test_build_runtime_cmake.py:38,96` cleanly prevents a temporarily locked `recorder.exe` on Windows from masking subtest results (confirmed not present on current `main`). Clean-room verified and `MERGEABLE`; holding merge until a fresh green CI pass completes on current `main`. *(AI-assisted review.)*
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!1439
No description provided.