glb_inspect: show the default scene and named root nodes #1746

Merged
kirigayakazima merged 3 commits from upstream-pr/1746 into main 2026-11-29 03:37:38 +00:00
kirigayakazima commented 2026-11-25 11:04:03 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as: GLB-INSPECT-SCENE-ROOTS

What and why

The scene count alone does not show which scene a viewer opens or which roots it contains. Both report formats now give the declared default and each scene's ordered root indices and names. Broken references are reported alongside their scene. An omitted default stays unspecified. glTF scene schema

Tested

Two synthetic tests cover an omitted and nonzero default scene, declared root order, node names, absent and empty root arrays, duplicate roots and references to missing or non-object entries.

  • python -I tests/test_glb_inspect.py on Windows with Python 3.14.7 ran 38 tests on this branch with one platform skip. The new tests also failed 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.

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:5490084222 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1746). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-25T11:04:03Z. --- Claimed in the coordination issue as: [GLB-INSPECT-SCENE-ROOTS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7160388047) ### What and why The scene count alone does not show which scene a viewer opens or which roots it contains. Both report formats now give the declared default and each scene's ordered root indices and names. Broken references are reported alongside their scene. An omitted default stays unspecified. [glTF scene schema](https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/schema/scene.schema.json) ### Tested Two synthetic tests cover an omitted and nonzero default scene, declared root order, node names, absent and empty root arrays, duplicate roots and references to missing or non-object entries. - `python -I tests/test_glb_inspect.py` on Windows with Python 3.14.7 ran 38 tests on this branch with one platform skip. The new tests also failed 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. 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:50 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Independent check at "08bbbaef". Windows: 37 tests reported, 1 platform skip. The new default-scene and repeated-reference coverage passes. A separate GLB exposed a hierarchy case that is still reported as a valid root. Details inline.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6056670706 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1746#pullrequestreview-6056670706). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T11:19:50Z. **Review:** COMMENTED --- Independent check at "08bbbaef". Windows: 37 tests reported, 1 platform skip. The new default-scene and repeated-reference coverage passes. A separate GLB exposed a hierarchy case that is still reported as a valid root. Details inline. AI-assisted review and CPU-only testing with synthetic inputs.
lixonik commented 2026-11-25 11:19:50 +00:00 (Migrated from github.com)

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

Code review location: tools/glb_inspect.py; line 117

@@ -106,6 +106,24 @@ def _text(value: object) -> str | None:
     return value if isinstance(value, str) and value else None
 
 
+def _scene_report(gltf: dict, index: int, scene: dict) -> dict:
+    roots = []
+    issues = []
+    seen = set()
+    if "nodes" in scene and not _array(scene["nodes"]):
+        issues.append("nodes must be a non-empty array when present")
+    for slot, ref in enumerate(_array(scene.get("nodes"))):
+        node = _entry(gltf, "nodes", ref)
+        roots.append({"node": _index(ref), "name": _text(node.get("name")) if node is not None else None})

This checks whether the referenced node exists but still reports a child as a valid scene root. With nodes: [{"children":[1]},{"name":"child"}] and scenes: [{"nodes":[1]}], the JSON shows node 1 under roots with an empty issues list. Could the inspector check root indices against the valid indices found in node children? glTF requires scene root nodes to have no parent. glTF 2.0 scene specification

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4694121337 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1746#discussion_r4694121337). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T11:19:50Z. **Code review location:** `tools/glb_inspect.py`; line 117 ~~~~diff @@ -106,6 +106,24 @@ def _text(value: object) -> str | None: return value if isinstance(value, str) and value else None +def _scene_report(gltf: dict, index: int, scene: dict) -> dict: + roots = [] + issues = [] + seen = set() + if "nodes" in scene and not _array(scene["nodes"]): + issues.append("nodes must be a non-empty array when present") + for slot, ref in enumerate(_array(scene.get("nodes"))): + node = _entry(gltf, "nodes", ref) + roots.append({"node": _index(ref), "name": _text(node.get("name")) if node is not None else None}) ~~~~ --- This checks whether the referenced node exists but still reports a child as a valid scene root. With `nodes: [{"children":[1]},{"name":"child"}]` and `scenes: [{"nodes":[1]}]`, the JSON shows node 1 under roots with an empty issues list. Could the inspector check root indices against the valid indices found in node children? glTF requires scene root nodes to have no parent. [glTF 2.0 scene specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#scenes)
kirigayakazima commented 2026-11-27 12:11:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-27T12:11:40Z.

