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

Merged
trigger337 merged 1 commit from upstream-pr/838 into main 2026-11-29 18:59:30 +00:00
trigger337 commented 2026-11-24 14:25:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-24T14:25:15Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474019336 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/838). Originally posted by [trigger337](https://github.com/trigger337) on 2026-11-24T14:25:15Z. --- 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 commented 2026-11-24 14:41:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:41:03Z.

Review: APPROVED


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

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041307057 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/838#pullrequestreview-6041307057). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:41:03Z. **Review:** APPROVED --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:29:11Z.


#838 | head 09bbad3cca (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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246052558 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/838#issuecomment-7246052558). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T21:29:11Z. --- #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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:31:41Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248840525 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/838#issuecomment-7248840525). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T01:31:41Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:34:19Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7253190886 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/838#issuecomment-7253190886). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T08:34:19Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T18:59:27Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260917839 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/838#issuecomment-7260917839). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T18:59:27Z. --- 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 reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!838
No description provided.