[PR #1088] [MERGED] recomp_census: a wrong input is one ERROR line, not a traceback (RECOMP-CENSUS-WRONG-INPUT) #1123

Closed
opened 2026-11-26 20:20:10 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1088
Author: @tiguan26
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

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


📝 Commits (1)

  • 4243713 recomp_census: a wrong input is one ERROR line, not a traceback (RECOMP-CENSUS-WRONG-INPUT)

📊 Changes

2 files changed (+71 additions, -7 deletions)

View changed files

📝 tests/test_recomp_census.py (+56 -0)
📝 tools/recomp_census.py (+15 -7)

📄 Description

Claimed in the coordination issue as: RECOMP-CENSUS-WRONG-INPUT (claim, done)

What and why

tools/recomp_census.py stopped with a traceback on a wrong input:

  • an image path that does not exist (FileNotFoundError),
  • a folder instead of an image (IsADirectoryError),
  • --out naming an existing file (FileExistsError from os.makedirs).

Each now prints one ERROR: ... line and exits 2, like tools/navmesh_nodes.py and the three tools in #952 (which does not touch this one). A PE that is not x86-64 or has no MZ header keeps its current message and exit code 1.

The module docstring said the tool writes <out>/<file>.json and <out>/<file>.md; it writes <file>.recomp.json and <file>.recomp.md, so that line is corrected.

Tested

On Linux (Python 3.13.18), from the checkout root on main 3aa9754:

  • python -I tests/test_recomp_census.py: 11 tests pass. The four new ones (WrongInputTests) use the byte-built PE fixture already in the file; the three wrong-input cases fail against the tool on main and pass with the fix, and the fourth checks a good image still writes both reports.
  • tests/test_tool_startup.py, tests/test_text_write_line_endings.py, tests/test_tool_stdout_encoding.py, tests/test_docs_links.py: pass.
  • python -m compileall -q tools tests, python -I scripts/check_no_game_data.py on both files, git diff --check: clean.

Not run on real game files; the normal output is unchanged.

GPUs tested: n/a (no GPU code changed)

AI-assisted: yes (Claude)

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. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 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/1088 **Author:** [@tiguan26](https://github.com/tiguan26) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `fix/recomp-census-wrong-input` --- ### 📝 Commits (1) - [`4243713`](https://github.com/ubiquitarianism/leonida/commit/4243713783cdda3acabc261c29c2d71bf416c3c1) recomp_census: a wrong input is one ERROR line, not a traceback (RECOMP-CENSUS-WRONG-INPUT) ### 📊 Changes **2 files changed** (+71 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_recomp_census.py` (+56 -0) 📝 `tools/recomp_census.py` (+15 -7) </details> ### 📄 Description Claimed in the coordination issue as: RECOMP-CENSUS-WRONG-INPUT ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140305644), [done](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140377408)) ### What and why `tools/recomp_census.py` stopped with a traceback on a wrong input: - an image path that does not exist (`FileNotFoundError`), - a folder instead of an image (`IsADirectoryError`), - `--out` naming an existing file (`FileExistsError` from `os.makedirs`). Each now prints one `ERROR: ...` line and exits 2, like `tools/navmesh_nodes.py` and the three tools in #952 (which does not touch this one). A PE that is not x86-64 or has no MZ header keeps its current message and exit code 1. The module docstring said the tool writes `<out>/<file>.json` and `<out>/<file>.md`; it writes `<file>.recomp.json` and `<file>.recomp.md`, so that line is corrected. ### Tested On Linux (Python 3.13.18), from the checkout root on `main` 3aa9754: - `python -I tests/test_recomp_census.py`: 11 tests pass. The four new ones (`WrongInputTests`) use the byte-built PE fixture already in the file; the three wrong-input cases fail against the tool on `main` and pass with the fix, and the fourth checks a good image still writes both reports. - `tests/test_tool_startup.py`, `tests/test_text_write_line_endings.py`, `tests/test_tool_stdout_encoding.py`, `tests/test_docs_links.py`: pass. - `python -m compileall -q tools tests`, `python -I scripts/check_no_game_data.py` on both files, `git diff --check`: clean. Not run on real game files; the normal output is unchanged. GPUs tested: n/a (no GPU code changed) AI-assisted: yes (Claude) ### 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. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:10 +01:00
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#1123
No description provided.