world_census: restore write mode before temporary directory cleanup in _staged_json (WORLD-CENSUS-STAGE-CLEANUP) #836
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!836
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/world-census-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 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
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:
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).
#836 | head 044d410cd3259fe2d2e43d5f7d87abf9ff84f14d (merged cleanly with main a8465211fb) |
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.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.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).
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
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).