tests: give the drive-root cases the version manifest they are judged against #96

Closed
wavehs wants to merge 1 commit from upstream-pr/96 into main
wavehs commented 2026-11-24 02:17:16 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository's issue index (#18) has no entry for it. No open pull request touches this file.

Depends on: none.

What and why

The Windows check job reports four errors in tests/test_make_game_paths.py, all the same:

ERROR: test_drive_root_checks_entries_on_each_volume ... (protected='C:\\Content', option='out')
  File "make_game.py", line 2801, in main
    top_level = {rel.replace("\\", "/").split("/", 1)[0] for rel in [v["expected_exe"], *v["files"]]}
KeyError: 'expected_exe'

main() no longer lists the drive root to learn the dump's top-level entries; it takes them from the version manifest check() returns (expected_exe and files), so an unrelated folder on the drive cannot make the rerun look unsafe. The two drive-root tests still patched os.listdir, which nothing reads any more, and their check() mock returned {}.

run_build() now takes the manifest for the cases that need one, and the two tests pass one with the entries they mean (Content, and MountedContent for the junction case). The os.listdir patches are gone, and with them the two orderings in test_drive_root_checks_entries_on_each_volume, which existed to vary a listing the code no longer reads; the two protected targets (the folder on the dump's own volume, and the one a junction reaches on another) are still both checked.

Tested

main@9ec34cdff, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files. Both cases skip on a non-Windows host, so the drive-root branch was exercised directly: / splits as a drive root under os.path.splitdrive here too, which reaches the same code with POSIX paths.

case check() mock result
out in an independent folder manifest with Content rc=0, preflight and runtime ran
out under the dump's own entry (/Content/out) manifest with Content rc=1, "must be outside the game folder"
out is the root itself manifest with Content rc=1
junction to another volume: out under MountedContent → /mnt/Package manifest with Content + MountedContent, realpath mocked rc=1 for both protected targets, rc=0 for an independent folder
the old mock {} KeyError: 'expected_exe', the CI traceback

python -I tests/test_make_game_paths.py: OK (skipped=2), before and after. compileall clean, check_no_game_data.py clean. Not run on Windows itself, and not run: any GPU test.

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: test-only.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464818563 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/96). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T02:17:16Z. --- Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository's issue index (#18) has no entry for it. No open pull request touches this file. Depends on: none. ### What and why The Windows `check` job reports four errors in `tests/test_make_game_paths.py`, all the same: ``` ERROR: test_drive_root_checks_entries_on_each_volume ... (protected='C:\\Content', option='out') File "make_game.py", line 2801, in main top_level = {rel.replace("\\", "/").split("/", 1)[0] for rel in [v["expected_exe"], *v["files"]]} KeyError: 'expected_exe' ``` `main()` no longer lists the drive root to learn the dump's top-level entries; it takes them from the version manifest `check()` returns (`expected_exe` and `files`), so an unrelated folder on the drive cannot make the rerun look unsafe. The two drive-root tests still patched `os.listdir`, which nothing reads any more, and their `check()` mock returned `{}`. `run_build()` now takes the manifest for the cases that need one, and the two tests pass one with the entries they mean (`Content`, and `MountedContent` for the junction case). The `os.listdir` patches are gone, and with them the two orderings in `test_drive_root_checks_entries_on_each_volume`, which existed to vary a listing the code no longer reads; the two protected targets (the folder on the dump's own volume, and the one a junction reaches on another) are still both checked. ### Tested `main@9ec34cdff`, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files. Both cases skip on a non-Windows host, so the drive-root branch was exercised directly: `/` splits as a drive root under `os.path.splitdrive` here too, which reaches the same code with POSIX paths. | case | `check()` mock | result | |---|---|---| | out in an independent folder | manifest with `Content` | `rc=0`, preflight and runtime ran | | out under the dump's own entry (`/Content/out`) | manifest with `Content` | `rc=1`, "must be outside the game folder" | | out is the root itself | manifest with `Content` | `rc=1` | | junction to another volume: out under `MountedContent` → `/mnt/Package` | manifest with `Content` + `MountedContent`, `realpath` mocked | `rc=1` for both protected targets, `rc=0` for an independent folder | | the old mock | `{}` | `KeyError: 'expected_exe'`, the CI traceback | `python -I tests/test_make_game_paths.py`: `OK (skipped=2)`, before and after. `compileall` clean, `check_no_game_data.py` clean. Not run on Windows itself, and not run: any GPU test. 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: test-only.)
wavehs commented 2026-11-24 02:27:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T02:27:09Z.


Not re-landed from an old branch: the Windows check job's four KeyError: 'expected_exe' errors come from a mock that went stale when the drive-root rule switched from os.listdir to the version manifest. Checked #18 and #17 for a matching old item first - none.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120156799 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120156799). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T02:27:09Z. --- Not re-landed from an old branch: the Windows `check` job's four `KeyError: 'expected_exe'` errors come from a mock that went stale when the drive-root rule switched from `os.listdir` to the version manifest. Checked `#18` and `#17` for a matching old item first - none.
wavehs commented 2026-11-24 02:29:21 +00:00 (Migrated from github.com)

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


Rebased onto main@e09a55529; the diff is unchanged, tests/test_make_game_paths.py is still OK (skipped=2) here, and the drive-root simulation still rejects both protected targets and allows an independent folder.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120194906 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120194906). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T02:29:21Z. --- Rebased onto `main@e09a55529`; the diff is unchanged, `tests/test_make_game_paths.py` is still `OK (skipped=2)` here, and the drive-root simulation still rejects both protected targets and allows an independent folder.
wavehs commented 2026-11-24 03:10:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T03:10:31Z.


Duplicate of #81 (natterman12), which fixes the same four Windows KeyError: 'expected_exe' errors in this file - and the test_leonida_mods case too - by handing run_build() a version manifest built from the top-level entries, the same shape as the version() helper here. #81 was opened first and I missed it when checking for overlaps, so this one can go.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120841604 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120841604). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T03:10:31Z. --- Duplicate of #81 (natterman12), which fixes the same four Windows `KeyError: 'expected_exe'` errors in this file - and the `test_leonida_mods` case too - by handing `run_build()` a version manifest built from the top-level entries, the same shape as the `version()` helper here. #81 was opened first and I missed it when checking for overlaps, so this one can go.
ubiquitarianism commented 2026-11-24 03:10:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-11-24T03:10:32Z.


Closing as a duplicate of #81, which makes the same version-manifest fix to the drive-root cases in tests/test_make_game_paths.py and also fixes the Windows failure in test_leonida_mods. The two conflicted on that file.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120841822 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120841822). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-11-24T03:10:32Z. --- Closing as a duplicate of #81, which makes the same version-manifest fix to the drive-root cases in `tests/test_make_game_paths.py` and also fixes the Windows failure in `test_leonida_mods`. The two conflicted on that file.

Pull request closed

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!96
No description provided.