navmesh_cell_fit: protect scanned vehicle documents from output aliases #2445

Merged
leonida/mandy
kirigayakazima merged 1 commit from codex/navmesh-cell-fit-carve-alias into main 2026-11-28 15:13:35 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-27 10:17:06 +00:00

Claimed in the coordination issue as: NAVMESH-CELL-FIT-CARVE-ALIAS

Depends on: #952 (textual conflict in argument handling if both branches land; this change builds directly on main).

What and why

The archive was protected from output collisions, but scanned vehicle documents under --common could still be overwritten. Refuse output aliases of those files before reading the carve. A readable synthetic archive reproduced exit 0 with the vehicle document replaced via its hard link. The fixed CLI returns 2 and preserves its bytes. The regression also covers a direct path.

Tested

Windows, Python 3.14.7, synthetic fixtures.

  • python -I tests/test_navmesh_cell_fit.py
  • python -I tests/test_report_paths.py
  • Changed-path game-data scan and git diff --check passed.
  • Shared main baseline: 6,374 translator semantic tests passed across 500 files. The combined five-topic checkout passed 172 focused tests.

GPUs tested: N/A (CPU-only).

AI-assisted: Yes.

Checklist

  • Based on current main and merges cleanly with the tested base.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A.
Claimed in the coordination issue as: [NAVMESH-CELL-FIT-CARVE-ALIAS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7215561737) Depends on: #952 (textual conflict in argument handling if both branches land; this change builds directly on main). ### What and why The archive was protected from output collisions, but scanned vehicle documents under --common could still be overwritten. Refuse output aliases of those files before reading the carve. A readable synthetic archive reproduced exit 0 with the vehicle document replaced via its hard link. The fixed CLI returns 2 and preserves its bytes. The regression also covers a direct path. ### Tested Windows, Python 3.14.7, synthetic fixtures. - `python -I tests/test_navmesh_cell_fit.py` - `python -I tests/test_report_paths.py` - Changed-path game-data scan and `git diff --check` passed. - Shared main baseline: 6,374 translator semantic tests passed across 500 files. The combined five-topic checkout passed 172 focused tests. GPUs tested: N/A (CPU-only). AI-assisted: Yes. ### Checklist - [x] Based on current main and merges cleanly with the tested base. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A.
MSedgeMC reviewed 2026-11-27 15:09:20 +00:00
MSedgeMC left a comment
No description provided.
Verified on the PR branch: python3 -m unittest tests.test_navmesh_cell_fit -v -> 5 tests OK, including the new output-alias protection case. Not approving yet: the branch is 606 commits behind current main and shares the test file with PR #2446, so both need rebasing before a combined diff can be reviewed.
zmasi commented 2026-11-28 09:46:37 +00:00

#2445 | head 20fbb6cf5098dceeca236bfb9f7feeffea190d9d (merged cleanly with main 3ca0707dd) | python -I tests/test_navmesh_cell_fit.py | red on main: FAILED (failures=2) (test_output_cannot_overwrite_a_common_carve_input: AssertionError: 0 != 2 on direct --common .bin input and hardlink alias) | green on PR+main: 5 tests OK (-k test_output_cannot_overwrite_a_common_carve_input: 1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited _carve_inputs (glob.escape(carve)) and main() in tools/navmesh_cell_fit.py (same_report_path(a.out, p) check across --common .bin inputs before writing output, merging cleanly with current main 3ca0707dd). Also passed tests/test_report_paths.py (24 OK, skipped=1), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py on the merged tree.

#2445 | head 20fbb6cf5098dceeca236bfb9f7feeffea190d9d (merged cleanly with main 3ca0707dd) | `python -I tests/test_navmesh_cell_fit.py` | red on main: `FAILED (failures=2)` (`test_output_cannot_overwrite_a_common_carve_input`: `AssertionError: 0 != 2` on direct `--common` `.bin` input and hardlink alias) | green on PR+main: `5 tests OK` (`-k test_output_cannot_overwrite_a_common_carve_input`: `1 test OK`) | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `_carve_inputs` (`glob.escape(carve)`) and `main()` in `tools/navmesh_cell_fit.py` (`same_report_path(a.out, p)` check across `--common` `.bin` inputs before writing output, merging cleanly with current `main` `3ca0707dd`). Also passed `tests/test_report_paths.py` (`24 OK, skipped=1`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py` on the merged tree.
MoonEyes commented 2026-11-28 15:13:32 +00:00

Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head 20fbb6cf5098 unchanged since 2026-11-27, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head 20fbb6cf5098 unchanged since 2026-11-27, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.