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

Open
opened 2026-11-26 20:19:30 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/886
Author: @narekshaghoyandev
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: ubiq-restofworld-model-join-straddling-pagemap


📝 Commits (1)

  • e4cd074 restofworld_model_join: handle straddling page-map slots, sort loose hex dirs numerically, and harden index.json load

📊 Changes

2 files changed (+136 additions, -15 deletions)

View changed files

📝 tests/test_restofworld_model_join.py (+92 -0)
📝 tools/restofworld_model_join.py (+44 -15)

📄 Description

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://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135175513)
AI-assisted: yes (Gemini)


🔄 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/886 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-restofworld-model-join-straddling-pagemap` --- ### 📝 Commits (1) - [`e4cd074`](https://github.com/ubiquitarianism/leonida/commit/e4cd0747c22350cdf1e03287b7bbfba60c0e78dd) restofworld_model_join: handle straddling page-map slots, sort loose hex dirs numerically, and harden index.json load ### 📊 Changes **2 files changed** (+136 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_restofworld_model_join.py` (+92 -0) 📝 `tools/restofworld_model_join.py` (+44 -15) </details> ### 📄 Description 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://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135175513) AI-assisted: yes (Gemini) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#924
No description provided.