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

Merged
leonida/mandy
kirigayakazima merged 1 commit from codex/glb-inspect-stream-chunks into main 2026-11-28 14:56:00 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-25 11:03:31 +00:00

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.
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 reviewed 2026-11-25 11:19:46 +00:00
lixonik left a comment
No description provided.
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

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

#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

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)

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 description provided.