manifest_verifier: restore write mode before unlink on replace failure and publish mode (MANIFEST-VERIFIER-STAGE-CLEANUP) #899

Open
github-bot wants to merge 1 commit from github-bot/gh-899 into main AGit
Owner

@⁠trigger337 on GitHub · 2026-11-24 15:03 UTC · original
trigger337:fix/manifest-verifier-stage-cleanup → main · +23 −0 · 2 files · 1 commits · open

Apply published_mode(path) to temporary cache file before atomic replacement in save_cache(), and restore write permission (0o600) before unlinking tmp in an exception handler when os.replace fails. This ensures read-only destination permissions do not trigger Windows PermissionError [WinError 5] or strand staging files on replacement failure.

Includes unit test verifying mode restoration on replacement failure.

Clean-room / zero game data verified via scripts/check_no_game_data.py.

agent: yes
AI-assisted: yes

**@⁠trigger337** on GitHub · 2026-11-24 15:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/899) `trigger337:fix/manifest-verifier-stage-cleanup` → `main` · +23 −0 · 2 files · 1 commits · open Apply `published_mode(path)` to temporary cache file before atomic replacement in `save_cache()`, and restore write permission (`0o600`) before unlinking `tmp` in an exception handler when `os.replace` fails. This ensures read-only destination permissions do not trigger Windows `PermissionError` [WinError 5] or strand staging files on replacement failure. Includes unit test verifying mode restoration on replacement failure. Clean-room / zero game data verified via `scripts/check_no_game_data.py`. agent: yes AI-assisted: yes
Apply published_mode(path) to temporary cache file before atomic replacement,
and restore write permission (0o600) before unlink in exception block when
replace fails, preventing Windows PermissionError [WinError 5] and stranded
temporary cache files.

agent: yes
AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:27:07 +00:00
Author
Owner

@⁠LewisStephens99 on GitHub · 2026-11-24 15:10 UTC · original

Independent verification on Windows 11, Python 3.14: 57/58 tests passed; test_save_cache_stage_cleanup_restores_write_mode_on_replace_failure fails because Windows reports st_mode & 0o777 as 0o666 for both chmod(..., 0o600) and chmod(..., 0o666) in this environment. The implementation does execute os.chmod(tmp, 0o600) before unlink in the replacement-failure exception path, so this appears to be a cross-platform assertion issue: test os.chmod calls directly or skip exact POSIX mode reads on Windows. No source crash or cleanup failure observed; no game data or GPU used.

**@⁠LewisStephens99** on GitHub · 2026-11-24 15:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/899#issuecomment-7135571146) Independent verification on Windows 11, Python 3.14: 57/58 tests passed; `test_save_cache_stage_cleanup_restores_write_mode_on_replace_failure` fails because Windows reports `st_mode & 0o777` as `0o666` for both `chmod(..., 0o600)` and `chmod(..., 0o666)` in this environment. The implementation does execute `os.chmod(tmp, 0o600)` before unlink in the replacement-failure exception path, so this appears to be a cross-platform assertion issue: test `os.chmod` calls directly or skip exact POSIX mode reads on Windows. No source crash or cleanup failure observed; no game data or GPU used.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/899/head:github-bot/gh-899'
git switch 'github-bot/gh-899'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-899'
git switch 'github-bot/gh-899'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-899'
git switch 'github-bot/gh-899'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-899'
git switch 'main'
git merge --squash 'github-bot/gh-899'
git switch 'main'
git merge --ff-only 'github-bot/gh-899'
git switch 'main'
git merge 'github-bot/gh-899'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.