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

Manually merged
github merged 3 commits from gh-pr/723/head into gh-pr/723/base 2026-11-26 09:18:08 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-24 12:56 UTC · original
aslan2142:build2835-partial-version-match → main · +193 −1 · 2 files · 3 commits · merged 2026-11-25 22:26 UTC

Claimed in the coordination issue as: OLD-7895 #14

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

**@⁠aslan2142** on GitHub · 2026-11-24 12:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/723) `aslan2142:build2835-partial-version-match` → `main` · +193 −1 · 2 files · 3 commits · merged 2026-11-25 22:26 UTC Claimed in the coordination issue as: OLD-7895 https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 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).
load_version() only looks at the three probe files, so a copy whose download stopped before one of them
was reported as "This doesn't look like a supported version of the game", the same as another game. When
no version matches its probes, the folder is now compared with each manifest by name and size; if it holds
at least half of one version's files with matching sizes, the error names that version, how many files
match, and lists the missing files (with their total size) and the ones with another size. A folder below
half keeps the old message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
manifest_presence() counted every OSError from os.stat() as a missing file, so a probe that raised
PermissionError could be listed as missing with "Finish the download". As in probe_mismatches(), only
FileNotFoundError and NotADirectoryError now count as missing; any other OSError is listed apart as
"cannot read <name> (<reason>)", with advice to make the file readable. "Incomplete copy" and "Finish the
download" appear only when a file is missing or has another size.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A complete copy of another build has every file, with only the probe files at other sizes. That folder
cleared the half threshold and was told to finish a download that is complete. A download that stopped
early leaves files missing, while a probe there with another size (MicrosoftGame.Config above all) means
another package. So partial_version_message() now gives way to the "doesn't look like a supported version"
message, which lists the probe sizes, whenever a probe file is present with another size, even if other
files are missing too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:18:06 +00:00
github manually merged commit 6e15812e58 into gh-pr/723/base 2026-11-26 09:18:08 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.