OLD-7895: restore old upstream PR 7895 - make_game: an incomplete copy is named as a partial match of its version, with what is missing #723

Merged
aslan2142 merged 3 commits from upstream-pr/723 into main 2026-11-25 22:26:12 +00:00
aslan2142 commented 2026-11-24 12:56:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T12:56:03Z.


Claimed in the coordination issue as: OLD-7895 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7132079608

Restoration of my original pull request, old upstream PR 7895 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 51f3160923; the three commits cherry-picked cleanly and nothing needed adapting (the case-sensitive probe hint that landed in the meantime is unchanged).

What and why

  • load_version() only looks at the three probe files (MicrosoftGame.Config, Catalog000.bin, appdata0.rpf). So a copy whose download stopped before one of them got the same message as another game: "This doesn't look like a supported version of the game".
  • Now, when no version matches its probes, the folder is compared with each manifest by name and size (metadata only, nothing is read or hashed).
  • If the folder holds at least half of one version's files at the right sizes, the error names that version and how many files match. It lists:
    • the missing files, with their total size;
    • the files with another size;
    • any file whose metadata can't be read.
  • Only FileNotFoundError and NotADirectoryError count as missing, as in probe_mismatches(). A file that raises another OSError (for example PermissionError) is listed as "cannot read", with advice to make it readable. In that case the message doesn't say "Finish the download".
  • A probe file that is there with another size means another build, not an unfinished download. Those folders keep the "not a supported version" message, which lists the probe sizes, even if files are missing too.
  • A folder below half keeps the old message.

Tested

Linux, Python 3.14.10, CPU only. Synthetic manifests and empty or truncated files only, no game files.

  • python -I tests/test_make_game_preflight.py:
    • on main with this PR's tests: 107 tests, 4 failures, 1 skipped;
    • on this branch: 107 tests, OK, 1 skipped.
  • The new PartialVersionMatchTest has 9 cases:
    • an incomplete copy with missing and wrong-size files;
    • a folder below half of the manifest;
    • a folder that matches nothing;
    • a directory in place of a file;
    • a probe file that can't be read;
    • a complete copy of another build;
    • missing files with matching probes;
    • missing files plus a probe file with another size;
    • a complete copy, which still loads.
  • python -m compileall -q make_game.py tools tests, python -I make_game.py --help, git diff --check and python -I scripts/check_no_game_data.py make_game.py tests/test_make_game_preflight.py all pass.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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. (n/a: no translator change)

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5472560416 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/723). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T12:56:03Z. --- Claimed in the coordination issue as: OLD-7895 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7132079608 Restoration of my original pull request, old upstream PR 7895 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 51f31609236a952badeb9c9aba9efc2a6e4dc2ff; the three commits cherry-picked cleanly and nothing needed adapting (the case-sensitive probe hint that landed in the meantime is unchanged). ### What and why - `load_version()` only looks at the three probe files (`MicrosoftGame.Config`, `Catalog000.bin`, `appdata0.rpf`). So a copy whose download stopped before one of them got the same message as another game: "This doesn't look like a supported version of the game". - Now, when no version matches its probes, the folder is compared with each manifest by name and size (metadata only, nothing is read or hashed). - If the folder holds at least half of one version's files at the right sizes, the error names that version and how many files match. It lists: - the missing files, with their total size; - the files with another size; - any file whose metadata can't be read. - Only `FileNotFoundError` and `NotADirectoryError` count as missing, as in `probe_mismatches()`. A file that raises another `OSError` (for example `PermissionError`) is listed as "cannot read", with advice to make it readable. In that case the message doesn't say "Finish the download". - A probe file that is there with another size means another build, not an unfinished download. Those folders keep the "not a supported version" message, which lists the probe sizes, even if files are missing too. - A folder below half keeps the old message. ### Tested Linux, Python 3.14.10, CPU only. Synthetic manifests and empty or truncated files only, no game files. - `python -I tests/test_make_game_preflight.py`: - on main with this PR's tests: 107 tests, 4 failures, 1 skipped; - on this branch: 107 tests, OK, 1 skipped. - The new `PartialVersionMatchTest` has 9 cases: - an incomplete copy with missing and wrong-size files; - a folder below half of the manifest; - a folder that matches nothing; - a directory in place of a file; - a probe file that can't be read; - a complete copy of another build; - missing files with matching probes; - missing files plus a probe file with another size; - a complete copy, which still loads. - `python -m compileall -q make_game.py tools tests`, `python -I make_game.py --help`, `git diff --check` and `python -I scripts/check_no_game_data.py make_game.py tests/test_make_game_preflight.py` all pass. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [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. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5).
abnalstlll-byte commented 2026-11-24 13:15:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T13:15:57Z.

Review: APPROVED


LGTM. Helpful diagnostic improvement in make_game.py: distinguishes an incomplete/in-progress download from an unsupported version by detecting partial manifest matches (>=50%) and listing missing/wrong-sized files. Extensive test coverage in est_make_game_preflight.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6039846463 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/723#pullrequestreview-6039846463). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T13:15:57Z. **Review:** APPROVED --- LGTM. Helpful diagnostic improvement in make_game.py: distinguishes an incomplete/in-progress download from an unsupported version by detecting partial manifest matches (>=50%) and listing missing/wrong-sized files. Extensive test coverage in est_make_game_preflight.py.
aslan2142 commented 2026-11-25 22:26:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T22:26:14Z.


Merged: make_game: an incomplete copy is named as a partial match of its version, with what is missing.

  • Changed since review: Nothing. It merges cleanly with main, and no review point is open.
  • Tested: tests/test_make_game_preflight.py passes on main + this head (Linux, CPython 3.14).
  • Checked on main 3daeb1e11 + 6e15812e5: the semantic suite passes (492 files, 6,315 tests, 0 files failed); test_make_game_preflight pass; the 15 docs and writer tests pass; check_no_game_data.py is clean on the 2 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7176359984 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/723#issuecomment-7176359984). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T22:26:14Z. --- Merged: `make_game`: an incomplete copy is named as a partial match of its version, with what is missing. - **Changed since review:** Nothing. It merges cleanly with `main`, and no review point is open. - **Tested:** `tests/test_make_game_preflight.py` passes on `main` + this head (Linux, CPython 3.14). - **Checked on `main` `3daeb1e11` + `6e15812e5`:** the semantic suite passes (492 files, 6,315 tests, 0 files failed); `test_make_game_preflight` pass; the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 2 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
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!723
No description provided.