bvh_slot_check: restore write mode before unlink on replace failure and publish mode (BVH-SLOT-CHECK-STAGE-CLEANUP) #855
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/855"
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 trigger337 on 2026-11-24T14:39:45Z.
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
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:42:06Z.
Review: APPROVED
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
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:43:06Z.
Review: APPROVED
Audited and verified. Correctly applies published_mode(path) prior to atomic file replacement in save_evidence() and restores write permission
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:18:38Z.
#855 | head
2bdc69c301(merged cleanly with mainaa918e5d9f) |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.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:45:02Z.
Verified by OreoFR
4a54aedcb+ PR head2bdc69c30python -I tests/test_bvh_slot_check.pyAI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:26:54Z.
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).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:36:46Z.
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).