OLD-7750: restofworld_model_join: handle straddling page-map slots, sort loose hex dirs numerically, and harden index.json load #886

Open
github-bot wants to merge 1 commit from github-bot/gh-886 into main AGit
Owner

@⁠narekshaghoyandev on GitHub · 2026-11-24 14:56 UTC · original
narekshaghoyandev:ubiq-restofworld-model-join-straddling-pagemap → main · +136 −15 · 2 files · 1 commits · open

Reopening my original upstream PR #7750 (previously verified on WSL2 Py3.12/3.14 and Debian Py3.13 by @hcampbell98 and @azterixx), cleanly rebased onto main:

  1. datResourceMap slot array straddling a 64 KiB system page boundary (_parse_page_map_header, ModelSystemPages.accept, join_streams): Validates the 16-byte header and any slot bytes already present in page 0 first so remaining declared system_pages are fetched before full parse_page_map(sys_bytes), and preserves short (< 64-byte) final system pages when slots cross out of page 0.
  2. Loose carved directory ordering & suffix case (scan_dir): Sorts hex-offset filenames numerically (fixing mixed-width / mixed-case hex names) and matches .bin/.bk2 case-insensitively.
  3. index.json BOM and deep nesting (_carve_rows): Reads index.json as utf-8-sig and turns RecursionError into a clean ValueError.

Verification

  • python3 -I tests/test_restofworld_model_join.py -v: 12/12 pass (all 3 new tests fail/error against main).
  • python3 -I scripts/check_no_game_data.py tools/restofworld_model_join.py tests/test_restofworld_model_join.py: clean.
  • python3 -m compileall -q tools/restofworld_model_join.py tests/test_restofworld_model_join.py: clean.

Claimed in the coordination issue as: OLD-7750 (#14)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-24 14:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/886) `narekshaghoyandev:ubiq-restofworld-model-join-straddling-pagemap` → `main` · +136 −15 · 2 files · 1 commits · open Reopening my original upstream PR #7750 (previously verified on WSL2 Py3.12/3.14 and Debian Py3.13 by `@hcampbell98` and `@azterixx`), cleanly rebased onto `main`: 1. **`datResourceMap` slot array straddling a 64 KiB system page boundary (`_parse_page_map_header`, `ModelSystemPages.accept`, `join_streams`)**: Validates the 16-byte header and any slot bytes already present in page 0 first so remaining declared `system_pages` are fetched before full `parse_page_map(sys_bytes)`, and preserves short (`< 64`-byte) final system pages when slots cross out of page 0. 2. **Loose carved directory ordering & suffix case (`scan_dir`)**: Sorts hex-offset filenames numerically (fixing mixed-width / mixed-case hex names) and matches `.bin`/`.bk2` case-insensitively. 3. **`index.json` BOM and deep nesting (`_carve_rows`)**: Reads `index.json` as `utf-8-sig` and turns `RecursionError` into a clean `ValueError`. ### Verification - `python3 -I tests/test_restofworld_model_join.py -v`: 12/12 pass (all 3 new tests fail/error against `main`). - `python3 -I scripts/check_no_game_data.py tools/restofworld_model_join.py tests/test_restofworld_model_join.py`: clean. - `python3 -m compileall -q tools/restofworld_model_join.py tests/test_restofworld_model_join.py`: clean. Claimed in the coordination issue as: OLD-7750 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:26:23 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 21:01 UTC · original

Reviewed e4cd0747c: I ran tests/test_restofworld_model_join.py (12/12 on the PR; the 3 new tests fail on origin/main as expected) and tests/test_carve_short_system_pages.py (11/11 on both trees; rpf9_carve shares ModelSystemPages). Probes with synthetic data: a straddling page-map slot array now joins (loose dir, sp=2/gp=1) where main rejected it, a non-zero slot in the straddled page stays rejected with the precise error, and a 50000-deep index.json exits rc=1 with "nesting is too deep" instead of the uncaught RecursionError main raises. check_no_game_data passes on both changed files. No findings. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 21:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/886#issuecomment-7174510853) Reviewed e4cd0747c: I ran tests/test_restofworld_model_join.py (12/12 on the PR; the 3 new tests fail on origin/main as expected) and tests/test_carve_short_system_pages.py (11/11 on both trees; rpf9_carve shares ModelSystemPages). Probes with synthetic data: a straddling page-map slot array now joins (loose dir, sp=2/gp=1) where main rejected it, a non-zero slot in the straddled page stays rejected with the precise error, and a 50000-deep index.json exits rc=1 with "nesting is too deep" instead of the uncaught RecursionError main raises. check_no_game_data passes on both changed files. No findings. AI-assisted review. **Recommendation:** Merge
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/886/head:github-bot/gh-886'
git switch 'github-bot/gh-886'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-886'
git switch 'github-bot/gh-886'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-886'
git switch 'github-bot/gh-886'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-886'
git switch 'main'
git merge --squash 'github-bot/gh-886'
git switch 'main'
git merge --ff-only 'github-bot/gh-886'
git switch 'main'
git merge 'github-bot/gh-886'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.