bvh_geometry_check: catch NaN leaf bounds, infinite-bound override tolerance blow-up, invalid --geom, and strict JSON (BVH-GEOMETRY-CHECK-NAN-INF-GEOM) #1429
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1429"
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 IlyassRS3 on 2026-11-25T00:06:19Z.
Item ID:
BVH-GEOMETRY-CHECK-NAN-INF-GEOMAI-assisted: yes
Summary
Fixes four soundness and input-validation bugs in
tools/bvh_geometry_check.py:NaN/±inf) leaf and scene bounds silently passedcheck_bounds():NaNbounds,max([box[a] - b[a], ...]) > OUTSIDE_TOLERANCE * extentevaluated toFalse, and Python'smin(union[a], NaN)/max(union[a + 3], NaN)droppedNaNonce another finite leaf populatedunion— falsely reportingleaves_outside=0, bounds_gap=0.0, consistent=True.check_bounds()now rejects non-finite mappedsceneBoundscorners and counts any leaf with non-finite bounds as outside (settingbounds_gap = math.inf,consistent = False).check_overrides()tolerance blew up to+infon infinite child bounds:if math.isfinite(value)without checkingmath.isfinite(b[comp]). When a child bound was±inf(e.g. a BOX16 bound overflowing half-float range) and the stored overridevaluewas finite,tolbecame+inf, turninglo - tol <= value <= hi + tolinto-inf <= value <= +infand accepting overrides wildly outside[lo, hi]._ulp_tol(value, ref)so each bound comparison (b[comp],lo,hi) applies ULP tolerance only when both operands are finite.--geom VB[,IB]validation and early--jsondirectory check:--geomspecs (len(parts) > 2or empty VB path such as--geom vb,ib,extra,--geom ,ib,--geom "") with exit status 2 instead of silently dropping extra tokens or opening"".--json <existing_dir>before reading/rehydrating.--jsonoutput (allow_nan=False):bounds_gap = infon inconsistent non-finite inputs) are serialized as JSONnullwithallow_nan=Falserather than emitting non-standardNaN/Infinitytokens.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/bvh_geometry_check.py tests/test_bvh_geometry_check.py— OKpython3 -I tests/test_bvh_geometry_check.py -v— 12/12 OK (5 new regression tests)tests/test_bvh_*.pysuites — 214/214 OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I tests/test_ci_registration.py— 16/16 OKtests/test_bvh_geometry_check.pyagainst unpatchedupstream/main1154976d4):Ran 12 tests — FAILED (failures=5)— all 5 new regression tests fail without this fix.Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T00:06:30Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T00:20:59Z.
Tested
e5f742680on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain364ab4eab(Python tool only, no GPU):python3 -I tests/test_bvh_geometry_check.py: 12/12 OK at this head (synthetic BVH inputs, no game data).mainfails 5 of 12:test_nan_leaf_bounds_fails_consistency_even_when_other_leaf_covers_bounds,test_nonfinite_scene_bounds_fails_consistency,test_infinite_child_bound_does_not_bypass_override_range_check,test_invalid_geom_spec_and_json_directory_rejected,test_json_report_strict_rfc8259_with_nonfinite_gap— each of the claimed areas has a failing test onmain.AI-assisted; synthetic fixtures only, no game data.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T17:56:30Z.
Red/green: tests/test_bvh_geometry_check.py fails 5 assertions on main (NaN leaf bounds, non-finite scene bounds, infinite override tolerance, invalid --geom/--json dir, strict JSON) and passes with the PR.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
cb7a239ccin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)