bvh_gpu_smoke: clean temporary work dirs, guard inputs, and publish --json atomically (BVH-GPU-SMOKE-WORK-CLEANUP-AND-JSON-SAFETY) #1765
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1765
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bvh-gpu-smoke-work-cleanup-and-json-safety"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: BVH-GPU-SMOKE-WORK-CLEANUP-AND-JSON-SAFETY https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161287514
What and why
Hardens
tools/bvh_gpu_smoke.py:--game-dirtranslation work folder: Allocate auto-createdbvh_gpu_work_*folders viacontextlib.ExitStack+tempfile.TemporaryDirectoryso extracted/disassembled shaders fromXboxBvhBuilder.dllare always removed when the run finishes or aborts (leaving explicit--workintact).--max-shared-memory> 0: Reject zero or negative values upfront alongside--timeout/--heap-bytes.--jsonagainst directories and input paths upfront: Refuse a directory path or a path aliasing--game-dir,XboxBvhBuilder.dll,--spirv, or any*.spvinput viasame_report_pathbefore translating or invokingvk_compute_test.Path(a.json).write_text(...)(which crashed with an unhandledPermissionErrortraceback or risked partial writes) with_write_json_atomic(staging in destination directory,published_mode,replace_retry, and restoring0o600before unlinking on failure), returning exit code2cleanly onOSError.Adds 4 unit tests in
tests/test_bvh_gpu_smoke.py(Cli).Tested
Windows 11 x64 (
10.0.26100), Python3.14.7, CPU only with mockedvk_compute_test/ translation (no game files). Commit7122cf6d451382be00c5a78e55c1578a4ebdc140.python -I tests/test_bvh_gpu_smoke.py -v:main(bcaa13da) with all 17 tests: 4 failures, 1 error (leaked temp work dir, unvalidated--max-shared-memory/--jsoninputs, unhandledPermissionErroron read-only--json);python -I tests/test_ci_registration.py: 16 tests, OK.python -I tests/test_text_write_line_endings.py: 3 tests, OK.python -I scripts/check_no_game_data.py tools/bvh_gpu_smoke.py tests/test_bvh_gpu_smoke.py,python -m compileall -q tools tests,git diff --check: exit0.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. (n/a: no translator change)Reviewed 7122cf6: bvh_gpu_smoke now cleans its temporary work dir on success and on error, rejects
--max-shared-memory <= 0, refuses a--jsonthat names a directory or an input (game dir, DLL, --spirv or a .spv inside it), and publishes the report through a staging file with mode preservation and cleanup on failure (missing parent folders created; a write failure gives rc 2 with the previous report intact). Ran the test file: 17/17 OK on the PR, 13/13 on main, and with the PR's test file copied onto main exactly the four new tests fail, so they pin the fix. A mock-driven probe on both trees confirms each differential: main leaks bvh_gpu_work_ in $TMPDIR, overwrites an input .spv with the report while exiting 0, dies with IsADirectoryError/PermissionError/FileNotFoundError tracebacks on a directory, read-only report or missing folder, and forwards --max-shared-memory 0 to the translator - all fixed on the PR, which also keeps the old mode bits on replace and leaves no staging leftovers. Windows-only paths were not run. No finding. One suggestion: also guard--build/vk_compute_test (a --json naming it still clobbers the binary, as on main).AI-assisted review.
Recommendation: Merge
Red/green: classified READY by cloud-4 (red on main 09c153948, green on head merged with main); head 7122cf6d4513 unchanged since 2026-11-25, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)