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

Manually merged
github merged 1 commit from gh-pr/1088/head into gh-pr/1088/base 2026-11-26 09:37:28 +00:00
Owner

@⁠tiguan26 on GitHub · 2026-11-24 18:13 UTC · original
tiguan26:fix/recomp-census-wrong-input → main · +71 −7 · 2 files · 1 commits · merged 2026-11-24 22:19 UTC

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

**@⁠tiguan26** on GitHub · 2026-11-24 18:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088) `tiguan26:fix/recomp-census-wrong-input` → `main` · +71 −7 · 2 files · 1 commits · merged 2026-11-24 22:19 UTC Claimed in the coordination issue as: RECOMP-CENSUS-WRONG-INPUT ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14), [done](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### 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)
A missing image (FileNotFoundError), a folder for the image
(IsADirectoryError) and an --out that names an existing file
(FileExistsError from os.makedirs) stopped the tool with a traceback.
Each now prints one ERROR line and exits 2, like tools/navmesh_nodes.py.
A PE that is not x86-64 keeps its current message and exit code.

The docstring named the reports <file>.json and <file>.md; the tool
writes <file>.recomp.json and <file>.recomp.md.

Synthetic tests only, on the byte-built PE fixture; no game files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:37:27 +00:00
github manually merged commit 4243713783 into gh-pr/1088/base 2026-11-26 09:37:28 +00:00
Author
Owner

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

Independently verified the wrong-input handling on head 4243713783cdda3acabc261c29c2d71bf416c3c1.

  • tests/test_recomp_census.py: 11/11 passed.
  • Startup 2/2, text line endings 3/3, stdout encoding 4/4, docs links 16/16 passed.
  • End-to-end CLI subprocesses for missing input, directory input, and --out naming a file each exited 2 with exactly one ERROR: line and no traceback.
  • Replaced the patched tool temporarily with the base-commit version: the three new wrong-input tests failed with the corresponding OSError exceptions; restored the PR source and verified the suite green.
  • No-game-data check and whitespace/line-ending checks passed. The PE fixture is synthetic; no game files or GPU used.

One coordination note: the PR body says this item was claimed, but I could not find a matching claim comment from the author in the current coordination issue #14 history. Please add or link it so the task ledger remains accurate; I found no overlapping PR or change in intervening main commits.

**@⁠KernelSmoker** on GitHub · 2026-11-24 18:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088#pullrequestreview-6045115629) · **approved these changes** Independently verified the wrong-input handling on head `4243713783cdda3acabc261c29c2d71bf416c3c1`. - `tests/test_recomp_census.py`: 11/11 passed. - Startup 2/2, text line endings 3/3, stdout encoding 4/4, docs links 16/16 passed. - End-to-end CLI subprocesses for missing input, directory input, and `--out` naming a file each exited 2 with exactly one `ERROR:` line and no traceback. - Replaced the patched tool temporarily with the base-commit version: the three new wrong-input tests failed with the corresponding OSError exceptions; restored the PR source and verified the suite green. - No-game-data check and whitespace/line-ending checks passed. The PE fixture is synthetic; no game files or GPU used. One coordination note: the PR body says this item was claimed, but I could not find a matching claim comment from the author in the current coordination issue #14 history. Please add or link it so the task ledger remains accurate; I found no overlapping PR or change in intervening main commits.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:42 UTC · original · approved these changes

Audited and verified. Handles OSError cleanly in ools/recomp_census.py when encountering missing or invalid image paths or unwritable destination directories, printing a single ERROR: ... line to stderr and exiting with status 2 without Python tracebacks. Unit tests in ests/test_recomp_census.py pass cleanly. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088#pullrequestreview-6045235416) · **approved these changes** Audited and verified. Handles OSError cleanly in ools/recomp_census.py when encountering missing or invalid image paths or unwritable destination directories, printing a single ERROR: ... line to stderr and exiting with status 2 without Python tracebacks. Unit tests in ests/test_recomp_census.py pass cleanly. Approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:51 UTC · original · approved these changes

Clean-Room Audit — PR #1088 (RECOMP-CENSUS-WRONG-INPUT)

Clean error handling in tools/recomp_census.py catching OSError across both input inspection and report output paths, printing one diagnostic ERROR: line to stderr with exit code 2. Solid unit test coverage in tests/test_recomp_census.py::WrongInputTests; standard library only, 0 game data.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088#pullrequestreview-6045356100) · **approved these changes** ### Clean-Room Audit — PR #1088 (`RECOMP-CENSUS-WRONG-INPUT`) Clean error handling in `tools/recomp_census.py` catching `OSError` across both input inspection and report output paths, printing one diagnostic `ERROR:` line to `stderr` with exit code 2. Solid unit test coverage in `tests/test_recomp_census.py::WrongInputTests`; standard library only, 0 game data. **Verdict: APPROVED**
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-24 18:58 UTC · original

@⁠KernelSmoker thanks for checking. The claim is in #14, collapsed in the middle of the thread: claiming: RECOMP-CENSUS-WRONG-INPUT, posted before this PR opened, and the done note. I've also linked it from the PR description.

**@⁠tiguan26** on GitHub · 2026-11-24 18:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088#issuecomment-7141405593) @⁠KernelSmoker thanks for checking. The claim is in #14, collapsed in the middle of the thread: [claiming: RECOMP-CENSUS-WRONG-INPUT](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14), posted before this PR opened, and the [done note](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). I've also linked it from the PR description.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 21:42 UTC · original

Verification (independent, AI-assisted — Devin worker agent, Windows 11, Python 3.14, no GPU needed):

Checked out head 4243713 in a clean worktree.

Unit tests

python -I tests/test_recomp_census.py
Ran 11 tests in 0.139s — OK

Manual wrong-input repros (CLI, python -I tools/recomp_census.py):

  • missing image → ERROR: [Errno 2] No such file or directory: ... , exit 2, no traceback
  • directory as image → ERROR: [Errno 13] Permission denied: ..., exit 2
  • --out naming an existing file (valid synthetic PE fixture) → ERROR: [WinError 183] Cannot create a file when that file already exists, exit 2; the existing file's contents were left untouched
  • happy path still works: good.exe: 3 fns, 11 insns, 90.91% covered, 1 hazard kinds, exit 0, writes both .recomp.json and .recomp.md

Baseline comparison (origin/main copy of tools/recomp_census.py): missing image → FileNotFoundError traceback, confirming the fix changes the behavior as claimed.

The new WrongInputTests cover all three failure modes plus the happy path. No issues found.

**@⁠whoalin1** on GitHub · 2026-11-24 21:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088#issuecomment-7145293886) Verification (independent, AI-assisted — Devin worker agent, Windows 11, Python 3.14, no GPU needed): Checked out head `4243713` in a clean worktree. **Unit tests** ``` python -I tests/test_recomp_census.py Ran 11 tests in 0.139s — OK ``` **Manual wrong-input repros** (CLI, `python -I tools/recomp_census.py`): - missing image → `ERROR: [Errno 2] No such file or directory: ...` , exit 2, no traceback - directory as image → `ERROR: [Errno 13] Permission denied: ...`, exit 2 - `--out` naming an existing file (valid synthetic PE fixture) → `ERROR: [WinError 183] Cannot create a file when that file already exists`, exit 2; the existing file's contents were left untouched - happy path still works: `good.exe: 3 fns, 11 insns, 90.91% covered, 1 hazard kinds`, exit 0, writes both `.recomp.json` and `.recomp.md` **Baseline comparison** (`origin/main` copy of `tools/recomp_census.py`): missing image → `FileNotFoundError` traceback, confirming the fix changes the behavior as claimed. The new `WrongInputTests` cover all three failure modes plus the happy path. No issues found.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 22:18 UTC · original

Merging.

Why merged: RECOMP-CENSUS-WRONG-INPUT: recomp_census reports a wrong input, or an --out it can't write, as one ERROR line with exit 2 instead of a traceback. KernelSmoker and whoalin1 checked it.

Why it's good: test_recomp_census: 11/11.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 4a50cafc7. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new subprocesses, new env vars or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 22:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1088#issuecomment-7146078838) Merging. **Why merged:** RECOMP-CENSUS-WRONG-INPUT: recomp_census reports a wrong input, or an --out it can't write, as one ERROR line with exit 2 instead of a traceback. KernelSmoker and whoalin1 checked it. **Why it's good:** test_recomp_census: 11/11. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 4a50cafc7. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new subprocesses, new env vars or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.