Code review location: tools/glb_inspect.py; line 117

@@ -106,6 +106,24 @@ def _text(value: object) -> str | None:
     return value if isinstance(value, str) and value else None
 
 
+def _scene_report(gltf: dict, index: int, scene: dict) -> dict:
+    roots = []
+    issues = []
+    seen = set()
+    if "nodes" in scene and not _array(scene["nodes"]):
+        issues.append("nodes must be a non-empty array when present")
+    for slot, ref in enumerate(_array(scene.get("nodes"))):
+        node = _entry(gltf, "nodes", ref)
+        roots.append({"node": _index(ref), "name": _text(node.get("name")) if node is not None else None})

Fixed: _scene_report() now collects valid child indices from nodes[*].children and reports an issue whenever a scene root references a child node. Added regression test in tests/test_glb_inspect.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4719209591 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1746#discussion_r4719209591). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-27T12:11:40Z. **Code review location:** `tools/glb_inspect.py`; line 117 ~~~~diff @@ -106,6 +106,24 @@ def _text(value: object) -> str | None: return value if isinstance(value, str) and value else None +def _scene_report(gltf: dict, index: int, scene: dict) -> dict: + roots = [] + issues = [] + seen = set() + if "nodes" in scene and not _array(scene["nodes"]): + issues.append("nodes must be a non-empty array when present") + for slot, ref in enumerate(_array(scene.get("nodes"))): + node = _entry(gltf, "nodes", ref) + roots.append({"node": _index(ref), "name": _text(node.get("name")) if node is not None else None}) ~~~~ --- Fixed: `_scene_report()` now collects valid child indices from `nodes[*].children` and reports an issue whenever a scene root references a child node. Added regression test in `tests/test_glb_inspect.py`.
lixonik commented 2026-11-27 15:50:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T15:50:23Z.

Review: COMMENTED


Re-verified at 31868654b (merged cleanly onto main ec91d695c).

  • Confirmed the prior finding is resolved: _scene_report() collects valid node indices from nodes[*].children, flags child nodes referenced as scene roots, and ignores boolean values in children via _entry().
  • Windows 11, Python 3.12: python -I -B tests/test_glb_inspect.py -v passed (38 tests, 1 expected Windows POSIX-permission skip); scripts/check_no_game_data.py and git diff --check clean.
  • No remaining findings.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6090597271 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1746#pullrequestreview-6090597271). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-27T15:50:23Z. **Review:** COMMENTED --- Re-verified at `31868654b` (merged cleanly onto `main` `ec91d695c`). - Confirmed the prior finding is resolved: `_scene_report()` collects valid node indices from `nodes[*].children`, flags child nodes referenced as scene roots, and ignores boolean values in `children` via `_entry()`. - Windows 11, Python 3.12: `python -I -B tests/test_glb_inspect.py -v` passed (38 tests, 1 expected Windows POSIX-permission skip); `scripts/check_no_game_data.py` and `git diff --check` clean. - No remaining findings. AI-assisted.
zmasi commented 2026-11-28 11:38:14 +00:00 (Migrated from github.com)

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


