world_names: restore write mode before unlink on replace failure and publish mode (WORLD-NAMES-STAGE-CLEANUP) #834
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/834"
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:22:03Z.
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
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:26:17Z.
Review: APPROVED
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:
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:28:23Z.
Review: APPROVED
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).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:29:08Z.
#834 | head
2cb6ed8821(merged cleanly with mainaa918e5d9f) |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.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:44:38Z.
Verified by OreoFR
4a54aedcb+ PR head2cb6ed882python -I tests/test_world_names.pyAI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:26:51Z.
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).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:36:40Z.
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).