Repository navigation
Conversation
pick_pair returns None for a missing or unreadable shaders/spirv/index.json and main() turns that into 'unsupported: no matching translated shader pair' exit 77. But a well-formed JSON that is not an object (list/string/null/ number) passed the load guard and reached sorted(index)/index[name], raising TypeError, exit 1. Return None when the parsed index is not a dict, matching the existing missing/unreadable handling. Four synthetic subtests, red before green after.
|
Tested 6fa29f4 on Windows 11, CPython 3.14.7, CPU only (no GPU, no game files): pass.
With the same test file on merge base AI-assisted. |
|
APPROVE. The guard at Out-of-scope nit for the same class: a non-dict entry still tracebacks - Approve. AI-assisted review, no game files, no GPU. |
|
Independent check of Environment: Windows 11, CPython 3.15.2, CPU only. Synthetic index fixtures, no GPU, no game files.
Diff is +4 lines in AI-assisted (Devin). |
|
Tested 6fa29f4 merged with main 3faac55 on Linux (WSL2, Ubuntu), CPython 3.12.16,
Negative control: with |
|
Tested
|
Claimed in the coordination issue as: new BUILD item, sandbox pick_pair non-object index
What and why
tools/sandbox.pypick_pair()chooses a translated VS/PS pair fromwork/shaders/spirv/index.json. It already degrades gracefully when the index is missing or unreadable:main()turns aNonepair intounsupported: no matching translated shader pair, exit 77. But the load guard only covers I/O and JSON syntax. A well-formed JSON whose top level is not an object (["a_vs"],"x",null,5) passes the guard and reachessorted(index)/index[name], raisingTypeError(list indices must be integers,string indices must be integers,'NoneType' object is not iterable,'int' object is not iterable).pick_pairis called atmain()line 125 outside any try/except, so it escapes as a full traceback, exit 1, before the tool is even looked up.An empty
{}or[]already returnsNone(empty loop), so the crash is specifically a non-empty non-object index. This returnsNonewhen the parsed index is not a dict, exactly like the missing/unreadable case, somain()reports the normal unsupported exit 77.Tested
Linux (CachyOS), Python 3.14.10. CPU only, no game files, no GPU; synthetic
index.jsonfixtures.python -I tests/test_sandbox_pick.py: 7 tests OK (6 existing + 1 newtest_a_non_object_index_is_no_pair_not_a_crash, 4 subtests:["a_vs"],"x",null,5, each assertingpick_pairreturnsNone).TypeError; green after with the fix.python -I tools/sandbox.py --work <synthetic> --entities e --models m --checkwithindex.json = ["a_vs"]now exits 77 (unsupported: ...), no traceback; before the fix it exited 1 withTypeError.python -m compileall -q tools/sandbox.py tests/test_sandbox_pick.py,git diff --check: clean.Note: open #4776 edits
sandbox.pyelsewhere (notpick_pair); stale #3530/#4119/#4436 are conflicting. Whichever lands second rebases.AI-assisted: yes (Tacit).
Checklist
docs/design.md, with how it was confirmed. (n/a, no translator rule)