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

Closed
leonida/mandy
trigger337 wants to merge 0 commits from fix/story-index-stage-cleanup into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

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

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
aslan2142 commented 2026-11-24 19:50:37 +00:00

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

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).
Sign in to join this conversation.
No description provided.