world_atlas_accel: validate inputs, contiguous packed_cells, and native output bounds/finiteness #1689
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1689"
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-25T08:17:19Z.
Item ID:
WORLD-ATLAS-ACCEL-BOUNDS-AND-FALLBACK(claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156815392)Summary
tools/world_atlas_accel.py):cells, non-finite orboolmargin, and invalidordersequences (wrong length, out-of-range/negative indices, orboolentries) by returningNonebefore loading or invoking the native library.packed_cellsis C-contiguous and aligned vianp.require(_pack(np, cells)[order], requirements=("C", "A"))before passing its raw pointer toctypes.order[row.clear]/order[row.placed], validate thatrow.clearandrow.placedare-1or in0 .. len(order)-1, and thatrow.overlapis finite wheneverrow.placed >= 0, falling back cleanly (return None) to the Python reference instead of crashing withIndexErroror propagating corrupt indices /NaNoverlaps.tests/test_world_grid_atlas_native.py):margin/orderinputs (verifying_load()is never called) and corrupt native output rows (clear/placedout-of-bounds or< -1, non-finiteoverlap, and end-to-endmatch_mask()fallback).Checklist & Verification
python3 -I scripts/check_no_game_data.py tools/world_atlas_accel.py tests/test_world_grid_atlas_native.pypassed)python3 -W error -I tests/test_world_grid_atlas_native.py -v:Ran 9 tests ... OK (skipped=4)FallbackTestagainst unpatchedmaintools/world_atlas_accel.py):Ran 5 tests ... FAILED (failures=11, errors=3)python3 -m compileall -q make_game.py tools tests: passedpython3 -I tests/test_text_write_line_endings.py:Ran 3 tests ... OKImported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T08:17:33Z.
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 zmasi on 2026-11-28T11:25:08Z.
#1689 | head
f5ef8d0dfa(merged cleanly with main4a54aedcb) |python tests/test_world_grid_atlas_native.py| red on main:FAILED (failures=11, errors=3, skipped=4)(_loadinvoked onNaN/inf/boolmargins and malformedorder, and out-of-boundsclear/placedindices or non-finiteoverlapvalues accepted without falling back) | green on PR+main:9 tests OK (skipped=4)| Windows 11, Python 3.12, NumPy 2.5.1 | AI-assisted: yesAudited
cells.ndim == 3,marginfiniteness/non-bool,orderlength/index/non-boolbounds,np.require(..., requirements=("C", "A"))contiguous aligned cell staging, and post-callrow.clear/row.placed/row.overlapbounds & finiteness checks intools/world_atlas_accel.py. Also verified isolatedpython -I tests/test_world_grid_atlas_native.py(9 skippedcleanly without NumPy),tests/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 TheGeogeo on 2026-11-28T23:38:30Z.
Tested
f5ef8d0dfmerged (no commit) withmainaa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_world_grid_atlas_native.py, 9 tests pass. 4 are skipped, as onmain.tools/world_atlas_accel.pyback tomain, 11 failures and 3 errors (must not load).No blocker from my side.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T23:50:46Z.
Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto
main3dee9a5c2without conflict, and its test file(s) (tests/test_world_grid_atlas_native.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.