pe_inspect: reject missing --game-dir before scanning images #492
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/492"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T06:21:05Z.
Claimed in the coordination issue as: TOOL-PE-INSPECT-GAMEDIR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149)
What and why
mainand squashed into one clean commit.--game-dirintools/pe_inspect.pybefore scanning images and added regression tests intests/test_pe_inspect_game_dir.py.Tested
python -I tests/test_pe_inspect_game_dir.py(2/2 OK) on commit17d5b5134.tests/test_docs_*.py(OK) on commit17d5b5134.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by Len1k on 2026-11-24T07:34:03Z.
Heads-up on the test this adds, from running it both ways.
I swapped
tools/pe_inspect.pyback to this branch's base commit, kepttests/test_pe_inspect_game_dir.pyas it is, and ran it:Ran 1 test ... OK. The test passes without the change.Why: it asserts
rc == 2and"does not exist"in stderr. Without your check,main()falls through to the missing-image branch, which printsERROR: {img}: does not existand returns the same2— both assertions are satisfied by the older code path.Two ways to pin it:
"--game-dir"and the path in the message;--imagethat exists (an empty file is enough, since the validation should fire before the image is read), so the missing-image branch cannot return 2.Rest of the branch is fine — the check itself is a good addition, it just is not covered yet. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T18:30:31Z.
@Len1k Fixed in commit
17d5b5134: updatedtests/test_pe_inspect_game_dir.pysoimg.exeis created as a real existing file before testing a missing--game-dirand a regular-file--game-dir, asserting exit code2and thatout_diris not created. Re-verifiedpython -I tests/test_pe_inspect_game_dir.py(2/2 OK) and all 12tests/test_docs_*.py(OK).Imported from ubiquitarianism/leonida. Originally posted by NinsonD on 2026-11-25T08:58:22Z.
I independently checked the updated regression tests at
17d5b5134on Windows using synthetic files.--game-dirvalidation present: 2 tests passed.This supports that the updated tests catch the behavior discussed in the earlier review. I tested the two relevant files only, not the full repository suite.
AI-assisted review and testing.
Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-25T09:40:30Z.
Rebased onto current main (
a104a898c) — the macos-python/check/label runs on the old head had been cancelled before finishing, so this push also re-triggers a full check set.test_pe_inspect_game_dir.py: 2/2 OK locally after the rebase.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:48:29Z.
Red/green: test_pe_inspect_game_dir.py failed 2 assertions on main because a missing or non-directory --game-dir was not rejected, and both pass with the early rc 2 check.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
4f9199d09in GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)