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

Closed
github-bot wants to merge 1 commit from gh-pr/96/head into gh-pr/96/base
Owner

@⁠wavehs on GitHub · 2026-11-24 02:17 UTC · original
wavehs:tests-win-drive-root-manifest → main · +20 −17 · 1 files · 1 commits · closed without merging

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.)
**@⁠wavehs** on GitHub · 2026-11-24 02:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/96) `wavehs:tests-win-drive-root-manifest` → `main` · +20 −17 · 1 files · 1 commits · closed without merging 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.)
main() now takes a drive-root game folder's top-level entries from the version
manifest (check()'s expected_exe and files) instead of os.listdir, so the
mock that returned {} raised KeyError: 'expected_exe' before the destination
was judged: four errors in the Windows check job. run_build() takes a manifest
for these cases, and the two tests stop patching os.listdir, which nothing
reads any more.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:44:14 +00:00
github-bot closed this pull request 2026-11-26 08:44:14 +00:00
Author
Owner

@⁠wavehs on GitHub · 2026-11-24 02:27 UTC · original

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** on GitHub · 2026-11-24 02:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120156799) 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.
Author
Owner

@⁠wavehs on GitHub · 2026-11-24 02:29 UTC · original

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** on GitHub · 2026-11-24 02:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120194906) 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.
Author
Owner

@⁠wavehs on GitHub · 2026-11-24 03:10 UTC · original

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.

**@⁠wavehs** on GitHub · 2026-11-24 03:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120841604) 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.
Author
Owner

@⁠ubiquitarianism on GitHub · 2026-11-24 03:10 UTC · original

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.

**@⁠ubiquitarianism** on GitHub · 2026-11-24 03:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/96#issuecomment-7120841822) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.