gbuffer_census, navmesh_cell_fit, root_spill_census: a wrong input is one ERROR line, not a traceback #952

Merged
barkodr merged 1 commit from upstream-pr/952 into main 2026-12-01 17:58:04 +00:00
barkodr commented 2026-11-24 15:37:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by barkodr on 2026-11-24T15:37:14Z.


Claimed in the coordination issue as: claiming: tools/gbuffer_census.py, navmesh_cell_fit.py and root_spill_census.py stop with a traceback on a wrong input (a file for the carve folder, a non-RPF archive, a non-UTF-8 index); print one ERROR line and exit 2 like the other tools. Tools only. AI-assisted.

What and why

  • tools/gbuffer_census.py given a file instead of a shader_carve folder stopped with NotADirectoryError, and its main() never returned an exit code.
  • tools/navmesh_cell_fit.py given a file that is not an RPF archive raised the right ValueError message, but as a traceback.
  • tools/root_spill_census.py given a JSON index that is not UTF-8, or a folder, stopped with UnicodeDecodeError or IsADirectoryError.

All three now follow tools/navmesh_nodes.py: except (OSError, ValueError) prints ERROR: ... and exits 2.

Tested

On macOS 26.6.2 with Python 3.12.16, from the checkout root with python -I: tests/test_gbuffer_census.py, tests/test_navmesh_cell_fit.py, tests/test_root_spill_census.py, tests/test_tool_startup.py, tests/test_text_write_line_endings.py and tests/test_docs_python_deps.py pass. On Ubuntu 26.04 (WSL2) with Python 3.14.4 the first five of those pass; test_docs_python_deps.py was not run there. Each new wrong-input test fails against the tool on main and passes with the fix. Not run on real game files; the normal output is unchanged. tests/test_tool_stdout_encoding.py fails on this branch as it does on main, on both systems, listing only tools/native_pso_hashes.py, which this pull request does not touch.

