Repository navigation
Conversation
…LD-880) A file where the --out or --csv folder (or a folder above it) has to be was only found after the scan: _make_parent raised FileExistsError or NotADirectoryError, the run ended in a traceback with exit 1, and the scan was lost. main() now checks it with the other path checks, before the scan, and exits 2 with one line. A report write that still fails (no permission, a full disk, the folder replaced meanwhile) exits 2 with one line instead of a traceback; the summary is already printed by then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
CPU-only synthetic fixtures. No game files. |
Claimed in the coordination issue as BUILD-880, second half only: #3047 (comment)
The first half of BUILD-880 (
tools/world_lights_paths.pytruncating the previous report before--entitiesis read) is already handled by #2748, so it isn't in this PR.What and why
bvh_index.pyonly found a file blocking the--out/--csvfolder after the scan. Before this change, onmain16282101:The whole scan is lost at that point. On
levels.rpfthat is the long part of the run.Changes in
tools/bvh_index.py:_file_in_the_way(path): walks up from the report's folder to the nearest path that exists and returns it if it is a file.main()runs this check next to the existing--out/--csvpath checks, before the scan, and exits 2 throughap.error:<file> is not a folder, so --out <path> cannot be written. Missing folders are still created, astest_missing_report_folder_is_createdexpects.write_outputsis wrapped inexcept OSError. A write that still fails (no permission, a full disk, the folder replaced after the check) printsbvh_index: error: cannot write the report: <error>and exits 2, the same code as an unreadable archive, instead of a traceback with exit 1. The summary is already on stdout by then.Output bytes don't change for any run that succeeds.
Overlaps
#2684 (staged
_publishwrites) also edits this file. I placed the new helper abovemain(), next tosame_output_path, so the two PRs don't touch the same lines. I applied #2684's diff on top of this branch withgit apply --3way: it applied cleanly and all 34 combinedtest_bvh_index.pytests pass. With both merged, a failed write leaves the old report intact (#2684) and ends in one line with exit 2 (this PR). #2468, #2348 and #2726 also apply cleanly on top.Tests
New tests in
tests/test_bvh_index.py, all synthetic (no game files):test_report_folder_that_is_a_file_is_rejected_before_the_scan:--out file/x.json,--out file/deep/x.jsonand--csv file/x.csveach exit 2 with the message.scan_diris mocked to fail if it gets called, and the blocking file is left unchanged.test_report_write_error_exits_2_without_a_traceback: with the preflight bypassed, the real write fails,main()returns 2 with one line and no traceback, and the summary is still printed.test_new_report_folders_under_a_folder_are_still_allowed.Without the fix in
tools/bvh_index.py, the new tests fail: 3 failures and 2 errors.Ran (Linux, CPU only, no GPU needed):
python -I tests/test_bvh_index.py: 29 OK on Python 3.12.13 and 3.14.4.python -m compileall -q make_game.py tools tests: OK.python -Ion each oftest_text_write_line_endings,test_tool_startup,test_tool_stdout_encoding,test_resource_hygiene,test_report_paths,test_report_path_caseandtest_navmesh_index: all OK.Not tested on Windows. The check uses only
os.path(exists,isdir,dirname,abspath), and Windows also reports a path under a file as non-existent.AI-assisted (Claude Code).
🤖 Generated with Claude Code