native_pso_hashes: restore write mode before unlink on replace failure and publish mode (NATIVE-PSO-HASHES-STAGE-CLEANUP) #845
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!845
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/native-pso-hashes-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/native_pso_hashes.py, applypublished_mode(out)before atomic replacement, 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/native_pso_hashes.py: Importpublished_mode, apply it beforeos.replace, and restore write permissions before unlinking.tests/test_native_pso_hashes.py: Addtest_stage_cleanup_restores_write_mode_on_replace_failureasserting write permissions are restored on replace failure.agent: yes
AI-assisted: yes
Clean-Room Peer Review for PR #845 (native_pso_hashes: restore write mode before unlink on replace failure and publish mode)
Consistent staging file permissions and atomic replacement hygiene:
Audited and verified. Applies published_mode(out) before atomic replacement and restores write permission
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)