#1577

navmesh_index: refuse a differently-cased report path inside the input folder

OpenAGVibecoderwants to merge intofrom

Item: BUILD-448 (coordination issue #1548; claim in #1380: https://github.com/ItsNotRexed/Leonida/issues/1380#issuecomment-7078922171). From @abilliontokens's finding: https://github.com/ItsNotRexed/Leonida/issues/1380#issuecomment-7078242007

What changed

tools/navmesh_index.py is_scanned_input checked whether a report path was inside the input folder with os.path.dirname(target) != root and target.startswith(root + os.sep), without normcase. On Windows, an --out/--csv such as ...\CARVE\page.bin for the input ...\carve got past the guard, and the report replaced the carved file.

The check now walks up from the report path and compares each parent folder with the tool's existing same_report_path (normcase + realpath, then samefile), the same comparison the BUILD-350 guard already used for the direct-file case. Because of samefile, it also covers a case-insensitive filesystem where normcase is a no-op (macOS) and a spelling that goes through a link. The --pattern match is unchanged (relpath from the matched folder plus fnmatch).

Tests

New synthetic tests in tests/test_navmesh_index.py, with no game files:

  • test_differently_cased_report_path_cannot_be_scanned_input: tries a differently-cased folder, a differently-cased file name and a nested file, both through the function and through the CLI with --out and --csv. It checks for exit 2 and that the input is unchanged. It is skipped on a case-sensitive temp filesystem. It fails on main and passes with the fix.
  • test_sibling_folder_with_shared_prefix_is_not_scanned_input: carve2/ is not inside carve/, and a missing file is not an input.

Run on Windows 11 Pro (10.0.26200), Python 3.12.10. GPU: n/a.

  • python -m compileall -q make_game.py tools tests: ok
  • python -I make_game.py --help: ok
  • python -m unittest discover -s tests/semantic: 1247 tests OK
  • python -I tests/test_navmesh_index.py: 19 tests OK (the new case-insensitivity test fails without the fix)

AI-assisted (Claude Code). No game data.

🤖 Generated with Claude Code