GPUs tested: none (no GPU code changed)

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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5475317188 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/952). Originally posted by [barkodr](https://github.com/barkodr) on 2026-11-24T15:37:14Z. --- Claimed in the coordination issue as: claiming: tools/gbuffer_census.py, navmesh_cell_fit.py and root_spill_census.py stop with a traceback on a wrong input (a file for the carve folder, a non-RPF archive, a non-UTF-8 index); print one ERROR line and exit 2 like the other tools. Tools only. AI-assisted. ### What and why - `tools/gbuffer_census.py` given a file instead of a `shader_carve` folder stopped with `NotADirectoryError`, and its `main()` never returned an exit code. - `tools/navmesh_cell_fit.py` given a file that is not an RPF archive raised the right `ValueError` message, but as a traceback. - `tools/root_spill_census.py` given a JSON index that is not UTF-8, or a folder, stopped with `UnicodeDecodeError` or `IsADirectoryError`. All three now follow `tools/navmesh_nodes.py`: `except (OSError, ValueError)` prints `ERROR: ...` and exits 2. ### Tested On macOS 26.6.2 with Python 3.12.16, from the checkout root with `python -I`: `tests/test_gbuffer_census.py`, `tests/test_navmesh_cell_fit.py`, `tests/test_root_spill_census.py`, `tests/test_tool_startup.py`, `tests/test_text_write_line_endings.py` and `tests/test_docs_python_deps.py` pass. On Ubuntu 26.04 (WSL2) with Python 3.14.4 the first five of those pass; `test_docs_python_deps.py` was not run there. Each new wrong-input test fails against the tool on `main` and passes with the fix. Not run on real game files; the normal output is unchanged. `tests/test_tool_stdout_encoding.py` fails on this branch as it does on `main`, on both systems, listing only `tools/native_pso_hashes.py`, which this pull request does not touch. GPUs tested: none (no GPU code changed) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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.
KernelSmoker commented 2026-11-24 15:43:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T15:43:29Z.

Review: APPROVED


Verified on exact head 40f2414d47df58ad0dd578edf41d085ced0ada55. Focused Linux tests passed: test_gbuffer_census.py 4/4, test_navmesh_cell_fit.py 5/5, test_root_spill_census.py 21/21, test_tool_startup.py 2/2, test_text_write_line_endings.py 3/3, and test_docs_python_deps.py 3/3 (38 total). Python compile, check_no_game_data.py, and git diff --check passed. Synthetic wrong inputs only; no game data/GPU. The reported unrelated test_tool_stdout_encoding.py failure was not treated as part of this change and was not independently rerun.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6042493717 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/952#pullrequestreview-6042493717). Originally posted by [KernelSmoker](https://github.com/KernelSmoker) on 2026-11-24T15:43:29Z. **Review:** APPROVED --- Verified on exact head `40f2414d47df58ad0dd578edf41d085ced0ada55`. Focused Linux tests passed: `test_gbuffer_census.py` 4/4, `test_navmesh_cell_fit.py` 5/5, `test_root_spill_census.py` 21/21, `test_tool_startup.py` 2/2, `test_text_write_line_endings.py` 3/3, and `test_docs_python_deps.py` 3/3 (38 total). Python compile, `check_no_game_data.py`, and `git diff --check` passed. Synthetic wrong inputs only; no game data/GPU. The reported unrelated `test_tool_stdout_encoding.py` failure was not treated as part of this change and was not independently rerun.
kurrutako commented 2026-12-01 08:47:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kurrutako on 2026-12-01T08:47:55Z.


Tested on Windows 11, Python 3.14.6, head 40f2414.

  • The four test files: 32 passed.

  • I ran each tool by hand on wrong input:

    • a file given as the carve folder;
    • a non-UTF-8 index;
    • a zero-filled .rpf;
    • a folder given as the index;
    • a non-JSON --carve.

    Each case gives one ERROR: line and exit 2. On main each one is a traceback with exit 1.

  • Minor: on Windows, a folder given as the index reports "[Errno 13] Permission denied" rather than "is a directory".

Merging current main conflicts only in tools/navmesh_cell_fit.py: main (#2446) added an --out guard inside if a.common:. Moving those two lines into the new try resolves it. After that the tests give 34 passed, and the manual checks are unchanged.

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7305798926 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/952#issuecomment-7305798926). Originally posted by [kurrutako](https://github.com/kurrutako) on 2026-12-01T08:47:55Z. --- Tested on Windows 11, Python 3.14.6, head 40f2414. - The four test files: 32 passed. - I ran each tool by hand on wrong input: - a file given as the carve folder; - a non-UTF-8 index; - a zero-filled .rpf; - a folder given as the index; - a non-JSON `--carve`. Each case gives one `ERROR:` line and exit 2. On main each one is a traceback with exit 1. - Minor: on Windows, a folder given as the index reports "[Errno 13] Permission denied" rather than "is a directory". Merging current main conflicts only in `tools/navmesh_cell_fit.py`: main (#2446) added an `--out` guard inside `if a.common:`. Moving those two lines into the new `try` resolves it. After that the tests give 34 passed, and the manual checks are unchanged. AI-assisted (Claude Code)
aslan2142 commented 2026-12-01 11:53:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:53:31Z.

Review: DISMISSED


Reviewed against current main: normalizing wrong-input handling to a single ERROR line in tools/gbuffer_census.py, tools/navmesh_cell_fit.py, and tools/root_spill_census.py looks good, but this branch currently conflicts with main. Please rebase onto current main so CI runs cleanly.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130721376 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/952#pullrequestreview-6130721376). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:53:31Z. **Review:** DISMISSED --- Reviewed against current `main`: normalizing wrong-input handling to a single ERROR line in `tools/gbuffer_census.py`, `tools/navmesh_cell_fit.py`, and `tools/root_spill_census.py` looks good, but this branch currently conflicts with `main`. Please rebase onto current `main` so CI runs cleanly. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:44:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:44:45Z.


Rebased onto current main (d2a564b66, new head 51f94c885), preserving the --out overwrite guard in tools/navmesh_cell_fit.py inside the new try block (AI-assisted).

Local Linux verification (synthetic inputs, no game data):

  • scripts/check_no_game_data.py: pass
  • git diff --check origin/main..HEAD: pass
  • python3 -m compileall -q make_game.py tools tests: pass
  • tests/test_gbuffer_census.py (4/4), tests/test_navmesh_cell_fit.py (7/7), tests/test_root_spill_census.py (21/21), tests/test_tool_startup.py (2/2), tests/test_tool_stdout_encoding.py (4/4), tests/test_text_write_line_endings.py (3/3), tests/test_docs_python_deps.py (3/3): 44/44 pass
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319783048 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/952#issuecomment-7319783048). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:44:45Z. --- Rebased onto current `main` (`d2a564b66`, new head `51f94c885`), preserving the `--out` overwrite guard in `tools/navmesh_cell_fit.py` inside the new `try` block (AI-assisted). Local Linux verification (synthetic inputs, no game data): - `scripts/check_no_game_data.py`: pass - `git diff --check origin/main..HEAD`: pass - `python3 -m compileall -q make_game.py tools tests`: pass - `tests/test_gbuffer_census.py` (4/4), `tests/test_navmesh_cell_fit.py` (7/7), `tests/test_root_spill_census.py` (21/21), `tests/test_tool_startup.py` (2/2), `tests/test_tool_stdout_encoding.py` (4/4), `tests/test_text_write_line_endings.py` (3/3), `tests/test_docs_python_deps.py` (3/3): 44/44 pass
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!952
No description provided.