glb_inspect: skip binary payloads when inspecting a model file #1744

Merged
kirigayakazima merged 1 commit from upstream-pr/1744 into main 2026-11-28 14:56:00 +00:00
kirigayakazima commented 2026-11-25 11:03:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-25T11:03:31Z.


Claimed in the coordination issue as: GLB-INSPECT-STREAM-CHUNKS

What and why

The inspector needs the JSON and the chunk table, but opening an exported model previously read the entire file into a Python bytes object. The file entry point now checks chunk headers against the actual file length and seeks over payloads. The byte-array parser and non-seekable input still work.

Tested

A guarded stream compares the report with the byte-array entry point and fails on any read of either the BIN or extension payload. A separate synthetic file with a 128 MiB BIN chunk took 134,613 peak Python-traced bytes during inspection on the local integration branch.

  • python -I tests/test_glb_inspect.py on Windows with Python 3.14.7 ran 37 tests on this branch, including one platform skip. The new regression coverage also fails against the original inspector.
  • python -I scripts/check_no_game_data.py tools/glb_inspect.py tests/test_glb_inspect.py and git diff --check passed.
  • The shared base at bcaa13da passed 6,287 semantic tests across 488 files. The change is confined to the model inspector and its tests.

GPUs tested: N/A (CPU-only metadata inspection).
AI-assisted: Yes.

Checklist

  • Based on current upstream main.
  • One topic.
  • All test inputs are synthetic. No game data, keys or decryption.
  • Translator contract table: N/A.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5490075762 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1744). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-25T11:03:31Z. --- Claimed in the coordination issue as: [GLB-INSPECT-STREAM-CHUNKS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7160388047) ### What and why The inspector needs the JSON and the chunk table, but opening an exported model previously read the entire file into a Python bytes object. The file entry point now checks chunk headers against the actual file length and seeks over payloads. The byte-array parser and non-seekable input still work. ### Tested A guarded stream compares the report with the byte-array entry point and fails on any read of either the BIN or extension payload. A separate synthetic file with a 128 MiB BIN chunk took 134,613 peak Python-traced bytes during inspection on the local integration branch. - `python -I tests/test_glb_inspect.py` on Windows with Python 3.14.7 ran 37 tests on this branch, including one platform skip. The new regression coverage also fails against the original inspector. - `python -I scripts/check_no_game_data.py tools/glb_inspect.py tests/test_glb_inspect.py` and `git diff --check` passed. - The shared base at `bcaa13da` passed 6,287 semantic tests across 488 files. The change is confined to the model inspector and its tests. GPUs tested: N/A (CPU-only metadata inspection). AI-assisted: Yes. ### Checklist - [x] Based on current upstream main. - [x] One topic. - [x] All test inputs are synthetic. No game data, keys or decryption. - Translator contract table: N/A.
lixonik commented 2026-11-25 11:19:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T11:19:46Z.

Review: COMMENTED


Independent check at "e335f0ba". Windows: 36 tests reported, 1 platform skip. I inspected a separate synthetic file with a 32 MiB BIN on the merge base and this head. The reports were equal. With tracemalloc started immediately before inspect_file(), peak traced allocations fell from 33,563,190 to 11,449 bytes.

AI-assisted review and CPU-only testing with synthetic inputs.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6056669739 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1744#pullrequestreview-6056669739). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T11:19:46Z. **Review:** COMMENTED --- Independent check at "e335f0ba". Windows: 36 tests reported, 1 platform skip. I inspected a separate synthetic file with a 32 MiB BIN on the merge base and this head. The reports were equal. With tracemalloc started immediately before inspect_file(), peak traced allocations fell from 33,563,190 to 11,449 bytes. AI-assisted review and CPU-only testing with synthetic inputs.
zmasi commented 2026-11-28 11:25:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:25:12Z.


#1744 | head e335f0baad (merged cleanly with main 4a54aedcb) | python -I tests/test_glb_inspect.py | red on main: FAILED (failures=1, skipped=6) (AssertionError: inspector read a binary payload in inspect_file) | green on PR+main: 37 tests OK (skipped=6) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited _parse_stream and seekable-stream inspect_file handling in tools/glb_inspect.py (seeking past BIN and extension chunk payloads while reading only chunk headers and the JSON chunk, with non-seekable fallback preserved). Also verified clean merge (0 conflicts) and combined execution with #1745 (39 tests OK (skipped=6)), plus tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238538878 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1744#issuecomment-7238538878). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T11:25:12Z. --- #1744 | head e335f0baada63df57908924b724f4911dc9d22fb (merged cleanly with main 4a54aedcb) | `python -I tests/test_glb_inspect.py` | red on main: `FAILED (failures=1, skipped=6)` (`AssertionError: inspector read a binary payload` in `inspect_file`) | green on PR+main: `37 tests OK (skipped=6)` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `_parse_stream` and seekable-stream `inspect_file` handling in `tools/glb_inspect.py` (seeking past `BIN` and extension chunk payloads while reading only chunk headers and the `JSON` chunk, with non-seekable fallback preserved). Also verified clean merge (`0` conflicts) and combined execution with #1745 (`39 tests OK (skipped=6)`), plus `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 14:55:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:55:57Z.


Red/green: pytest tests/test_glb_inspect.py fails on main (1 failed, 30 passed, 6 skipped, 7 subtests passed) and passes on head e335f0baad merged with main (31 passed, 6 skipped, 7 subtests passed).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241047962 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1744#issuecomment-7241047962). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T14:55:57Z. --- Red/green: `pytest tests/test_glb_inspect.py` fails on main (1 failed, 30 passed, 6 skipped, 7 subtests passed) and passes on head e335f0baada6 merged with main (31 passed, 6 skipped, 7 subtests passed). Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. 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!1744
No description provided.