[PR #6] [MERGED] tests: awc_manifest refuses a read-only manifest before it stages one #64

Closed
opened 2026-11-26 20:16:40 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/6
Author: @wavehs
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: test-awc-readonly-manifest


📝 Commits (1)

  • 1fa0975 tests: awc_manifest refuses a read-only manifest before it stages one

📊 Changes

1 file changed (+14 additions, -1 deletions)

View changed files

📝 tests/test_awc_manifest.py (+14 -1)

📄 Description

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.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/6 **Author:** [@wavehs](https://github.com/wavehs) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `test-awc-readonly-manifest` --- ### 📝 Commits (1) - [`1fa0975`](https://github.com/ubiquitarianism/leonida/commit/1fa09754c37ea6c5f703ede4dea2bae4c26acb2c) tests: awc_manifest refuses a read-only manifest before it stages one ### 📊 Changes **1 file changed** (+14 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_awc_manifest.py` (+14 -1) </details> ### 📄 Description 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.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:40 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#64
No description provided.