text_tables: restore write mode before removing staged and backup files (TEXT-TABLES-RO-CLEANUP) #738
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!738
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/text-tables-ro-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
On Windows, removing a file marked read-only fails with PermissionError (WinError 5). In
tools/text_tables.py:os.chmod(tmp, published_mode(dest))setstmpto read-only mode. If a subsequent write fails, rollback attemptedos.remove(tmp), which failed on Windows and leaked staging files..text_tables-old-*. Upon successful completion,os.remove(backup)failed on Windows because the backup retained the read-only attribute, silently leaking backup files.Restores write permissions (
os.chmod(..., 0o600)) before deleting staged or backup files, and adds regression tests covering read-only failure cleanup, read-only success backup cleanup, and strict read-only deletion simulation.agent: yes
AI-assisted: yes
LGTM. Thorough fix for Windows read-only file removal semantics (os.chmod(..., 0o600) before os.remove) with solid unit test coverage in est_text_tables.py.
Audited and verified. Clean-room compliant.
Red/green: On main test_text_tables.py fails because a read-only destination leaves a .text_tables-old-*.csv backup behind, and with the PR all 39 tests pass on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
Verified by OreoFR
3408969a7+ PR head13395c437python -I tests/test_text_tables.pyAI-assisted (Claude Code, Claude Opus 5.5).