#1746 | head 31868654bc (merged cleanly with main 4a54aedcb) | python -I tests/test_glb_inspect.py | red on main: FAILED (errors=3, skipped=6) (KeyError on scene_issue, default_scene, and scenes) | green on PR+main: 39 tests OK (skipped=6) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited _scene_report, build_report, and format_report in tools/glb_inspect.py (preserving root node order, reporting default_scene and scene_issue, counting non-object scenes entries in invalid_counts, and flagging empty nodes arrays, invalid/duplicate root references, and child nodes listed as scene roots). Also verified clean merge (0 conflicts) and combined execution with #1747 (40 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:7238682790 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1746#issuecomment-7238682790). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T11:38:14Z. --- #1746 | head 31868654bc16d8d91da491c4fc3b7038fa95e1d5 (merged cleanly with main 4a54aedcb) | `python -I tests/test_glb_inspect.py` | red on main: `FAILED (errors=3, skipped=6)` (`KeyError` on `scene_issue`, `default_scene`, and `scenes`) | green on PR+main: `39 tests OK (skipped=6)` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `_scene_report`, `build_report`, and `format_report` in `tools/glb_inspect.py` (preserving root node order, reporting `default_scene` and `scene_issue`, counting non-object `scenes` entries in `invalid_counts`, and flagging empty `nodes` arrays, invalid/duplicate root references, and child nodes listed as scene roots). Also verified clean merge (`0` conflicts) and combined execution with #1747 (`40 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`.
OreoFR commented 2026-11-29 03:13:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T03:13:58Z.


Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7b6, PR head f0f0c11b2 : red 3 errors / green 48 OK

python3.12 -I tests/test_glb_inspect.py (48 tests):

  • Merge: clean (git merge-tree).
  • Red (main + only this PR's test file): 3 errors, KeyError: 'scenes': test_scene_inventory_preserves_root_order_and_default, test_scene_inventory_identifies_invalid_references, test_scene_root_rejects_child_node.
  • Green (main + git merge --no-ff): 48 tests OK, 1 skipped (Windows write protection).
  • (MEASURED n=3) the 3 red errors reproduce 3/3.
  • Neighbours, same on main and merge: test_batch_glb 20/20 OK, test_report_paths 26 OK (1 skipped, Windows-only).
  • Diff: adds a scene inventory (default scene, ordered roots, invalid references, repeated roots, child nodes used as roots), with invalid scenes counted in invalid_counts; the text report gains a scenes: section without breaking neighbours. Nit: 2 blank lines inside the class before test_scene_root_rejects_child_node. No game data.

Verdict: READY

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249922021 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1746#issuecomment-7249922021). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T03:13:58Z. --- Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7b6, PR head f0f0c11b2 : red 3 errors / green 48 OK `python3.12 -I tests/test_glb_inspect.py` (48 tests): - Merge: clean (`git merge-tree`). - **Red** (main + only this PR's test file): 3 errors, `KeyError: 'scenes'`: `test_scene_inventory_preserves_root_order_and_default`, `test_scene_inventory_identifies_invalid_references`, `test_scene_root_rejects_child_node`. - **Green** (main + `git merge --no-ff`): 48 tests OK, 1 skipped (Windows write protection). - (MEASURED n=3) the 3 red errors reproduce 3/3. - Neighbours, same on main and merge: `test_batch_glb` 20/20 OK, `test_report_paths` 26 OK (1 skipped, Windows-only). - Diff: adds a scene inventory (default scene, ordered roots, invalid references, repeated roots, child nodes used as roots), with invalid scenes counted in `invalid_counts`; the text report gains a `scenes:` section without breaking neighbours. Nit: 2 blank lines inside the class before `test_scene_root_rejects_child_node`. No game data. **Verdict: READY** AI-assisted: Claude Code
DadaCap commented 2026-11-29 03:37:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T03:37:35Z.


Merging, thank you @kirigayakazima! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/1746#issuecomment-7249922021), and it still merges cleanly.

AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250161903 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1746#issuecomment-7250161903). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-29T03:37:35Z. --- Merging, thank you @kirigayakazima! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/1746#issuecomment-7249922021), and it still merges cleanly. AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.
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!1746
No description provided.