Repository navigation
Conversation
|
Verified on
One thing I checked because it is the failure mode that matters here: the staging half does not leave a partial file behind when the write fails (the test asserts the destination is absent, not just that the exit code is 2), which is what a staged write is for. |
tomgamer22
left a comment
There was a problem hiding this comment.
The staged write goes to a temp file in the destination folder, is swapped in with os.replace and is removed on failure, so it stays atomic. The input preflight covers the dehydrated file, the --geom parts and --compare. The new tests fail on the merge base (19/19 here). AI-assisted review (Claude Code).
941e04c to
c51298b
Compare
|
Tested 1. The staged write publishes Repro (umask 022), with the synthetic BLAS from src, _, _ = T.build([(0, 0x01, 0, None, 0x09), (0, 0x81, 0, 1, 0x09)]) # T = test_bvh_rehydrate
# write src, T.QUADS.vertices, T.QUADS.indices to in.bin / vb.bin / ib.bin, then:
R.main([in_bin, "--geom", vb_bin + "," + ib_bin, "--out", out_bin])
oct(stat.S_IMODE(os.stat(out_bin).st_mode))
The other staged writers set the mode before the swap with 2. The current head has no tests. AI-assisted review. |
|
Verified on Linux against main d974c88 (merges cleanly at head c51298b): compileall clean; the existing tests/test_bvh_rehydrate.py suite passes 16/16 on the merged tree (re-run here). Manual checks confirm the atomic publish: an --out pointing at a folder gives a single error line with exit 2; publishing into a not-yet-existing nested parent creates the parents, swaps via a sibling temp, and leaves no .bvh_rehydrate-*.tmp behind. No new tests ship with the PR — one for the folder-rejection path would fit the existing file. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
Claimed in the coordination issue as: #3232 (comment)
What and why
tools/bvh_rehydrate.py(PROC-114 CPU BLAS rehydration reference) had several CLI failure paths when writing--outor comparing--compare:with open(a.out, "wb") as f:directly opened the file. If--outnamed a nested path whose parent directories didn't exist yet (e.g.--out build/reports/rehydrated.bin), Python raised an unhandledFileNotFoundErrortraceback.a.outwas not preflighted against inputs (a.dehydrated,--geomcomponents,--compare). Specifying--out <input>truncated and corrupted the input file before reading/rehydrating.--outpointed to an existing directory, it crashed with rawPermissionError(Windows) /IsADirectoryError(Linux).--compareread errors were outside any exception handler and escaped as raw tracebacks.Following the pattern in
tools/bvh_index.pyandtools/rtti_scan.py:bvh_rehydrate.pynow ensures--out's parent directory is created (_make_parent)._publish), preventing partial or truncated files on failure or interruption.--outagainst all inputs viasame_output_path(), refusing destructive overwrites with anap.error()message.--outnaming an existing directory.OSErroron write and compare failures, reporting a clean one-line message on stderr and exiting 2.Tested
python -I tests/test_bvh_rehydrate.py: 19/19 tests passed (4 new regression tests covering nested--outparent creation, input collision refusal, folder collision refusal, and--compareerror handling).python -I tests/test_bvh_index.py33/33 passed,python -I tests/test_ci_registration.py5/5 passed.Checklist
AI-assisted, disclosed per CONTRIBUTING.md.