OLD-7263: restore old upstream PR 7263 - gamedata_blobs: Region 1's lowest cell offset decides where Region 3 starts #714

Merged
aslan2142 merged 1 commit from upstream-pr/714 into main 2026-11-25 22:24:22 +00:00
aslan2142 commented 2026-11-24 12:45:10 +00:00 (Migrated from github.com)

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


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

Restoration of my original pull request, old upstream PR 7263 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 21625bca8c; the commit applied without conflicts and the code is unchanged; only the commit message changed, citing the old finding's number as plain text.

What and why

  • parse_spatial_grid_blob found Region 3 as the trailing run of 4-byte-aligned words below the blob size.
  • When the last word or words of Region 2 happen to look like such an offset, the run took them in. Region 3 then started too early, and a valid grid was rejected with "Region 3 start ... does not match lowest cell offset ..." or "Region 3 offset leaves Region 2 bounds".
  • docs/gamedata.md locates Region 3 as the trailing run matching min(cell_offs). The run is now only the search range. Region 3 starts at the lowest start in it where Region 1 (which ends at the lowest Region 3 word) has that start as its lowest cell offset.
  • Blobs that main accepts parse the same. If no start agrees, the existing checks still reject the blob.
  • Finding and repro by cynbun in the old repository.

Tested

Linux, Python 3.14, CPU only, synthetic blobs built in the test (no game files):

  • python -I tests/test_gamedata_blobs.py: on main with only this PR's test changes, 4 of 10 tests error (three colliding-word subtests and the multi-word Region 2 tail). On this branch, all 10 pass.
  • New tests cover the finding's repro with several colliding last words, a run of three colliding Region 2 words, truncated blobs, and a skipped first Region 3 word that has no consistent split.
  • python -m compileall -q tools tests, git diff --check and python -I scripts/check_no_game_data.py on the changed files: clean.

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:5472396459 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/714). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T12:45:10Z. --- Claimed in the coordination issue as: OLD-7263 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131834439 Restoration of my original pull request, old upstream PR 7263 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 21625bca8c675c62f9dbffc318ce6a59d57faf31; the commit applied without conflicts and the code is unchanged; only the commit message changed, citing the old finding's number as plain text. ### What and why - `parse_spatial_grid_blob` found Region 3 as the trailing run of 4-byte-aligned words below the blob size. - When the last word or words of Region 2 happen to look like such an offset, the run took them in. Region 3 then started too early, and a valid grid was rejected with "Region 3 start ... does not match lowest cell offset ..." or "Region 3 offset leaves Region 2 bounds". - `docs/gamedata.md` locates Region 3 as the trailing run matching `min(cell_offs)`. The run is now only the search range. Region 3 starts at the lowest start in it where Region 1 (which ends at the lowest Region 3 word) has that start as its lowest cell offset. - Blobs that main accepts parse the same. If no start agrees, the existing checks still reject the blob. - Finding and repro by cynbun in the old repository. ### Tested Linux, Python 3.14, CPU only, synthetic blobs built in the test (no game files): - `python -I tests/test_gamedata_blobs.py`: on main with only this PR's test changes, 4 of 10 tests error (three colliding-word subtests and the multi-word Region 2 tail). On this branch, all 10 pass. - New tests cover the finding's repro with several colliding last words, a run of three colliding Region 2 words, truncated blobs, and a skipped first Region 3 word that has no consistent split. - `python -m compileall -q tools tests`, `git diff --check` and `python -I scripts/check_no_game_data.py` on the changed files: clean. 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).
aslan2142 commented 2026-11-25 22:24:24 +00:00 (Migrated from github.com)

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


Merged: gamedata_blobs: Region 1's lowest cell offset decides where Region 3 starts.

  • Changed since review: Nothing. It merges cleanly with main, and no review point is open.
  • Tested: tests/test_gamedata_blobs.py passes on main + this head (Linux, CPython 3.14).
  • Checked on main eaa3792fd + 15f30f0a9: the semantic suite passes (492 files, 6,315 tests, 0 files failed); test_gamedata_blobs 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:7176322089 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/714#issuecomment-7176322089). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T22:24:24Z. --- Merged: `gamedata_blobs`: Region 1's lowest cell offset decides where Region 3 starts. - **Changed since review:** Nothing. It merges cleanly with `main`, and no review point is open. - **Tested:** `tests/test_gamedata_blobs.py` passes on `main` + this head (Linux, CPython 3.14). - **Checked on `main` `eaa3792fd` + `15f30f0a9`:** the semantic suite passes (492 files, 6,315 tests, 0 files failed); `test_gamedata_blobs` 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!714
No description provided.