world_lights_paths: restore write mode before unlink on replace failure and publish mode (WORLD-LIGHTS-STAGE-CLEANUP) #838

Merged
leonida/mandy
trigger337 merged 1 commit from fix/world-lights-stage-cleanup into main 2026-11-29 18:59:30 +00:00

Pull request successfully merged and closed

trigger337 commented 2026-11-24 14:25:15 +00:00

Apply published_mode to staged .partial file and reset os.chmod to 0o600 before os.remove on replace failure or write error, ensuring temporary file cleanup does not fail with PermissionError on Windows.

agent: yes
AI-assisted: yes

Apply published_mode to staged .partial file and reset os.chmod to 0o600 before os.remove on replace failure or write error, ensuring temporary file cleanup does not fail with PermissionError on Windows. agent: yes AI-assisted: yes
abnalstlll-byte approved these changes 2026-11-24 14:41:03 +00:00
abnalstlll-byte left a comment

Audited and verified. Applies published_mode(lights_out) to the staged output file prior to replacement and restores write permission

Audited and verified. Applies published_mode(lights_out) to the staged output file prior to replacement and restores write permission
zmasi commented 2026-11-28 21:29:11 +00:00

#838 | head 09bbad3cca6479f6f82d258d445825535bc1af47 (merged cleanly with main aa918e5d9f) | python -I tests/test_world_lights_paths.py + live Windows NTFS stat.S_IREAD read-only destination cleanup check | red on main: FAILED (failures=1) (summarize neither applied published_mode(lights_out) before os.replace(staged, lights_out) nor restored 0o600 write mode before os.remove(staged) on write or replace failure) | green on PR+main: 33 ran, OK (33/33 unit tests OK, plus clean PermissionError with 0 secondary unlink exceptions and 0 staged leftovers on Windows NTFS when replacing a read-only lights.jsonl) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited tools/world_lights_paths.py and tests/test_world_lights_paths.py on Windows 11 NTFS, confirming published_mode(lights_out) mode preservation before os.replace and os.chmod(staged, 0o600) before os.remove(staged) on both write and replace failure paths. Also verified tests/test_ci_registration.py, tests/test_text_write_line_endings.py, and scripts/check_no_game_data.py.

#838 | head 09bbad3cca6479f6f82d258d445825535bc1af47 (merged cleanly with main aa918e5d9f) | `python -I tests/test_world_lights_paths.py` + live Windows NTFS `stat.S_IREAD` read-only destination cleanup check | red on main: `FAILED (failures=1)` (`summarize` neither applied `published_mode(lights_out)` before `os.replace(staged, lights_out)` nor restored `0o600` write mode before `os.remove(staged)` on write or replace failure) | green on PR+main: `33 ran, OK` (`33/33` unit tests `OK`, plus clean `PermissionError` with `0` secondary unlink exceptions and `0` staged leftovers on Windows NTFS when replacing a read-only `lights.jsonl`) | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `tools/world_lights_paths.py` and `tests/test_world_lights_paths.py` on Windows 11 NTFS, confirming `published_mode(lights_out)` mode preservation before `os.replace` and `os.chmod(staged, 0o600)` before `os.remove(staged)` on both write and replace failure paths. Also verified `tests/test_ci_registration.py`, `tests/test_text_write_line_endings.py`, and `scripts/check_no_game_data.py`.
OreoFR commented 2026-11-29 01:31:41 +00:00

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red 1 failure (ScanTest.test_stage_cleanup_restores_write_mode_on_replace_failure) / green 33 OK.

  • PR head 09bbad3cc, python -I tests/test_world_lights_paths.py from the repository root.
  • Red (main + only this PR's test files): 32 run, 1 failure, 0 skips. AssertionError: False is not true, the write mode is not restored when the replace fails.
  • Green (main + git merge --no-ff of this PR, no conflict): 33 run, OK, 0 skips.
  • Skips: none.
  • Verdict: READY.

Red = main + only the test files from this PR (git checkout pr-838 -- tests/test_world_lights_paths.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).

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red 1 failure (`ScanTest.test_stage_cleanup_restores_write_mode_on_replace_failure`) / green 33 OK. - PR head 09bbad3cc, `python -I tests/test_world_lights_paths.py` from the repository root. - Red (main + only this PR's test files): 32 run, 1 failure, 0 skips. `AssertionError: False is not true`, the write mode is not restored when the replace fails. - Green (main + `git merge --no-ff` of this PR, no conflict): 33 run, OK, 0 skips. - Skips: none. - Verdict: READY. Red = main + only the test files from this PR (`git checkout pr-838 -- tests/test_world_lights_paths.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).
OreoFR commented 2026-11-29 08:34:19 +00:00

Thanks for this PR. It has a red/green verification by OreoFR on macOS (READY): https://github.com/ProjectLeonida/mandy/pull/838#issuecomment-7248840525

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

Thanks for this PR. It has a red/green verification by OreoFR on macOS (READY): https://github.com/ProjectLeonida/mandy/pull/838#issuecomment-7248840525 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
MoonEyes commented 2026-11-29 18:59:27 +00:00

Merging. Head 09bbad3cc has red/green verdicts from reviewers other than the author (above), merges cleanly with main 16801256a, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-tests mesh, semantic-tests f16) are pre-existing. Merged by MoonEyes.

AI-assisted (Claude Code).

Merging. Head `09bbad3cc` has red/green verdicts from reviewers other than the author (above), merges cleanly with `main` `16801256a`, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (`translator-tests` mesh, `semantic-tests` f16) are pre-existing. Merged by MoonEyes. AI-assisted (Claude Code).
Sign in to join this conversation.
No description provided.