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

Merged
potatoe0100 merged 1 commit from upstream-pr/1763 into main 2026-11-28 19:28:59 +00:00
potatoe0100 commented 2026-11-25 11:37:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by potatoe0100 on 2026-11-25T11:37:58Z.


Claimed in the coordination issue as: OLD-9905 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161295097)

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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5490589947 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1763). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-25T11:37:58Z. --- Claimed in the coordination issue as: OLD-9905 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161295097) ### 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)
klikso commented 2026-11-25 16:37:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by klikso on 2026-11-25T16:37:25Z.


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7168275418 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1763#issuecomment-7168275418). Originally posted by [klikso](https://github.com/klikso) on 2026-11-25T16:37:25Z. --- 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)
PierreEbele commented 2026-11-25 18:32:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T18:32:33Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7171049747 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1763#issuecomment-7171049747). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T18:32:33Z. --- 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
MoonEyes commented 2026-11-28 19:28:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T19:28:56Z.


Red/green: tests/test_navmesh_decode.py fails on main (KeyError: 'first_stream_bytes') and passes with the PR merged, on GitHub Actions Linux and natively on Windows.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7244576564 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1763#issuecomment-7244576564). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T19:28:56Z. --- Red/green: tests/test_navmesh_decode.py fails on main (KeyError: 'first_stream_bytes') and passes with the PR merged, on GitHub Actions Linux and natively on Windows. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1763
No description provided.