xcl_compare: open transcript before Popen, format float timeouts, validate paths upfront, write JSON atomically (XCL-COMPARE-GUARDS-AND-ATOMIC-IO) #1591

Open
github-bot wants to merge 1 commit from github-bot/gh-1591 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-25 05:25 UTC · original
IlyassRS3:fix/xcl-compare-guards-and-atomic-io → main · +202 −25 · 2 files · 1 commits · open

Item: XCL-COMPARE-GUARDS-AND-ATOMIC-IO (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch tools/xcl_compare.py).

Summary

  • Open transcript before spawning subprocess.Popen in run_title() and clean up any still-running child process on unexpected exceptions, preventing leaked child processes when opening the transcript fails.
  • Catch OSError (including ProcessLookupError) in kill_tree() when a hung process exits just before termination, and fall back to proc.kill() if taskkill fails on Windows.
  • Format hang reasons with %g s instead of %d s in _follow() so sub-second --timeout values (e.g. 0.5) report "no output for 0.5 s" rather than truncating to "no output for 0 s".
  • Validate empty/whitespace --xcl/--gta6rt/--work/--cdb/--out and directory/trailing-separator --out upfront before running either runtime, write report.json atomically via file_mode.published_mode + replace_retry.replace with allow_nan=False, accept optional argv=None in main(), and guard sys.stdout.reconfigure.

Verification

  • python3 -W error -I tests/test_xcl_compare.py -v: 20/20 passed.
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/xcl_compare.py tests/test_xcl_compare.py: passed.
  • python3 -m compileall -q tools/xcl_compare.py tests/test_xcl_compare.py: passed.
  • Mutation check (running tests/test_xcl_compare.py against unpatched main:tools/xcl_compare.py): failures=8, errors=1 across all 5 new regression tests.

AI-assisted: yes
GPUs tested: none (CPU-only Python test harness; synthetic Python stand-ins only, no game data)

**@⁠IlyassRS3** on GitHub · 2026-11-25 05:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1591) `IlyassRS3:fix/xcl-compare-guards-and-atomic-io` → `main` · +202 −25 · 2 files · 1 commits · open Item: `XCL-COMPARE-GUARDS-AND-ATOMIC-IO` (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch `tools/xcl_compare.py`). ### Summary - Open `transcript` before spawning `subprocess.Popen` in `run_title()` and clean up any still-running child process on unexpected exceptions, preventing leaked child processes when opening the transcript fails. - Catch `OSError` (including `ProcessLookupError`) in `kill_tree()` when a hung process exits just before termination, and fall back to `proc.kill()` if `taskkill` fails on Windows. - Format hang reasons with `%g s` instead of `%d s` in `_follow()` so sub-second `--timeout` values (e.g. `0.5`) report `"no output for 0.5 s"` rather than truncating to `"no output for 0 s"`. - Validate empty/whitespace `--xcl`/`--gta6rt`/`--work`/`--cdb`/`--out` and directory/trailing-separator `--out` upfront before running either runtime, write `report.json` atomically via `file_mode.published_mode` + `replace_retry.replace` with `allow_nan=False`, accept optional `argv=None` in `main()`, and guard `sys.stdout.reconfigure`. ### Verification - `python3 -W error -I tests/test_xcl_compare.py -v`: 20/20 passed. - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/xcl_compare.py tests/test_xcl_compare.py`: passed. - `python3 -m compileall -q tools/xcl_compare.py tests/test_xcl_compare.py`: passed. - Mutation check (running `tests/test_xcl_compare.py` against unpatched `main:tools/xcl_compare.py`): `failures=8, errors=1` across all 5 new regression tests. AI-assisted: yes GPUs tested: none (CPU-only Python test harness; synthetic Python stand-ins only, no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:27 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 05:25 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 05:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1591#pullrequestreview-6052276801) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1591/head:github-bot/gh-1591'
git switch 'github-bot/gh-1591'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1591'
git switch 'github-bot/gh-1591'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1591'
git switch 'github-bot/gh-1591'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1591'
git switch 'main'
git merge --squash 'github-bot/gh-1591'
git switch 'main'
git merge --ff-only 'github-bot/gh-1591'
git switch 'main'
git merge 'github-bot/gh-1591'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.