OLD-7536: navmesh_nodes: bound tally_tile grid insertion to occupied node cells #870

Open
github-bot wants to merge 1 commit from github-bot/gh-870 into main AGit
Owner

@⁠narekshaghoyandev on GitHub · 2026-11-24 14:51 UTC · original
narekshaghoyandev:ubiq-navmesh-nodes-bounded-grid-cells → main · +28 −3 · 2 files · 1 commits · open

Reopening my original upstream PR #7536 (previously approved by @leoleahy, verified bit-exact across all 63,806 retail nodes and 27,644 retail navmesh resources by @Kev-Ball, plus 300-tile differential equivalence by @senyurah and Windows verification by @rideinstead), cleanly rebased onto main:

  • Bound tally_tile grid insertion to occupied node cells: Previously tally_tile inserted every polygon into every (gx, gy) cell across its full [floor(min_x/CELL)..floor(max_x/CELL)] x [floor(min_y/CELL)..floor(max_y/CELL)] bounding box, allowing a single crafted tile with large finite ext (e.g. 1e10) to hang/OOM Python. Since polygon_under only ever queries the cells occupied by mine nodes, inserting only into (gx, gy) cells that actually hold a node in mine produces 100% identical tallies in bounded time and memory.

Verification

  • python3 -I tests/test_navmesh_nodes.py -v: 18/18 pass in 0.66s (negative control on main hangs/OOMs on test_huge_finite_extent_does_not_exhaust_grid_memory).
  • python3 -I scripts/check_no_game_data.py tools/navmesh_nodes.py tests/test_navmesh_nodes.py: clean.
  • python3 -m compileall -q tools/navmesh_nodes.py tests/test_navmesh_nodes.py: clean.

Claimed in the coordination issue as: OLD-7536 (#14)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-24 14:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/870) `narekshaghoyandev:ubiq-navmesh-nodes-bounded-grid-cells` → `main` · +28 −3 · 2 files · 1 commits · open Reopening my original upstream PR #7536 (previously approved by `@leoleahy`, verified bit-exact across all 63,806 retail nodes and 27,644 retail navmesh resources by `@Kev-Ball`, plus 300-tile differential equivalence by `@senyurah` and Windows verification by `@rideinstead`), cleanly rebased onto `main`: - **Bound `tally_tile` grid insertion to occupied node cells**: Previously `tally_tile` inserted every polygon into every `(gx, gy)` cell across its full `[floor(min_x/CELL)..floor(max_x/CELL)] x [floor(min_y/CELL)..floor(max_y/CELL)]` bounding box, allowing a single crafted tile with large finite `ext` (e.g. `1e10`) to hang/OOM Python. Since `polygon_under` only ever queries the cells occupied by `mine` nodes, inserting only into `(gx, gy)` cells that actually hold a node in `mine` produces 100% identical tallies in bounded time and memory. ### Verification - `python3 -I tests/test_navmesh_nodes.py -v`: 18/18 pass in 0.66s (negative control on `main` hangs/OOMs on `test_huge_finite_extent_does_not_exhaust_grid_memory`). - `python3 -I scripts/check_no_game_data.py tools/navmesh_nodes.py tests/test_navmesh_nodes.py`: clean. - `python3 -m compileall -q tools/navmesh_nodes.py tests/test_navmesh_nodes.py`: clean. Claimed in the coordination issue as: OLD-7536 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:32 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:55 UTC · original · approved these changes

Audited and verified. Bounds polygon grid insertion in ools/navmesh_nodes.py:tally_tile to
eeded_cells occupied by nodes in the tile, switching iteration strategies based on bounding box cardinality to prevent out-of-memory loops on corrupt tiles with large float extents. Unit tests in ests/test_navmesh_nodes.py pass cleanly. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/870#pullrequestreview-6041595289) · **approved these changes** Audited and verified. Bounds polygon grid insertion in ools/navmesh_nodes.py:tally_tile to eeded_cells occupied by nodes in the tile, switching iteration strategies based on bounding box cardinality to prevent out-of-memory loops on corrupt tiles with large float extents. Unit tests in ests/test_navmesh_nodes.py pass cleanly. Approved.
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-25 03:57 UTC · original · approved these changes

Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Only cells occupied by this tile's nodes are ever queried, so inserting into those alone keeps the same lookups while a damaged tile with a huge finite extent no longer tries to build billions of grid entries.

AI-assisted (Claude).

**@⁠tiguan26** on GitHub · 2026-11-25 03:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/870#pullrequestreview-6051647861) · **approved these changes** Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Only cells occupied by this tile's nodes are ever queried, so inserting into those alone keeps the same lookups while a damaged tile with a huge finite extent no longer tries to build billions of grid entries. AI-assisted (Claude).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/870/head:github-bot/gh-870'
git switch 'github-bot/gh-870'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-870'
git switch 'github-bot/gh-870'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-870'
git switch 'github-bot/gh-870'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-870'
git switch 'main'
git merge --squash 'github-bot/gh-870'
git switch 'main'
git merge --ff-only 'github-bot/gh-870'
git switch 'main'
git merge 'github-bot/gh-870'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.