Skip to content

bvh_gpu_smoke: stage --json so a write failure keeps the previous report - #9029

Open
Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/bvh-gpu-smoke-preserve-json
Open

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/bvh-gpu-smoke-preserve-json

Conversation

@Grimkeh

@Grimkeh Grimkeh commented Nov 23, 2026

Copy link
Copy Markdown

Summary

Claim: #8504 (comment)

Synthetic; no game files. AI-assisted (Cursor / Composer).

Test plan

  • python3 -I -m unittest discover -s tests -p test_bvh_gpu_smoke.py — 14 OK

Made with Cursor

Publish the smoke report through a temp file + replace so a mid-write OSError leaves any prior complete JSON intact.

Co-authored-by: Cursor <cursoragent@cursor.com>
@catminou4

Copy link
Copy Markdown

Tested on Apple M1 Max, macOS 27.2.1 arm64, Python 3.12.16: python -I tests/test_bvh_gpu_smoke.py → OK (demo pass, 0 changed heap words). No game files. AI-assisted (Devin).

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested 64c324d3 on Linux, CPython 3.14, CPU only, synthetic inputs, merged onto main 867d922f: pass

  • python -I tests/test_bvh_gpu_smoke.py: Ran 14 tests, OK. With only the non-test files reverted to main: FAILED (errors=1), so the new tests exercise the change.
  • compileall and scripts/check_no_game_data.py on the changed files: clean.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting.

@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 64c324d34 on Windows 11 (CPython 3.14.0, CPU only): pass.

What was verified:

  1. Preservation on write failure: Verified write_json_report() stages --json through a temp file (.bvh_gpu_smoke-*.tmp) and atomically replaces the destination via replace_retry. Tested that when replace_retry fails with PermissionDenied, the pre-existing JSON report is preserved intact.
  2. Permission probe on regular files: Confirmed regular files probe writability via os.close(os.open(destination, os.O_WRONLY)) without truncating the file, while non-regular targets write directly.
  3. Test suite: python -I -m unittest discover -s tests -p test_bvh_gpu_smoke.py passes all 14 tests (was 13 on main).
  4. Hygiene: compileall, check_no_game_data.py, and git diff --check all exit 0 with clean formatting.

Negative control:

Restoring tools/bvh_gpu_smoke.py from origin/main produced the expected failure in test_bvh_gpu_smoke.py:
AttributeError: <module 'bvh_gpu_smoke' ...> does not have the attribute 'replace_retry' (14 tests: 13 passed, 1 error), confirming the new test exercises the PR's changes.

Note (non-blocking):

Unlike #9036 (bvh_tri_probe), write_json_report() does not create missing parent directories if --json targets a non-existent subdirectory (NamedTemporaryFile with dir=parent raises FileNotFoundError). Since main's Path.write_text also did not create parents, this preserves existing behavior; adding if parent: os.makedirs(parent, exist_ok=True) could be considered for consistency with sibling probe tools.

No game files used. AI-assisted.

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