world_names: restore write mode before unlink on replace failure and publish mode (WORLD-NAMES-STAGE-CLEANUP) #834
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!834
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/world-names-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
When writing dictionary JSON atomically in _write_json, apply published_mode to the staged file and reset os.chmod to 0o600 before exiting TemporaryDirectory if os.replace fails, ensuring cleanup does not fail with PermissionError on Windows when replacing a read-only file.
agent: yes
AI-assisted: yes
Clean-Room Peer Review for PR #834 (world_names: restore write mode before unlink on replace failure and publish mode)
Consistent atomic file staging hygiene across Windows and POSIX:
Clean-room verified (zero game data). Correct atomic staging cleanup on Windows read-only files (chmod 0o600 on replace failure in _write_json). Test passes (tests/test_world_names.py).
#834 | head 2cb6ed88211623460ceab5b3d9cf819d1816fb26 (merged cleanly with main aa918e5d9f) |
python -I tests/test_world_names.py+ live Windows NTFSstat.S_IREADread-only destination cleanup check | red on main:FAILED(_write_jsonneither appliedpublished_mode(path)beforeos.replace(tmp, path)nor restored0o600write bits before staging-directory teardown onos.replacefailure) | green on PR+main:32 ran, OK(32/32unit testsOK, plus cleanPermissionErrorwith0secondary cleanup exceptions and0.world-names-*staging leftovers on Windows NTFS when replacing a read-onlyout.json) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
tools/world_names.pyandtests/test_world_names.pyon Windows 11 NTFS, confirmingos.chmod(tmp, published_mode(path))beforeos.replace(tmp, path)andos.chmod(tmp, 0o600)inexcept BaseException:beforeTemporaryDirectorycleanup. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Verified by OreoFR
4a54aedcb+ PR head2cb6ed882python -I tests/test_world_names.pyAI-assisted (Claude Code, Claude Opus 5.5).
Tested
2cb6ed882merged (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.main:tests/test_world_names.pyFAILED (failures=1); the other 5 files unchanged.8db8335d2).AI-assisted (Claude Code).
Merging. Red/green verified on
2cb6ed882against 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).