world_census: restore write mode before temporary directory cleanup in _staged_json (WORLD-CENSUS-STAGE-CLEANUP) #836
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/836"
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:24:17Z.
When staging JSON output in _staged_json, if the destination had read-only permissions, the staged file received mode 0o444. If publishing fails or raises an exception, resetting os.chmod to 0o600 in finally ensures TemporaryDirectory cleanup does not fail with PermissionError on Windows.
agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:26:01Z.
Review: APPROVED
Clean-Room Peer Review for PR #836 (world_census: restore write mode before temporary directory cleanup in _staged_json)
Essential filesystem cleanup hardening for Windows:
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:28:01Z.
Review: APPROVED
Clean-room verified (zero game data). Correct atomic staging cleanup on Windows read-only files (chmod 0o600 in _staged_json finally block). Test passes (tests/test_world_census.py).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:46:27Z.
#836 | head
044d410cd3(merged cleanly with maina8465211fb) |python -I tests/test_world_census.py| red on main:FAILED (failures=1)(_staged_jsoncopiedmode & 0o777ontotmpbeforeyield tmpwithout restoring0o600infinally:beforeTemporaryDirectoryteardown when publishing failed) | green on PR+main:70 ran, OK| Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
tools/world_census.pyandtests/test_world_census.pyon Windows 11 NTFS, confirming_staged_json'stry: yield tmp finally: os.chmod(tmp, 0o600)restores write mode on unpublished staged files while catchingFileNotFoundError(except OSError: pass) once_publish_reportshas movedtmpinto place. 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-29T01:31:42Z.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main
53b77df14: red 1 failure (CensusSourceTest.test_staged_json_restores_write_mode_on_failure) / green 70 OK.044d410cd,python -I tests/test_world_census.pyfrom the repository root.git merge --no-ffof this PR, no conflict): 70 run, OK, 2 skips.test_cli_rejects_jobs_above_61_on_windows("the 61-worker limit is Windows-only"),test_report_held_open_preserves_both_files("Windows readers can deny replacement").Red = main + only the test files from this PR (
git checkout pr-836 -- tests/test_world_census.py); green = main + the merged PR. When green runs more tests than red, it is because the merge keeps tests main added since the PR branched.AI-assisted: Claude Code (Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:34:21Z.
Thanks for this PR. It has a red/green verification by OreoFR on macOS (READY): https://github.com/ProjectLeonida/mandy/pull/836#issuecomment-7248840896
The only thing missing for a merge is your claim in the coordination issue #2570 (see CONTRIBUTING.md). Once it is there, a maintainer can pick it up.
AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:59:20Z.
Merging. Head
044d410cdhas red/green verdicts from reviewers other than the author (above), merges cleanly withmain423ccd7a9, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-testsmesh,semantic-testsf16) are pre-existing. Merged by MoonEyes.AI-assisted (Claude Code).