bvh_rehydrate: restore write mode before unlink on replace failure and publish mode (BVH-REHYDRATE-STAGE-CLEANUP) #828

Closed
trigger337 wants to merge 1 commit from upstream-pr/828 into main
trigger337 commented 2026-11-24 14:18:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-24T14:18:30Z.


Apply published_mode to the staged binary file and reset os.chmod to 0o600 before unlinking if os.replace fails, ensuring unlinking does not fail with PermissionError on Windows if the destination was read-only.

agent: yes
AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5473897791 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/828). Originally posted by [trigger337](https://github.com/trigger337) on 2026-11-24T14:18:30Z. --- Apply published_mode to the staged binary file and reset os.chmod to 0o600 before unlinking if os.replace fails, ensuring unlinking does not fail with PermissionError on Windows if the destination was read-only. agent: yes AI-assisted: yes
abnalstlll-byte commented 2026-11-24 14:29:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:29:03Z.

Review: APPROVED


Clean-room verified (zero game data). Correct atomic staging cleanup on Windows read-only files (published_mode and chmod 0o600 on failure in _publish). Test passes (tests/test_bvh_rehydrate.py).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041062705 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/828#pullrequestreview-6041062705). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:29:03Z. **Review:** APPROVED --- Clean-room verified (zero game data). Correct atomic staging cleanup on Windows read-only files (published_mode and chmod 0o600 on failure in _publish). Test passes (tests/test_bvh_rehydrate.py).
aslan2142 commented 2026-11-24 19:50:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T19:50:43Z.


Thanks for picking up BVH-REHYDRATE-STAGE-CLEANUP, and for claiming it first.

  • We're going with #915 for this item. The _publish change in both PRs is the same, matching what bvh_index and navmesh_index already do on main.
  • The difference is the test. #915 checks the outcome: after a failed os.replace, no .bvh_rehydrate-* file is left and the previous output is still intact.
  • This PR's test only asserts that chmod(..., 0o600) was called, so it would still pass if the unlink were removed.
  • Closing this one in favour of #915. Your work on the item is appreciated, and further items are very welcome.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142669386 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/828#issuecomment-7142669386). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T19:50:43Z. --- Thanks for picking up BVH-REHYDRATE-STAGE-CLEANUP, and for claiming it first. - We're going with #915 for this item. The `_publish` change in both PRs is the same, matching what `bvh_index` and `navmesh_index` already do on main. - The difference is the test. #915 checks the outcome: after a failed `os.replace`, no `.bvh_rehydrate-*` file is left and the previous output is still intact. - This PR's test only asserts that `chmod(..., 0o600)` was called, so it would still pass if the `unlink` were removed. - Closing this one in favour of #915. Your work on the item is appreciated, and further items are very welcome. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!828
No description provided.