tests: awc_manifest refuses a read-only manifest before it stages one #6

Merged
wavehs merged 1 commit from upstream-pr/6 into main 2026-11-24 01:40:20 +00:00
wavehs commented 2026-11-24 01:29:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T01:29:28Z.


Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. Fixes the red tests/test_awc_manifest.py on main; no other open pull request touches it.

Depends on: none.

What and why

82b87bdd3 changed write_manifest to open the destination for writing first, keeping the direct writer's permission check, and only then stage the report. test_failed_replace_of_read_only_manifest_removes_writable_temp still expected the old path — stage, inherit 0444, fail inside replace_retry, chmod 0600, unlink — and asserted that the chmod happened. Once the pre-open raises PermissionError nothing is staged, so the assertion gets 0 != 1 on POSIX and Windows alike.

Split into the two behaviours that exist now:

  • a read-only manifest is refused with the previous report and the directory unchanged;
  • a writable manifest whose replace_retry fails still leaves no staging file and keeps the previous report.

Test file only; no tool code.

Tested

main@30daa6958, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files:

tree tests/test_awc_manifest.py
main@30daa6958 FAILED (failures=1) — AssertionError: 0 != 1 in test_failed_replace_of_read_only_manifest_removes_writable_temp
this commit Ran 23 tests ... OK (22 before, plus the split's read-only case)

python -m compileall -q make_game.py tools tests clean, python -I scripts/check_no_game_data.py tests/test_awc_manifest.py clean.

The read-only case relies on os.open(..., O_WRONLY) failing for a 0444 file, which is the same check the product relies on; not run on Windows here.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464344023 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/6). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T01:29:28Z. --- Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. Fixes the red `tests/test_awc_manifest.py` on `main`; no other open pull request touches it. Depends on: none. ### What and why `82b87bdd3` changed `write_manifest` to open the destination for writing first, keeping the direct writer's permission check, and only then stage the report. `test_failed_replace_of_read_only_manifest_removes_writable_temp` still expected the old path — stage, inherit 0444, fail inside `replace_retry`, chmod 0600, unlink — and asserted that the chmod happened. Once the pre-open raises `PermissionError` nothing is staged, so the assertion gets 0 != 1 on POSIX and Windows alike. Split into the two behaviours that exist now: - a read-only manifest is refused with the previous report and the directory unchanged; - a writable manifest whose `replace_retry` fails still leaves no staging file and keeps the previous report. Test file only; no tool code. ### Tested `main@30daa6958`, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files: | tree | `tests/test_awc_manifest.py` | |---|---| | `main@30daa6958` | `FAILED (failures=1)` — `AssertionError: 0 != 1` in `test_failed_replace_of_read_only_manifest_removes_writable_temp` | | this commit | `Ran 23 tests ... OK` (22 before, plus the split's read-only case) | `python -m compileall -q make_game.py tools tests` clean, `python -I scripts/check_no_game_data.py tests/test_awc_manifest.py` clean. The read-only case relies on `os.open(..., O_WRONLY)` failing for a 0444 file, which is the same check the product relies on; not run on Windows here. AI-assisted: yes. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: no translator change.)
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!6
No description provided.