glb_skinning: fix partial-axis NaN bbox, leading-zero sets, zero-count offset, normalized IBM, and atomic JSON write (GLB-SKINNING-BBOX-VALIDATION-ATOMIC) #1433
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1433
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/glb-skinning-bbox-validation-atomic"
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?
Pull request successfully merged and closed
Item ID:
GLB-SKINNING-BBOX-VALIDATION-ATOMICAI-assisted: yes
Summary
Fixes five bugs in
tools/glb_skinning.py:POSITIONcrashedwrite_json(..., allow_nan=False):_bbox()only checked whether any scalar component across all three axes was finite (if not finite:). When one axis had onlyNaN/±infvalues while the other axes were finite,_bbox()returned[inf, ...]/[-inf, ...], causingjson.dumps(..., allow_nan=False)inwrite_json()to raiseValueError._bbox()now tracks finite values per axis and returns(None, None, non_finite)unless all three axes have finite values.JOINTS_00,WEIGHTS_01):ATTRIBUTE_REmatched(\d+), collapsingJOINTS_00into set0(either silently ignored whenJOINTS_0existed, or producing misleading missing-pair errors).ATTRIBUTE_REnow matches canonical0|[1-9]\d*per glTF 2.0 §3.7.2.1, and leading-zero keys emit an explicit validation error.count == 0accessor skippedbyteOffset > view_lengthbounds check:_Reader.read()only checkedbufferViewbounds insideif count:, accepting out-of-rangebyteOffsetvalues on zero-count accessors.inverseBindMatricesnot rejected:_validate_skins()now rejectsnormalized: trueoninverseBindMatrices(consistent with glTF 2.0 §3.6.2.2 and the existingFLOATweight / joint checks).write_json()publishing and early--jsondirectory rejection:write_json()now resolves symlinks, rejects symlink cycles (ELOOP) and existing directories (IsADirectoryError), and stages writes viatempfile.NamedTemporaryFile+file_mode.published_mode+os.replacewith cleanup on failure so existing reports are never truncated on write errors.main()rejects--json <dir>before reading the GLB.Verification (macOS Apple M5, arm64, Python 3.14; no game files)
python3 -m compileall -q make_game.py tools tests— OKpython3 -I scripts/check_no_game_data.py tools/glb_skinning.py tests/test_glb_skinning.py— OKpython3 -I tests/test_glb_skinning.py -v— 32/32 OK (6 new regression tests)python3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I tests/test_ci_registration.py— 16/16 OKtests/test_glb_skinning.pyagainst unpatchedupstream/main1154976d4):Ran 32 tests — FAILED (failures=5)— catches partial-axis[inf, 0.0, 0.0]bbox, leading-zeroJOINTS_00, zero-countbyteOffsetpastbufferView, normalizedinverseBindMatrices, and non-atomicwrite_json.Red/green: the PR's tests fail on main 4938673 and pass on head 0b736f998608 (Linux, Python 3.13.18).
Targeted batch of 11 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)