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

Manually merged
github merged 1 commit from gh-pr/6/head into gh-pr/6/base 2026-11-26 08:39:56 +00:00
Owner

@⁠wavehs on GitHub · 2026-11-24 01:29 UTC · original
wavehs:test-awc-readonly-manifest → main · +14 −1 · 1 files · 1 commits · merged 2026-11-24 01:40 UTC

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.)
**@⁠wavehs** on GitHub · 2026-11-24 01:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/6) `wavehs:test-awc-readonly-manifest` → `main` · +14 −1 · 1 files · 1 commits · merged 2026-11-24 01:40 UTC 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.)
82b87bdd3 opens the destination for writing first, to keep the direct
writer's permission check, and only then stages the report. The test
still expected the old path (stage, inherit 0444, fail in replace_retry,
chmod 0600, unlink) and asserted that chmod happened, so it failed once
the pre-open raises PermissionError: on POSIX and Windows alike nothing
is staged.

Split it: a read-only manifest is refused with the previous report and
the directory unchanged, and a writable manifest whose replace_retry
fails still leaves no staging file.

(cherry picked from commit 2ccc600642cfd4f8252051a46c7cc8e2d7723820)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:39:54 +00:00
github manually merged commit 1fa09754c3 into gh-pr/6/base 2026-11-26 08:39:56 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!6
No description provided.