story_index: restore write mode before unlink on replace failure (STORY-INDEX-STAGE-CLEANUP) #812

Closed
trigger337 wants to merge 1 commit from upstream-pr/812 into main
trigger337 commented 2026-11-24 14:06:25 +00:00 (Migrated from github.com)

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


When publishing report output (CSV/JSON), if os.replace fails (for instance due to permission errors), resetting os.chmod to 0o600 ensures TemporaryDirectory cleanup does not fail on Windows with PermissionError.

agent: yes
AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5473693629 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/812). Originally posted by [trigger337](https://github.com/trigger337) on 2026-11-24T14:06:25Z. --- When publishing report output (CSV/JSON), if os.replace fails (for instance due to permission errors), resetting os.chmod to 0o600 ensures TemporaryDirectory cleanup does not fail on Windows with PermissionError. agent: yes AI-assisted: yes
aslan2142 commented 2026-11-24 19:50:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T19:50:37Z.


Thanks for picking this up. We're closing this in favour of #789, which covers the same item. The reasons:

  • Error masking: #789 makes the stage writable under suppress(OSError), the same way navmesh_index and bvh_index do it. Here the chmod in except BaseException isn't guarded, so if it fails, its error replaces the os.replace error the caller reports.
  • Test: the new test only checks that some chmod(..., 0o600) call happened, on a new destination. Under umask 077, published_mode already returns 0o600 on main, so the test passes without the fix. #789's test fails a replace over a read-only prior report and checks that the prior bytes are unchanged and nothing is left behind.
  • Claim: #789 claimed STORY-INDEX-STAGE-CLEANUP first (13:50Z vs 14:05Z).
  • For next time: the PR template asks for the claim link, Depends on:, what you tested, and the GPU/driver line (CONTRIBUTING.md).

Thanks again. If you'd like another item, the open ones are in the coordination issue.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142666808 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/812#issuecomment-7142666808). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T19:50:37Z. --- Thanks for picking this up. We're closing this in favour of #789, which covers the same item. The reasons: - **Error masking:** #789 makes the stage writable under `suppress(OSError)`, the same way `navmesh_index` and `bvh_index` do it. Here the `chmod` in `except BaseException` isn't guarded, so if it fails, its error replaces the `os.replace` error the caller reports. - **Test:** the new test only checks that some `chmod(..., 0o600)` call happened, on a new destination. Under `umask 077`, `published_mode` already returns `0o600` on `main`, so the test passes without the fix. #789's test fails a replace over a read-only prior report and checks that the prior bytes are unchanged and nothing is left behind. - **Claim:** #789 claimed `STORY-INDEX-STAGE-CLEANUP` first (13:50Z vs 14:05Z). - **For next time:** the PR template asks for the claim link, `Depends on:`, what you tested, and the GPU/driver line ([CONTRIBUTING.md](https://github.com/ubiquitarianism/leonida/blob/main/CONTRIBUTING.md)). Thanks again. If you'd like another item, the open ones are in the coordination issue. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

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!812
No description provided.