[PR #723] [MERGED] 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 #760

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

📋 Pull Request Information

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

Base: main ← Head: build2835-partial-version-match


📝 Commits (3)

  • bd9a092 make_game: an incomplete copy is named as a partial match of its version, with what is missing (BUILD-2835)
  • 6e673f5 make_game: a file whose metadata can't be read is not reported as missing (BUILD-2835 review)
  • 6e15812 make_game: a probe file there with another size keeps the unsupported-version message (BUILD-2835 review)

📊 Changes

2 files changed (+193 additions, -1 deletions)

View changed files

📝 make_game.py (+65 -1)
📝 tests/test_make_game_preflight.py (+128 -0)

📄 Description

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


🔄 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/723 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `build2835-partial-version-match` --- ### 📝 Commits (3) - [`bd9a092`](https://github.com/ubiquitarianism/leonida/commit/bd9a092a7fad6ee97213950a87326aa8c1cb82b3) make_game: an incomplete copy is named as a partial match of its version, with what is missing (BUILD-2835) - [`6e673f5`](https://github.com/ubiquitarianism/leonida/commit/6e673f5c7ae081be1e9194f11d184bf55f0214b1) make_game: a file whose metadata can't be read is not reported as missing (BUILD-2835 review) - [`6e15812`](https://github.com/ubiquitarianism/leonida/commit/6e15812e580d0a0454aead9c05a24c5d7e748960) make_game: a probe file there with another size keeps the unsupported-version message (BUILD-2835 review) ### 📊 Changes **2 files changed** (+193 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+65 -1) 📝 `tests/test_make_game_preflight.py` (+128 -0) </details> ### 📄 Description 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:57 +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#760
No description provided.