SPIRV-STUBS-STAGE-CLEANUP: publish staged mode and harden cleanup #924

Closed
fitzypopper wants to merge 1 commit from upstream-pr/924 into main
fitzypopper commented 2026-11-24 15:12:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fitzypopper on 2026-11-24T15:12:32Z.


Claimed in the coordination issue as: SPIRV-STUBS-STAGE-CLEANUP (claim comment).

tools/spirv_stubs.py copied the target's mode only on POSIX (shutil.copymode), so staged stubs published on Windows lost the destination's permission bits. Its failure path also removed the staged file without making it writable first, which can mask the original error when the staged file carries a read-only mode. This uses published_mode(target) on every OS and, on failure, chmods the staged file to 0o600 before removing it, with cleanup errors suppressed.

New tests/test_spirv_stubs_stage_cleanup.py simulates a Windows publication to check the mode is applied, and patches _replace_stub to fail to check the staged file is made writable and removed. Both fail on origin/main and pass with this change. The existing 15 test_spirv_stubs.py tests still pass.

No game data: synthetic index only. check_no_game_data.py and the line-ending test pass.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474872386 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/924). Originally posted by [fitzypopper](https://github.com/fitzypopper) on 2026-11-24T15:12:32Z. --- Claimed in the coordination issue as: `SPIRV-STUBS-STAGE-CLEANUP` ([claim comment](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135626827)). `tools/spirv_stubs.py` copied the target's mode only on POSIX (`shutil.copymode`), so staged stubs published on Windows lost the destination's permission bits. Its failure path also removed the staged file without making it writable first, which can mask the original error when the staged file carries a read-only mode. This uses `published_mode(target)` on every OS and, on failure, chmods the staged file to `0o600` before removing it, with cleanup errors suppressed. New `tests/test_spirv_stubs_stage_cleanup.py` simulates a Windows publication to check the mode is applied, and patches `_replace_stub` to fail to check the staged file is made writable and removed. Both fail on `origin/main` and pass with this change. The existing 15 `test_spirv_stubs.py` tests still pass. No game data: synthetic index only. `check_no_game_data.py` and the line-ending test pass. AI-assisted: yes.
PierreEbele commented 2026-11-25 21:29:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T21:29:54Z.


Reviewed 04f3574: staged stubs now take published_mode(target) on every OS and the failure path chmods 0o600 before removing, matching the repo's staging conventions. I ran test_spirv_stubs (15 OK, 1 nt skip), the new test file, test_shader_build_fallbacks and test_shader_link_check on both trees, plus a tip-overlap integration run: the 2 new tests fail on main and pass with the change, everything else stays green. Filesystem probes show no behaviour change on Linux by design; the Windows path is covered by the mocked tests. No findings; nit: shutil is now unused in spirv_stubs.py. AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175155683 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/924#issuecomment-7175155683). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T21:29:54Z. --- Reviewed 04f3574: staged stubs now take published_mode(target) on every OS and the failure path chmods 0o600 before removing, matching the repo's staging conventions. I ran test_spirv_stubs (15 OK, 1 nt skip), the new test file, test_shader_build_fallbacks and test_shader_link_check on both trees, plus a tip-overlap integration run: the 2 new tests fail on main and pass with the change, everything else stays green. Filesystem probes show no behaviour change on Linux by design; the Windows path is covered by the mocked tests. No findings; nit: shutil is now unused in spirv_stubs.py. AI-assisted review. **Recommendation:** Merge

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