OLD-9905: navmesh: rule out stream lengths as the 4 KiB boundary selector (ASSET-445) #1763

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

@⁠potatoe0100 on GitHub · 2026-11-25 11:37 UTC · original
potatoe0100:carry/old-9905 → main · +30 −8 · 3 files · 1 commits · open

Claimed in the coordination issue as: OLD-9905 (#1608)

What and why

Carries on old PR 9905 by @⁠cdomergue (draft #170, branch old-pr/9905, listed in #17), rebased on current main with the author's commit kept.

docs/navmesh.md left open what decides u16@0x4e (stored pg or zero) on the 307 two-stream pages whose runtime data ends exactly on Stream 0's last 4 KiB boundary. The author's measurement rules out the obvious candidates: the ordered pair of inflated stream lengths, the 24-byte block map, and the distance from data_end to the end of Stream 0 all give both values. The doc now says so, with the steps to repeat it. tools/navmesh_decode.py --csv gains two columns, first_stream_bytes and runtime_data_end (the latter only when the block map check passes), which the repeat steps use; tests/test_navmesh_decode.py checks them. The selection rule stays open.

Tested

  • python -I tests/test_navmesh_decode.py: 17 tests OK. The other tests/test_navmesh*.py and all tests/test_docs*.py pass (two navmesh tests skip without game files).
  • python -m compileall -q make_game.py tools tests: clean. Python 3.13, Linux.
  • The page counts in the doc are the author's (from their own copy); not re-measured here, as there are no game files on this machine.

GPUs tested: n/a (no GPU code)

AI-assisted: yes (Claude rebased and tested; the original commit says AI-assisted too)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠potatoe0100** on GitHub · 2026-11-25 11:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1763) `potatoe0100:carry/old-9905` → `main` · +30 −8 · 3 files · 1 commits · open Claimed in the coordination issue as: OLD-9905 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Carries on old PR 9905 by @⁠cdomergue (draft #170, branch `old-pr/9905`, listed in #17), rebased on current `main` with the author's commit kept. `docs/navmesh.md` left open what decides `u16@0x4e` (stored `pg` or zero) on the 307 two-stream pages whose runtime data ends exactly on Stream 0's last 4 KiB boundary. The author's measurement rules out the obvious candidates: the ordered pair of inflated stream lengths, the 24-byte block map, and the distance from `data_end` to the end of Stream 0 all give both values. The doc now says so, with the steps to repeat it. `tools/navmesh_decode.py --csv` gains two columns, `first_stream_bytes` and `runtime_data_end` (the latter only when the block map check passes), which the repeat steps use; `tests/test_navmesh_decode.py` checks them. The selection rule stays open. ### Tested - `python -I tests/test_navmesh_decode.py`: 17 tests OK. The other `tests/test_navmesh*.py` and all `tests/test_docs*.py` pass (two navmesh tests skip without game files). - `python -m compileall -q make_game.py tools tests`: clean. Python 3.13, Linux. - The page counts in the doc are the author's (from their own copy); not re-measured here, as there are no game files on this machine. GPUs tested: n/a (no GPU code) AI-assisted: yes (Claude rebased and tested; the original commit says AI-assisted too) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:04:06 +00:00
Author
Owner

@⁠klikso on GitHub · 2026-11-25 16:37 UTC · original

Re-measured on a second copy, as the description says the page counts had not been: my own 1.0.2.1 (navmeshes.rpf), this branch at 04f3f5094, Windows 11, Python 3.13. I ran python -I tools/navmesh_decode.py navmeshes.rpf --csv pages.csv (2 min 13 s; 9,603 0drp resources, all complete) and followed the repeat steps in the new doc text.

Statement in docs/navmesh.md this copy
boundary pages (two streams, runtime_data_end populated, rounded up to 4 KiB = first_stream_bytes) 307
store pg / store zero 93 / 214
pages with a continuation shorter than 64 bytes 3, all among the 93
groups by (first_stream_bytes, inflated - first_stream_bytes) 282, exactly 1 with both values
in that group, the page that stores pg its runtime data ends 16 bytes farther into Stream 0
distances from data_end to the end of Stream 0 with both values 3 (of 165 distances)

Every number I could check matches. Not re-checked: that the two pages in the mixed group have the same 24-byte block map, and the 23 / 72 split of the 95 pages where all three tables start in Stream 1. The CSV doesn't carry either.

  • python -I tests/test_navmesh_decode.py: 17 tests OK.
  • One thing to watch for anyone repeating this: the tool also writes navmeshes.navmesh-decode.json into the current folder. That file is tracked at the repository root, so running it from a checkout leaves a modified file. I restored it with git checkout.

Only counts and the one 16-byte difference are quoted here; the CSV stays on my machine.

AI-assisted: yes (Claude Code; run on the machine above)

**@⁠klikso** on GitHub · 2026-11-25 16:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1763#issuecomment-7168275418) Re-measured on a second copy, as the description says the page counts had not been: my own 1.0.2.1 (`navmeshes.rpf`), this branch at `04f3f5094`, Windows 11, Python 3.13. I ran `python -I tools/navmesh_decode.py navmeshes.rpf --csv pages.csv` (2 min 13 s; 9,603 `0drp` resources, all complete) and followed the repeat steps in the new doc text. | Statement in `docs/navmesh.md` | this copy | |---|---| | boundary pages (two streams, `runtime_data_end` populated, rounded up to 4 KiB = `first_stream_bytes`) | **307** | | store `pg` / store zero | **93 / 214** | | pages with a continuation shorter than 64 bytes | **3, all among the 93** | | groups by `(first_stream_bytes, inflated - first_stream_bytes)` | **282**, exactly **1** with both values | | in that group, the page that stores `pg` | its runtime data ends **16 bytes** farther into Stream 0 | | distances from `data_end` to the end of Stream 0 with both values | **3** (of 165 distances) | Every number I could check matches. Not re-checked: that the two pages in the mixed group have the same 24-byte block map, and the 23 / 72 split of the 95 pages where all three tables start in Stream 1. The CSV doesn't carry either. - `python -I tests/test_navmesh_decode.py`: 17 tests OK. - One thing to watch for anyone repeating this: the tool also writes `navmeshes.navmesh-decode.json` into the current folder. That file is tracked at the repository root, so running it from a checkout leaves a modified file. I restored it with `git checkout`. Only counts and the one 16-byte difference are quoted here; the CSV stays on my machine. AI-assisted: yes (Claude Code; run on the machine above)
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 18:32 UTC · original

Reviewed 04f3f50: adds first_stream_bytes / runtime_data_end columns to navmesh_decode's CSV, updates the boundary measurement docs (93 pg vs 214 zero on the 307 pages) and pins the columns in tests. Ran tests/test_navmesh_decode.py: 17/17 OK on the PR; with the PR's test file copied onto main it fails at the first new assertion (KeyError), so the new tests are differential; neighbours navmesh_links/nodes/tile_obj/zero_span/report_paths/report_path_case all pass and compileall is clean. A probe on both trees confirms the summary stats and checks are identical to main (purely additive change) and the columns match the documented recipe (4096/776 boundary, empty for non-0drp and bad block maps). No finding. Two notes: a complete two-stream row with a failing block_map check is counted in the summary's pages_4k_boundary but gets no runtime_data_end, so the doc's CSV recipe would drop such rows (fine if block_map passes corpus-wide); and the 307/93/214 corpus counts are not re-verifiable without game files.

AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 18:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1763#issuecomment-7171049747) Reviewed 04f3f50: adds `first_stream_bytes` / `runtime_data_end` columns to navmesh_decode's CSV, updates the boundary measurement docs (93 pg vs 214 zero on the 307 pages) and pins the columns in tests. Ran tests/test_navmesh_decode.py: 17/17 OK on the PR; with the PR's test file copied onto main it fails at the first new assertion (KeyError), so the new tests are differential; neighbours navmesh_links/nodes/tile_obj/zero_span/report_paths/report_path_case all pass and compileall is clean. A probe on both trees confirms the summary stats and checks are identical to main (purely additive change) and the columns match the documented recipe (4096/776 boundary, empty for non-0drp and bad block maps). No finding. Two notes: a complete two-stream row with a failing block_map check is counted in the summary's pages_4k_boundary but gets no runtime_data_end, so the doc's CSV recipe would drop such rows (fine if block_map passes corpus-wide); and the 307/93/214 corpus counts are not re-verifiable without game files. AI-assisted review. **Recommendation:** Merge
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/1763/head:github-bot/gh-1763'
git switch 'github-bot/gh-1763'

Merge

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