navmesh_index: report missing input before mode checks, handle write OSError, separate cleanup guards, and align pattern matching (NAVMESH-INDEX-ERROR-HANDLING-AND-CLEANUP) #1769
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1769
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/navmesh-index-error-handling-and-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: NAVMESH-INDEX-ERROR-HANDLING-AND-CLEANUP https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161419600
What and why
Fixes four bugs in
tools/navmesh_index.py(plus drops the duplicatesys.path.insert):os.path.exists(a.input)before archive/directory mode checks: Nonexistent paths with--patternpreviously fell intonot is_dirand exited with--pattern applies to a directory, not an archiveinstead ofERROR: <path>: does not exist. (--out/--csvequality andisdirchecks remain first, preservingtest_explicit_output_collision_before_scan.)write_outputsOSErrorcleanly: Wrapwrite_outputs(...)intry/except OSErrorprinting oneERROR: cannot write ...line and returning exit2without a Python traceback (keepingwrite_outputs's ownOSErrorcontract intact for unit callers).os.chmod(temp, 0o600)andos.unlink(temp)cleanup guards in_publish: Use two separatewith suppress(OSError):blocks so a failingchmodduring exception cleanup does not skip unlinkingtemp.is_scanned_inputpattern matching withscan_directory: Share_pattern_query(normalizingaltsepand prepending**only once) betweenscan_directoryandis_scanned_input, and normalizealtsep/ leading**/inis_scanned_input'sfnmatchbranch.Adds 4 regression tests in
tests/test_navmesh_index.py.Tested
Windows 11 x64 (
10.0.26100), Python3.14.7, CPU only, synthetic0DRP/RPF9 fixtures only (no game files). Commit6de3ecb759c9bc180d2422aa646b283d86f677a2.python -I tests/test_navmesh_index.py -v:main(bcaa13da) with all 38 tests: 4 failures, 1 skipped (existing POSIX permission test);test_replaced_report_keeps_its_permission_bitsskipped on Windows).python -I tests/test_ci_registration.py: 16 tests, OK.python -I tests/test_text_write_line_endings.py: 3 tests, OK.python -I scripts/check_no_game_data.py tools/navmesh_index.py tests/test_navmesh_index.py,python -m compileall -q tools tests,git diff --check: exit0.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Reviewed 6de3ecb: ran all of tests/test_navmesh_index.py on this branch (38 tests OK, 1 pre-existing environmental skip) and the same file against main - all four new tests fail there, each covering one of the fixes, while every existing test still passes on both trees. Also ran a 12-case end-to-end CLI matrix and a 110-case is_scanned_input pattern matrix (nested files, hard links,
..spellings) on both trees: no overwrite-guard regression (PR refusals are a strict superset of main's, scan sets identical), the temp-cleanup split behaves, and the unwritable-output cases exit 2 withERROR:instead of a traceback. Windows-only paths were not run. One nit:ERROR: cannot writecan name the staging temp path (e.filename) rather than the destination.AI-assisted review.
Recommendation: Merge
Merged after local re-verification: this PR merged onto
main7ce011205 without conflict, and its test file(s) (tests/test_navmesh_index.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.