test: exercise AWC manifest staged cleanup on all hosts #249

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

@⁠Andretuta on GitHub · 2026-11-24 02:53 UTC · original
ubiquitarianism:old-pr/9983 → main · +11 −8 · 1 files · 1 commits · draft

Carried over from old PR 9983 by WebIdentity1 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9983, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
WebIdentity1: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116927597

What and why

test_failed_replace_of_read_only_manifest_removes_writable_temp made the destination read-only before calling write_manifest. On macOS the preliminary os.open(destination, os.O_WRONLY) correctly rejects that destination, so the test failed before it could exercise staged-file cleanup. The test now keeps the destination writable, makes the synthetic staged file read-only inside the failed-replace callback, and verifies the cleanup restores its writable mode, leaves the previous manifest intact, and removes the temporary file. Production code is unchanged.

Tested

macOS, Python 3.12, synthetic AWC data only; no GPU or game files:

  • Baseline python3.12 -I tests/test_awc_manifest.py: 1 failure of 22 at the staged cleanup assertion.
  • Head python3.12 -I tests/test_awc_manifest.py: 22/22 pass.
  • Related suites: test_file_mode.py 5 pass; test_replace_retry.py 8 pass/2 expected skips; test_awc_names.py 35 pass/1 expected skip; test_awc_shorts.py 15 pass/1 expected skip.
  • python3.12 -I scripts/check_no_game_data.py tests/test_awc_manifest.py, python3.12 -m compileall -q tests/test_awc_manifest.py, and git diff --check pass.

AI-assisted: yes.

**@⁠Andretuta** on GitHub · 2026-11-24 02:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/249) `ubiquitarianism:old-pr/9983` → `main` · +11 −8 · 1 files · 1 commits · draft > Carried over from **old PR 9983** by `WebIdentity1` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9983`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `WebIdentity1`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116927597 ### What and why `test_failed_replace_of_read_only_manifest_removes_writable_temp` made the destination read-only before calling `write_manifest`. On macOS the preliminary `os.open(destination, os.O_WRONLY)` correctly rejects that destination, so the test failed before it could exercise staged-file cleanup. The test now keeps the destination writable, makes the synthetic staged file read-only inside the failed-replace callback, and verifies the cleanup restores its writable mode, leaves the previous manifest intact, and removes the temporary file. Production code is unchanged. ### Tested macOS, Python 3.12, synthetic AWC data only; no GPU or game files: - Baseline `python3.12 -I tests/test_awc_manifest.py`: 1 failure of 22 at the staged cleanup assertion. - Head `python3.12 -I tests/test_awc_manifest.py`: 22/22 pass. - Related suites: `test_file_mode.py` 5 pass; `test_replace_retry.py` 8 pass/2 expected skips; `test_awc_names.py` 35 pass/1 expected skip; `test_awc_shorts.py` 15 pass/1 expected skip. - `python3.12 -I scripts/check_no_game_data.py tests/test_awc_manifest.py`, `python3.12 -m compileall -q tests/test_awc_manifest.py`, and `git diff --check` pass. AI-assisted: yes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:50:27 +00:00
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-24 09:52 UTC · original

Tested at your head 6c8151d6e: python3 -I tests/test_awc_manifest.py OK, and test_awc_opus, test_saves (1 skip), test_text_write_line_endings and test_report_paths all OK there too.
Direction is right: replacing the two split assertions with one that drives a denied publish while the staged file carries the read-only mode restores the coverage the merged 1fa09754c left behind - that a failed publish keeps the previous report and clears the staged mode before deleting it, which is what Windows needs.
Two things block it as written: it branches from a much older main (against 7430f59b2 the diff is 261 files with 23,025 deletions, i.e. most of current main is missing, so it needs a rebase before anyone can read it), and it deletes test_read_only_manifest_is_refused_without_staging_a_file - the assertion that the writer's permission check runs before anything is staged. If that is deliberate because the tool no longer depends on it, say so in the commit message; otherwise both guarantees should stay in the file.
An independent second implementation on this box took the same route and found two details worth folding in: patching published_mode to return 0o444 (a real read-only destination is now refused earlier, so the mode the staged file gets has to come from that mock), and an os.unlink stand-in that raises PermissionError when a file has no write bits - that is what actually exercises the clear-then-delete cleanup on Linux, where a read-only file is still deletable.
AI-assisted (Hermes agent on behalf of @⁠Headache3318), Arch Linux, python 3.14.9; the Windows read-only attribute is simulated here, not measured, so the "on all hosts" claim still needs a Windows or Wine run.

**@⁠Headache3318** on GitHub · 2026-11-24 09:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/249#issuecomment-7128015615) Tested at your head `6c8151d6e`: `python3 -I tests/test_awc_manifest.py` OK, and `test_awc_opus`, `test_saves` (1 skip), `test_text_write_line_endings` and `test_report_paths` all OK there too. Direction is right: replacing the two split assertions with one that drives a denied publish while the staged file carries the read-only mode restores the coverage the merged `1fa09754c` left behind - that a failed publish keeps the previous report and clears the staged mode before deleting it, which is what Windows needs. Two things block it as written: it branches from a much older `main` (against `7430f59b2` the diff is 261 files with 23,025 deletions, i.e. most of current `main` is missing, so it needs a rebase before anyone can read it), and it deletes `test_read_only_manifest_is_refused_without_staging_a_file` - the assertion that the writer's permission check runs before anything is staged. If that is deliberate because the tool no longer depends on it, say so in the commit message; otherwise both guarantees should stay in the file. An independent second implementation on this box took the same route and found two details worth folding in: patching `published_mode` to return `0o444` (a real read-only destination is now refused earlier, so the mode the staged file gets has to come from that mock), and an `os.unlink` stand-in that raises `PermissionError` when a file has no write bits - that is what actually exercises the clear-then-delete cleanup on Linux, where a read-only file is still deletable. **AI-assisted** (Hermes agent on behalf of @⁠Headache3318), Arch Linux, python 3.14.9; the Windows read-only attribute is simulated here, not measured, so the "on all hosts" claim still needs a Windows or Wine run.
This pull request has changes conflicting with the target branch.
  • tests/test_awc_manifest.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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