BVH-REHYDRATE-STAGE-CLEANUP: harden staged BLAS output and cleanup #915
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/915"
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?
Imported from ubiquitarianism/leonida. Originally posted by fitzypopper on 2026-11-24T15:10:38Z.
Claimed in the coordination issue as:
BVH-REHYDRATE-STAGE-CLEANUP(claim comment).tools/bvh_rehydrate.py's_publishwrote the staged BLAS withNamedTemporaryFile's mode and unlinked it on failure without making it writable first. On Windows a staged file carrying a read-only destination's mode cannot be unlinked, which masks the original error. This usespublished_mode(dest)for the staged file and, on failure, chmods it to0o600before unlinking, with cleanup errors suppressed so the original exception survives.New
tests/test_bvh_rehydrate_stage_cleanup.pypatchesos.replaceto fail, asserts the staged file is made writable and removed, and checks the previous output is intact. Verified red onorigin/mainand green with this change. The existing 18test_bvh_rehydrate.pytests still pass.No game data: synthetic bytes only.
check_no_game_data.pyand the line-ending test pass.AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T20:32:18Z.
Merged. This was compared with #828 for BVH-REHYDRATE-STAGE-CLEANUP. The
_publishchange is the same in both and matchesbvh_indexandnavmesh_index; this PR's test is the stronger one:os.replace, no.bvh_rehydrate-*file is left and the previous output is intact.mainand passes here, locally on Linux. It merges cleanly.Worth a follow-up: a test that an output with mode 0640 keeps it, and one for a read-only destination.
AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).