Skip to content

navmesh_decode: guard --out/--csv with the shared report_paths.same_report_path (EGEN-NAVMESHDECODE-SHARED-PATH, DeepSeek7) - #6234

Open
evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/7-navmesh-decode-shared-path
Open

evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/7-navmesh-decode-shared-path

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/navmesh_decode.py kept its own same_report_path for the --out / --csv / input guards. That copy is missing tools/report_paths.same_name_on_folding_volume, so on a Linux mount that ignores letter case (vfat, exFAT, CIFS) --out R.json and --csv r.json passed as two different reports and the second one replaced the first. It also lacked the macOS posixpath rule the shared helper carries. tools/report_paths.py is the one answer every tool is meant to use (from report_paths import same_report_path), so this drops the private copy (~35 lines) and imports it instead.

No other change to the tool: same guards in main(), same messages (--out and --csv must use different paths, --out would overwrite the input), same exit code 2.

Test

python -I tests/test_navmesh_decode.py OutputPathTest, in a scratch worktree at upstream/main with only the new test file copied in (before), and in the branch (after):

  • before: Ran 3 tests ... FAILED (failures=2)
    • test_same_report_path_is_the_shared_helper: <function same_report_path ...> is not <function same_report_path ...>
    • test_same_report_path_asks_the_folding_volume: AssertionError: False is not true (the private normcase + samefile answer; the shared helper asks the volume and answers True)
  • after: Ran 3 tests in 0.107s / OK

Full module on the branch: python -I tests/test_navmesh_decode.py -> Ran 19 tests in 2.940s / OK.
python -m compileall -q tools/navmesh_decode.py tests/test_navmesh_decode.py -> exit 0; python -I tools/navmesh_decode.py --help still prints usage.

The new tests close two things: the tool must call the shared helper (a private copy is a different function object), and that helper must consult the folding-volume probe even when os.path.normcase keeps case.

No GPU needed (no GPU test run for this change).

Notes

AI-assisted.

…eport_path

The private copy of the guard missed report_paths.same_name_on_folding_volume, so on a Linux mount that ignores case (vfat, exFAT, CIFS) --out R.json and --csv r.json passed as two reports and the second replaced the first. It is also the copy that lacked the macOS posixpath rule. tools/report_paths.py already holds the one answer for every tool; use it.
test_same_report_path_is_the_shared_helper fails while the tool keeps a private copy (a distinct function object). test_same_report_path_asks_the_folding_volume simulates a volume whose normcase keeps case and asserts the shared folding-volume probe is consulted: a private normcase+samefile copy answers False there.
@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 27c6eb2 on Windows, CPython 3.14.7, CPU only: pass.

I ran navmesh_decode.py on an empty synthetic carve folder. With --out and --csv set to two hard links to one file, the command returned 2 and preserved the original bytes. With two new names that differed only in case, it returned 2 before creating either report. With distinct JSON and CSV paths, it returned 0 and created both. The merge base 561b65a gave the same results on this Windows volume.

Commands:

  • py -3.14 -I tests/test_navmesh_decode.py: 19 passed.
  • py -3.14 -I tests/test_report_path_case.py: 2 passed, 1 skipped.
  • py -3.14 -I tests/test_report_paths.py: 20 passed, 1 skipped.

Both new tests fail against the merge-base helper and pass on the head. The Linux folding-volume check uses a mock. The hard-link and case-only checks above used the actual Windows filesystem.

AI-assisted.

@senyurah

Copy link
Copy Markdown

Tested 27c6eb21 merged locally with main at 8575d36ed on Windows (Python 3.13.14). python -I tests/test_navmesh_decode.py passed 19/19.

One test needs updating for current main. test_same_report_path_asks_the_folding_volume mocks report_paths.same_name_on_folding_volume, but same_report_path now calls _same_resolved_name directly. The test passed on this case-folding NTFS directory because the real probe succeeded. As a control, I forced _same_resolved_name to return False. It was called once and the test failed despite the existing mock. Could you mock _same_resolved_name and assert it was called so the test is independent of the filesystem?

Synthetic inputs only. AI-assisted (Codex).

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.

3 participants