Skip to content

meshlet_page: a directory it cannot list is an error, not a silent skip - #4680

Closed
Atomic258 wants to merge 1 commit into
ItsNotRexed:mainfrom
Atomic258:meshlet-page-walk-error
Closed

Atomic258 wants to merge 1 commit into
ItsNotRexed:mainfrom
Atomic258:meshlet-page-walk-error

Conversation

@Atomic258

Copy link
Copy Markdown
Contributor

Sibling of #4678 — the same os.walk silent-skip hole @GrahamboJangles reported for save_keys.py also exists in tools/meshlet_page.py iter_inputs() (line ~703; #3224's hard-failure fix covered a different path). An unreadable input directory contributed zero pages and zero errors.

Two changes:

  • iter_inputs() passes os.walk an onerror that re-raises, so the OSError names the directory.
  • The pages = [...] consumption sat outside any try/except OSError, so the raised error would have arrived as a traceback. It's now wrapped and reported as error: <exc> with exit 2 — the convention the rest of main() already uses (--json writes, the draw-binding opens).

Regression test in tests/test_meshlet_page.py (CliTests): patches os.scandir to raise PermissionError for one directory — a portable "unreadable dir" (chmod can't express no-list on Windows) — and asserts main() returns 2 with one error: line and no traceback.

Verified on Windows: python -I tests/test_meshlet_page.py — 60/60 pass. Control: with tools/meshlet_page.py reverted to main the new test fails (silent skip, exit 0, no error). git diff --check clean; scripts/check_no_game_data.py clean. No game files.

AI-assisted (Devin).

Same hole as the save_keys fix: os.walk without onerror swallows
scandir failures, so an unreadable input directory contributed no
pages and no error. Give the walk a callback that re-raises and catch
the OSError around the iter_inputs consumption, which was outside any
error handling (a raised error would have arrived as a traceback):
one error line naming it, exit 2, matching the file's convention.

AI-assisted (Devin).
@SweatierKey

Copy link
Copy Markdown
Contributor

Tested bd2e2d36 on Linux (x86_64, Python 3.13.5): pass (code read + unit tests).

What I ran:

  • git diff --check main...HEAD: clean.
  • python3 -m unittest -v tests/test_meshlet_page.py: 60/60 OK (including the new test_an_unreadable_input_directory_is_an_error_not_a_silent_skip verifying exit code 2, error: prefix, path name, and no traceback).

Code review:

  • Passing onerror=abort to os.walk in iter_inputs() and catching OSError in main() cleanly converts unlistable directories and unreadable files into a single stderr error: ... line with exit code 2 instead of silently skipping directories or dumping a traceback.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at bd2e2d36b on Windows 11: pytest tests/test_meshlet_page.py -q -> 60 passed, 7 subtests passed; git diff --check clean.

meshlet_page treats a directory it cannot list as an error (with the path and reason) rather than silently contributing no pages; the os.walk/scandir error path is covered by the added tests. No blocking issue.

@Atomic258

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate — @SebSilent's #4455 covered this first and converged into @tedin7's #4433 (BUILD-1374), the superset that fixes the meshlet_page unlistable-subfolder walk alongside make_game/world_build. My PR is redundant; theirs wins.

@Atomic258 Atomic258 closed this Nov 23, 2026
@memorypressure

Copy link
Copy Markdown

Verified against current main: the silent-skip hole is closed the same way the save_keys fix did it (onerror re-raise, single error line, exit 2, no traceback), and the walk-consumption site that sat outside the error handling is now covered. tests/test_meshlet_page.py passes 60 under python -I, test_save_keys is unaffected, compileall clean. Small overlap note: #4211 edits meshlet_page.py in a different region. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@Atomic258

Copy link
Copy Markdown
Contributor Author

Tested bd2e2d3 on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_meshlet_page.py -> OK (Ran 60)
  • Negative control (tools/meshlet_page.py swapped to upstream/main): FAILED (failures=1)

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants