Repository navigation
vertex_types: fail on an unlistable sub-folder instead of silently skipping its archives - #4417
Conversation
…ipping its archives
Kam471
left a comment
There was a problem hiding this comment.
Ran this at b153c1db on Windows 11: python -I tests/test_vertex_types.py -> 34 tests, OK (1 skipped); git diff --check clean.
An unlistable sub-folder now fails the vertex-type scan instead of silently skipping its archives, matching the other walk fixes. No blocking issue.
Flyander
left a comment
There was a problem hiding this comment.
The RPF directory walk now turns an unlistable subfolder into a single scan error and exit 2 instead of an empty success. The test checks the permission-denied path and skips only where the platform/user can still list the directory.
|
Tested
AI-assisted. No game data committed. |
|
Tested Ran |
|
The fix is right, but its regression test never runs in CI. Verified by denying a sub-folder on Windows: the base exits 0 and writes an empty report, while the PR exits 2 with exactly one The gap: AI-assisted review, no game files, no GPU. |
…ck a folder The regression test for the unlistable sub-folder self-skips on Windows and as root, and CI runs this file only on windows-latest, so the guard was never exercised in CI. Force os.scandir to raise for one folder instead, in-process, which reproduces the same PermissionError on every platform. AI-assisted.
|
Fixed the dead test. There is now a portable regression that forces the same PermissionError through os.scandir, so the guard is exercised on the windows-latest job and under root; the chmod test remains as the real-filesystem check where it applies. Rebased and pushed: head 7f0bd27, 35 tests OK in the file, compileall and diff --check clean. |
|
Tested 7f0bd27 merged with main d0835dd on WSL2 Ubuntu (Python 3.12.16) and native Windows 11 (Python 3.13.1): pass.
|
|
Fixed in 7f0bd27. Added a second test that forces os.scandir to raise PermissionError for one sub-folder via mock.patch, so the guard is exercised on Windows and as root too, no chmod needed. The chmod test stays as the real-filesystem check where it can run. 35 tests OK, the portable one runs everywhere. |
Claimed in the coordination issue as: #4257 (comment)
What and why
vertex_types.py maincollects.rpfarchives from a directory withos.walk(p)and noonerror.os.walk silently skips a sub-folder it cannot list, so the scan reported an empty (or partial) directory and
exited 0, hiding an incomplete scan. Reproduced on 03b09a0: with the only
.rpfin a sub-folder, the toolerrors on that archive while the folder is listable; after
chmod 000on the sub-folder it scans 0 archives,prints an empty summary and exits 0. The walk now passes an
onerrorthat re-raises, and the archivecollection catches it as one
error: <folder>: ...line + exit 2 (the tool's existing scan-error style). Sameos.walk/onerror completeness gap as #4277 / #4342 / #4355 / #4372 / #4385 / #4404.
Tested
Linux, Python 3.14.10, CPU only, no game files (synthetic RPF9 headers).
tests/test_vertex_types.py::Rpf9ValidationTests::test_unlistable_subfolder_is_a_clean_error_not_a_silent_skip:chmod 000a sub-folder holding the only.rpf, the tool exits 2 with anerror:line and no traceback(skips when the folder is still listable, e.g. running as root or on Windows). Red on the base: exit 0.
test_directory_scan_uses_stable_archive_orderos.walk mock to accept the newonerrorkeyword.python -m compileall -q make_game.py tools tests,git diff --checkclean.Checklist
docs/design.md, with how it was confirmed. (no translator rule changed)AI-assisted (Tacit).