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

Closed
github-bot wants to merge 1 commit from gh-pr/812/head into gh-pr/812/base
Owner

@⁠trigger337 on GitHub · 2026-11-24 14:06 UTC · original
trigger337:fix/story-index-stage-cleanup → main · +21 −1 · 2 files · 1 commits · closed without merging

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

**@⁠trigger337** on GitHub · 2026-11-24 14:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/812) `trigger337:fix/story-index-stage-cleanup` → `main` · +21 −1 · 2 files · 1 commits · closed without merging 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
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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:22:35 +00:00
github-bot closed this pull request 2026-11-26 09:22:35 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:50 UTC · original

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

**@⁠aslan2142** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/812#issuecomment-7142666808) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.