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

Open
github-bot wants to merge 1 commit from github-bot/gh-952 into main AGit
Owner

@⁠barkodr on GitHub · 2026-11-24 15:37 UTC · original
barkodr:fix/census-tools-wrong-input → main · +112 −13 · 6 files · 1 commits · open

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.
**@⁠barkodr** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/952) `barkodr:fix/census-tools-wrong-input` → `main` · +112 −13 · 6 files · 1 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:05 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 15:43 UTC · original · approved these changes

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.

**@⁠KernelSmoker** on GitHub · 2026-11-24 15:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/952#pullrequestreview-6042493717) · **approved these changes** 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/952/head:github-bot/gh-952'
git switch 'github-bot/gh-952'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-952'
git switch 'github-bot/gh-952'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-952'
git switch 'github-bot/gh-952'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-952'
git switch 'main'
git merge --squash 'github-bot/gh-952'
git switch 'main'
git merge --ff-only 'github-bot/gh-952'
git switch 'main'
git merge 'github-bot/gh-952'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.