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

Merged
Andretuta merged 1 commit from upstream-pr/249 into main 2026-12-01 17:39:20 +00:00
Andretuta commented 2026-11-24 02:53:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:53:16Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465183977 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/249). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:53:16Z. --- > 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.
Headache3318 commented 2026-11-24 09:52:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Headache3318 on 2026-11-24T09:52:53Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128015615 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/249#issuecomment-7128015615). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-24T09:52:53Z. --- 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.
aslan2142 commented 2026-12-01 11:38:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:38:51Z.


Draft PR review note: this carried-over PR currently conflicts with main in tests/test_awc_manifest.py and has no CI run. main (tests/test_awc_manifest.py:392-410) still tests replace_retry without forcing the staged file read-only, so the improved staged-cleanup test is still distinct. Please rebase onto current main, mark ready for review, and run CI if you want to land it.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7309929963 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/249#issuecomment-7309929963). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:38:51Z. --- Draft PR review note: this carried-over PR currently conflicts with `main` in `tests/test_awc_manifest.py` and has no CI run. `main` (`tests/test_awc_manifest.py:392-410`) still tests `replace_retry` without forcing the staged file read-only, so the improved staged-cleanup test is still distinct. Please rebase onto current `main`, mark ready for review, and run CI if you want to land it. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:16:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:16:56Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310909864 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/249#issuecomment-7310909864). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:16:56Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 12:58:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:58:57Z.

Review: DISMISSED


Now ready for review, requesting changes before merge:

  • Merge conflicts (CONFLICTING/DIRTY): conflicts with main in tests/test_awc_manifest.py (the staged cleanup test here remains distinct from tests/test_awc_manifest.py:392-410).
  • CI: no CI runs on the current head. Please rebase onto current main and get fresh green CI.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6131717427 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/249#pullrequestreview-6131717427). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:58:57Z. **Review:** DISMISSED --- Now ready for review, requesting changes before merge: - **Merge conflicts (`CONFLICTING`/`DIRTY`)**: conflicts with `main` in `tests/test_awc_manifest.py` (the staged cleanup test here remains distinct from `tests/test_awc_manifest.py:392-410`). - **CI**: no CI runs on the current head. Please rebase onto current `main` and get fresh green CI. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:28:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:28:15Z.


Rebased onto current main (d2a564b66) at 15396d111, resolving the conflict in tests/test_awc_manifest.py while preserving test_read_only_manifest_is_refused_without_staging_a_file and all post-branch tests.

Verified locally on Linux (Python 3, synthetic AWC data only, no game files or GPU):

  • python3 -I tests/test_awc_manifest.py: 26/26 passed
  • python3 -m compileall -q make_game.py tools tests: passed
  • python3 -I scripts/check_no_game_data.py: passed
  • git diff --check origin/main..HEAD: clean

(AI-assisted rebase.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319349995 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/249#issuecomment-7319349995). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:28:15Z. --- Rebased onto current `main` (`d2a564b66`) at `15396d111`, resolving the conflict in `tests/test_awc_manifest.py` while preserving `test_read_only_manifest_is_refused_without_staging_a_file` and all post-branch tests. Verified locally on Linux (Python 3, synthetic AWC data only, no game files or GPU): - `python3 -I tests/test_awc_manifest.py`: 26/26 passed - `python3 -m compileall -q make_game.py tools tests`: passed - `python3 -I scripts/check_no_game_data.py`: passed - `git diff --check origin/main..HEAD`: clean *(AI-assisted rebase.)*
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!249
No description provided.