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

Open
opened 2026-11-26 20:19:43 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/952
Author: @barkodr
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/census-tools-wrong-input


📝 Commits (1)

  • 40f2414 gbuffer_census, navmesh_cell_fit, root_spill_census: a wrong input is one ERROR line, not a traceback

📊 Changes

6 files changed (+112 additions, -13 deletions)

View changed files

📝 tests/test_gbuffer_census.py (+27 -0)
📝 tests/test_navmesh_cell_fit.py (+18 -0)
📝 tests/test_root_spill_census.py (+33 -0)
📝 tools/gbuffer_census.py (+11 -3)
📝 tools/navmesh_cell_fit.py (+11 -6)
📝 tools/root_spill_census.py (+12 -4)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/952 **Author:** [@barkodr](https://github.com/barkodr) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/census-tools-wrong-input` --- ### 📝 Commits (1) - [`40f2414`](https://github.com/ubiquitarianism/leonida/commit/40f2414d47df58ad0dd578edf41d085ced0ada55) gbuffer_census, navmesh_cell_fit, root_spill_census: a wrong input is one ERROR line, not a traceback ### 📊 Changes **6 files changed** (+112 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_gbuffer_census.py` (+27 -0) 📝 `tests/test_navmesh_cell_fit.py` (+18 -0) 📝 `tests/test_root_spill_census.py` (+33 -0) 📝 `tools/gbuffer_census.py` (+11 -3) 📝 `tools/navmesh_cell_fit.py` (+11 -6) 📝 `tools/root_spill_census.py` (+12 -4) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#990
No description provided.