bvh_slot_check: restore write mode before unlink on replace failure and publish mode (BVH-SLOT-CHECK-STAGE-CLEANUP) #855
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!855
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bvh-slot-check-stage-cleanup"
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?
Pull request successfully merged and closed
Overview
In
tools/bvh_slot_check.py, applypublished_mode(path)insave_evidencebeforeos.replace, and ensure write mode (0o600) is restored before unlinking in the finally block if replacement fails.On Windows, unlinking a read-only staged file or cleaning up on
os.replacefailure causes aPermissionError[WinError 5], leaving stranded temporary files behind and masking underlying exceptions.Changes
tools/bvh_slot_check.py: Importpublished_mode, apply it totemporarybeforeos.replace, and restore write mode beforetemporary.unlinkinfinally:.tests/test_bvh_slot_check.py: Addtest_save_evidence_cleanup_restores_write_mode_on_replace_failureasserting write mode restoration on replace failure.agent: yes
AI-assisted: yes
Clean-Room Audit & Test Review — PR #855 (
BVH-SLOT-CHECK-STAGE-CLEANUP)Consistent, solid Windows filesystem hygiene fix.
Technical Verification
save_evidenceintools/bvh_slot_check.pynow setspublished_mode(path)before replacement, and restores0o600write permissions in thefinallyblock before callingunlink(missing_ok=True).AccessDenied/PermissionErroron Windows when removing read-only temporary staging artifacts.test_save_evidence_cleanup_restores_write_mode_on_replace_failureintests/test_bvh_slot_check.pyusingunittest.mock.Verdict: APPROVED
Audited and verified. Correctly applies published_mode(path) prior to atomic file replacement in save_evidence() and restores write permission
#855 | head 2bdc69c3019a508234abf73131db283331de75b4 (merged cleanly with main aa918e5d9f) |
python -I tests/test_bvh_slot_check.py+ live Windows NTFSstat.S_IREADread-only destination cleanup check | red on main:FAILED (failures=1)(save_evidenceneither appliedpublished_mode(path)nor restored0o600write bits beforetemporary.unlink(missing_ok=True)onos.replacefailure) | green on PR+main:10 ran, OK(10/10unit testsOK, plus cleanPermissionErrorwith0secondary unlink exceptions and0leftover temp files on Windows NTFS when replacing a read-onlyevidence.json) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
tools/bvh_slot_check.pyandtests/test_bvh_slot_check.pyon Windows 11 NTFS, confirmingos.chmod(temporary, published_mode(path))beforeos.replaceandos.chmod(temporary, 0o600)infinally:sotemporary.unlink(missing_ok=True)succeeds cleanly even whenpublished_mode(path)setsFILE_ATTRIBUTE_READONLYandos.replacefails. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Verified by OreoFR
4a54aedcb+ PR head2bdc69c30python -I tests/test_bvh_slot_check.pyAI-assisted (Claude Code, Claude Opus 5.5).
Tested
2bdc69c30merged (no commit) withmain4755667f5: Python 3.12, Windows 11 10.0.26300, CPU only. Ran the PR's tests plus every test file that imports the changed tool.python -I tests/test_bvh_slot_check.pygives 10 OK.tools/bvh_slot_check.pyback tomain:FAILED (failures=1).8db8335d2).AI-assisted (Claude Code).
Merging. Red/green verified on
2bdc69c30against currentmainby an agent other than the author (verdicts above), no conflict withmain, does not force a rebase of #2566, claim ID present. Main CI reds are pre-existing (translator-testsmesh,semantic-testsf16), not from this change. Merged by MoonEyes.AI-assisted (Claude Code).