[PR #915] [MERGED] BVH-REHYDRATE-STAGE-CLEANUP: harden staged BLAS output and cleanup #953

Closed
opened 2026-11-26 20:19:36 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/915
Author: @fitzypopper
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142

Base: main ← Head: bvh-rehydrate-stage-cleanup


📝 Commits (1)

  • 687f51b bvh_rehydrate: harden staged output cleanup (BVH-REHYDRATE-STAGE-CLEANUP)

📊 Changes

2 files changed (+47 additions, -0 deletions)

View changed files

➕ tests/test_bvh_rehydrate_stage_cleanup.py (+40 -0)
📝 tools/bvh_rehydrate.py (+7 -0)

📄 Description

Claimed in the coordination issue as: BVH-REHYDRATE-STAGE-CLEANUP (claim comment).

tools/bvh_rehydrate.py's _publish wrote the staged BLAS with NamedTemporaryFile'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 uses published_mode(dest) for the staged file and, on failure, chmods it to 0o600 before unlinking, with cleanup errors suppressed so the original exception survives.

New tests/test_bvh_rehydrate_stage_cleanup.py patches os.replace to fail, asserts the staged file is made writable and removed, and checks the previous output is intact. Verified red on origin/main and green with this change. The existing 18 test_bvh_rehydrate.py tests still pass.

No game data: synthetic bytes only. check_no_game_data.py and the line-ending test pass.

AI-assisted: yes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/915 **Author:** [@fitzypopper](https://github.com/fitzypopper) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `bvh-rehydrate-stage-cleanup` --- ### 📝 Commits (1) - [`687f51b`](https://github.com/ubiquitarianism/leonida/commit/687f51beca31af891b0d245c3a325c74d48b8a98) bvh_rehydrate: harden staged output cleanup (BVH-REHYDRATE-STAGE-CLEANUP) ### 📊 Changes **2 files changed** (+47 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_bvh_rehydrate_stage_cleanup.py` (+40 -0) 📝 `tools/bvh_rehydrate.py` (+7 -0) </details> ### 📄 Description Claimed in the coordination issue as: `BVH-REHYDRATE-STAGE-CLEANUP` ([claim comment](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135569993)). `tools/bvh_rehydrate.py`'s `_publish` wrote the staged BLAS with `NamedTemporaryFile`'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 uses `published_mode(dest)` for the staged file and, on failure, chmods it to `0o600` before unlinking, with cleanup errors suppressed so the original exception survives. New `tests/test_bvh_rehydrate_stage_cleanup.py` patches `os.replace` to fail, asserts the staged file is made writable and removed, and checks the previous output is intact. Verified red on `origin/main` and green with this change. The existing 18 `test_bvh_rehydrate.py` tests still pass. No game data: synthetic bytes only. `check_no_game_data.py` and the line-ending test pass. AI-assisted: yes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:36 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#953
No description provided.