Skip to content

navmesh_decode: ask report_paths for the report-path guard (NAVMESH-DECODE-SHARED-REPORT-PATH) - #1243

Open
breachato wants to merge 2 commits into
ProjectLeonida:mainfrom
breachato:navmesh-decode-shared-report-path
Open

breachato wants to merge 2 commits into
ProjectLeonida:mainfrom
breachato:navmesh-decode-shared-report-path

Conversation

@breachato

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: NAVMESH-DECODE-SHARED-REPORT-PATH (#14 (comment))

Depends on: none

Fixes: none

What and why

tools/navmesh_decode.py carried a full private copy of tools/report_paths.py (:1049-1081): _PC_CASE_SENSITIVE,
_case_insensitive_volume (the macOS pathconf probe), _path_key (realpath + normcase + NFD casefold) and its own
same_report_path, all used by the four output guards at :1101 (--csv against --out), :1108 (the input),
:1112 (the carve folder's index.json) and :1115 (each carved entry). CONTRIBUTING.md asks a report writer to
call report_paths.same_report_path instead of deriving the answer again.

The copy was also missing the part the shared helper has and it does not: the folding-volume probe
(same_name_on_folding_volume). Its macOS probe answers only on APFS/HFS+ and normcase folds only on Windows, so
on a Linux mount that ignores case (vfat, exFAT, CIFS) --out R.json and --csv r.json passed as two report paths
and the second replaced the first.

The four private helpers and the now-unused unicodedata import go (1 insertion, 37 deletions). The module keeps
the name same_report_path because tests/test_report_path_case.py resolves navmesh_decode.same_report_path; it is
now the imported function. Different topic from NAVMESH-JOAAT-LATIN1 (joaat_cs encoding). No behaviour change on
Windows, macOS or a case-sensitive Linux filesystem.

Tested

  • tests/test_navmesh_decode.py and tests/test_report_path_case.py: 20 passed, 1 skipped, 15 subtests passed.
  • python -I tools/navmesh_decode.py --help: prints its usage (the import works under -I).
  • python -m compileall -q tools/navmesh_decode.py: clean.
  • Not tested: the folding-volume case this fixes, which needs a case-folding mount (vfat/exFAT/CIFS); this
    machine is NTFS, where normcase already folds case. tests/test_report_paths.py covers the helper's own
    folding-volume answer.
  • No game files, no GPU; nothing was built.

GPUs tested: n/a

AI-assisted: yes

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)

@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed 9ba1fa9: navmesh_decode now imports same_report_path from tools/report_paths.py instead of its own copy. Ran in the sandbox on this branch and on main: tests/test_navmesh_decode.py (17 OK), tests/test_report_paths.py (22 OK), tests/test_report_path_case.py (4 OK, 1 skipped), compileall, --help clean. A 14-case probe (hard link, symlinks, dangling symlink vs target, case and NFD-accent twins, relative and missing paths) is verdict-identical to the old guard on a case-sensitive volume; on folding volumes it now also refuses a case-twin, which is the point. No finding. Suggestion: drop navmesh_decode from LEGACY_COPIES in tests/test_report_paths.py and add it to SHARED so the import stays enforced; tests pass unchanged either way.

AI-assisted review.

Recommendation: Merge

MoonEyes pushed a commit to MoonEyes/leonida that referenced this pull request Nov 27, 2026
…eads from a group counter

A compute program with console lanes relabels its threads so that each
host wave holds a wave-aligned run of console threads. Outside a console
wave64 program run as 32-lane halves, the console thread was the flat id
of the wave's first lane rounded down to the wave size, plus the lane. A
host need not fill its waves that way: a 32-lane host fills 2-D groups
from 16 x 2 tiles, so two waves of a 32 x 2 group round down to the same
base and half the group's threads get the ids of the other half.

Such programs, in groups larger than one host wave, now take their
threads from an LDS counter as the halves path already did (wave_base):
every thread zeroes it, the group meets, and each wave's first active
lane adds for its wave. A full wave takes the next aligned block from
the low 16 bits; a wave with fewer lanes adds its lane count to the high
16 bits and is placed past the full blocks, so it cannot shift a full
wave off its alignment (this also covers the halves path's groups whose
size is not a multiple of 32, where each wave used to add a fixed 32).
Lanes are placed by their rank among the active lanes. For groups of
full 32-lane waves the halves path gives the ids it gave before.

LEONIDA_THREAD_TICKET, on by default; 0 keeps the old rounding. It is
read by the translator, so it joins the switches the shader cache keys
on (shader_cache.rs). Tests choose it per thread (TEST_THREAD_TICKET)
instead of through the environment.

from TaynanGT/Vice-Tay c125c0c, GPL-3.0 (Garu667's upstream fix for
VIctory issue ProjectLeonida#1243). Its follow-up 53c9ab5 (the group-info SGPR from
the relabelled wave) is not taken: this tree does not lower that SGPR at
all, a program reading it is refused.

Checked: wave64_tests' new test, a console wave32 program with v_mbcnt
in a 32 x 2 group that stores 1 at dword 32y + x, run on the host GPU
(NVIDIA, 32-lane waves): the old rounding writes 32 of 64 dwords, the
counter all 64. cargo test -p leonida-shader --lib: 282 passed, 1
failed (typed_d16_table_uav_roundtrip_uint_sint_and_float, which fails
the same way without this change); cargo check --profile diag -p leonida
--features diagnostics. Not run in the game.

AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

#1243 | head 9ba1fa9 (merged cleanly with main c7753ed) | live NTFS fsutil file setCaseSensitiveInfo <dir> enable probe + python -I tests/test_navmesh_decode.py + python -I tests/test_report_paths.py + python -I tests/test_report_path_case.py | red on main: navmesh_decode.same_report_path falsely returned True inside a case-sensitive Windows NTFS directory (both for uncreated NAV.json vs nav.json and for two distinct existing files Existing.bin vs existing.bin, because its private _path_key ran os.path.normcase before os.path.samefile) | green on PR+main: False on case-sensitive NTFS (missing and distinct existing files), True on standard case-insensitive NTFS, 17 ran, OK (test_navmesh_decode.py), 26 ran, OK (skipped=1) (test_report_paths.py), 4 ran, OK (skipped=1) (test_report_path_case.py) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited 9ba1fa94db (tools/navmesh_decode.py) on Windows 11, confirming it removes the last private _case_insensitive_volume / _path_key / same_report_path copy (LEGACY_COPIES in tests/test_report_paths.py) in favor of tools/report_paths.py's shared same_report_path, which checks os.path.samefile first and probes per-directory Windows NTFS case sensitivity via _same_windows_folded_path. Also verified tests/test_ci_registration.py, tests/test_text_write_line_endings.py, and scripts/check_no_game_data.py.

@TheGeogeo

Copy link
Copy Markdown
Contributor

Checked 9ba1fa94d merged (no commit) with main 87a39df94: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

No blocker from my side.

AI-assisted (Claude Code).

@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7, PR head 9ba1fa9 : red none / green OK

No test in the PR:

  • Merge: clean (git merge-tree).
  • Diff: drops the local copy of same_report_path (+ _path_key, _case_insensitive_volume, the unicodedata import) and imports the one from tools/report_paths. Pure refactor. No game data.
  • No red: tests/test_report_paths.py still lists navmesh_decode in LEGACY_COPIES, not in SHARED, so everything already passes on main. A local simulation of the SHARED check (imports the helper, no copy) fails on main and passes on the merge.
  • Guard checked by hand with a random .rpf (MEASURED): --out NAV.RPF for input nav.rpf, and --out x.json --csv X.JSON, are refused the same way on main and on the merge; input md5 unchanged. No behaviour change on macOS.
  • Neighbours (test_report_paths, test_tool_startup, navmesh*/ttpf*/dds/zero_span/staging tests): 102 OK, 7 skipped (rpf9dump not built, bcpack_calibration dylib absent, one Windows-only case-sensitivity test), 1 failure — test_tool_startup psin_dialogue (ModuleNotFoundError: psin_data), identical on main (MEASURED n=3), unrelated.
  • Suggestion: move navmesh_decode from LEGACY_COPIES to SHARED in tests/test_report_paths.py (its comment says to wait for this PR) — that would be the missing red test.

Verdict: NO RED (correct refactor, no test).

AI-assisted: Claude Code

@MoonEyes

Copy link
Copy Markdown
Collaborator

Tested 9ba1fa94d merged (no commit) with main 4364a4fa6: Python 3.12, Windows 11 10.0.26300, CPU only.

  • Red test: "navmesh_decode" added to SHARED and removed from LEGACY_COPIES in tests/test_report_paths.py, then python -I tests/test_report_paths.py.
  • Red on main: 2 failures, including 'from report_paths import same_report_path' not found in tools/navmesh_decode.py.
  • Green with this PR: OK (1 skipped).
  • That test edit is mine, not part of the PR. The PR should also drop navmesh_decode from LEGACY_COPIES, whose comment says this is the one tool still carrying its own copy.

AI-assisted (Claude Code).

@breachato

Copy link
Copy Markdown
Contributor Author

Added: navmesh_decode is now in SHARED in tests/test_report_paths.py in this PR (commit 92558ccf).

  • python -I tests/test_report_paths.py — OK (1 skipped), with the entry in place.
  • python -I tests/test_navmesh_decode.py — OK.
  • The red is the one you described: the same entry without this branch fails with 'from report_paths import same_report_path' not found.

Every PR in this series now touches that SHARED line, so I expect to rebase the rest as merges land; say the word if you would rather keep the list to a single follow-up.

AI-assisted.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 30, 2026
@breachato
breachato force-pushed the navmesh-decode-shared-report-path branch from 92558cc to 352ea02 Compare November 30, 2026 19:21
@breachato

breachato commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto main (8f41d7d0) to clear the SHARED tuple conflict that #2637 (bink_index) opened for every sibling: the entry now sits in the tuple next to bink_index, and the branch is two commits again.

Verified on the new head:

  • python -I tests/test_report_paths.py — OK (26 tests, 1 skipped)
  • python -I tests/test_navmesh_decode.py — OK
  • git diff main — 2 files: the tool and tests/test_report_paths.py

No behaviour change beyond the shared helper.

Ready to merge: MERGEABLE / CLEAN, all five checks green. Every sibling PR touches the same SHARED line, so please merge one at a time — I'll rebase the remaining ones after each merge and keep them green.

@github-actions github-actions Bot added needs rebase Conflicts with the base branch: rebase it on main and removed needs rebase Conflicts with the base branch: rebase it on main labels Nov 30, 2026

@aslan2142 aslan2142 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff against main: delegating the report-path guard in tools/navmesh_decode.py to report_paths.same_report_path is clean and clean-room verified, but this branch currently conflicts with main in tests/test_report_paths.py:8-12 (SHARED tuple updated by #2639 and earlier merges). Keep the LEGACY_COPIES = set() update in tests/test_report_paths.py:17 when rebasing. Please rebase onto current main so CI runs cleanly.

(AI-assisted review.)

@breachato
breachato force-pushed the navmesh-decode-shared-report-path branch from 352ea02 to 298601b Compare December 1, 2026 17:54
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Dec 1, 2026
It was the last tool carrying its own copy, so LEGACY_COPIES is empty now.
With the SHARED entry on main, test_switched_tools_import_the_helper_and_define_no_copy
fails ("'from report_paths import same_report_path' not found"); with this branch it passes.
@breachato
breachato force-pushed the navmesh-decode-shared-report-path branch from 298601b to 9ca1256 Compare December 1, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants