glb_inspect: skip binary payloads when inspecting a model file #1744
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1744"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.pyon 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.pyandgit diff --checkpassed.bcaa13dapassed 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
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.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:25:12Z.
#1744 | head
e335f0baad(merged cleanly with main4a54aedcb) |python -I tests/test_glb_inspect.py| red on main:FAILED (failures=1, skipped=6)(AssertionError: inspector read a binary payloadininspect_file) | green on PR+main:37 tests OK (skipped=6)| Windows 11, Python 3.12.10 | AI-assisted: yesAudited
_parse_streamand seekable-streaminspect_filehandling intools/glb_inspect.py(seeking pastBINand extension chunk payloads while reading only chunk headers and theJSONchunk, with non-seekable fallback preserved). Also verified clean merge (0conflicts) and combined execution with #1745 (39 tests OK (skipped=6)), plustests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK), andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:55:57Z.
Red/green:
pytest tests/test_glb_inspect.pyfails on main (1 failed, 30 passed, 6 skipped, 7 subtests passed) and passes on heade335f0baadmerged 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
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)