dstorage_census: a wrong input is one ERROR line, not a traceback (DSTORAGE-CENSUS-WRONG-INPUT) #1500

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

@⁠levi2m on GitHub · 2026-11-25 02:20 UTC · original
levi2m:fix/dstorage-census-wrong-input → main · +133 −8 · 2 files · 1 commits · open

Claimed in the coordination issue as: DSTORAGE-CENSUS-WRONG-INPUT (claim)
Depends on: none
Fixes: none

What and why

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

  • a trace path that does not exist (FileNotFoundError) or is a folder (IsADirectoryError);
  • a [rt] ds-request line with a missing field (KeyError: 'dest') or a malformed number (ValueError from int(..., 16)), for example a trace cut off mid-line.

Each is now one ERROR: line on stderr and exit code 2, like recomp_census (#1088). The census loop is unchanged: census() wraps it and turns a KeyError/ValueError into a TraceError that names the line number and the field. main() is split out of the __main__ block so it can be tested; output and exit code 0 for a good trace are unchanged.

Found by running every tools/*.py against a missing path, an empty file, a junk file and a folder. The other tools that traceback in that sweep (gbuffer_census, navmesh_cell_fit, root_spill_census) are covered by #952, so they are left alone.

Tested

  • python -I tests/test_dstorage_census.py: 7 tests OK (new file: a good trace, missing field, malformed number, missing path, folder, truncated line, exit 0 on a good trace). With the old tool the same file fails 5 of 7.
  • python -m compileall -q tools tests, tests/test_text_write_line_endings.py, tests/test_docs_cli_flags.py, tests/test_docs_links.py, tests/test_tool_stdout_encoding.py: OK.
  • scripts/check_no_game_data.py on both files: clean. Traces in the test are built by hand; no game files, no GPU.

GPUs tested: n/a (CPU-only tool and test)
AI-assisted: yes

**@⁠levi2m** on GitHub · 2026-11-25 02:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1500) `levi2m:fix/dstorage-census-wrong-input` → `main` · +133 −8 · 2 files · 1 commits · open Claimed in the coordination issue as: DSTORAGE-CENSUS-WRONG-INPUT ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) Depends on: none Fixes: none ### What and why `tools/dstorage_census.py` stopped with a Python traceback on a wrong input: - a trace path that does not exist (`FileNotFoundError`) or is a folder (`IsADirectoryError`); - a `[rt] ds-request` line with a missing field (`KeyError: 'dest'`) or a malformed number (`ValueError` from `int(..., 16)`), for example a trace cut off mid-line. Each is now one `ERROR:` line on stderr and exit code 2, like `recomp_census` (#1088). The census loop is unchanged: `census()` wraps it and turns a `KeyError`/`ValueError` into a `TraceError` that names the line number and the field. `main()` is split out of the `__main__` block so it can be tested; output and exit code 0 for a good trace are unchanged. Found by running every `tools/*.py` against a missing path, an empty file, a junk file and a folder. The other tools that traceback in that sweep (`gbuffer_census`, `navmesh_cell_fit`, `root_spill_census`) are covered by #952, so they are left alone. ### Tested - `python -I tests/test_dstorage_census.py`: 7 tests OK (new file: a good trace, missing field, malformed number, missing path, folder, truncated line, exit 0 on a good trace). With the old tool the same file fails 5 of 7. - `python -m compileall -q tools tests`, `tests/test_text_write_line_endings.py`, `tests/test_docs_cli_flags.py`, `tests/test_docs_links.py`, `tests/test_tool_stdout_encoding.py`: OK. - `scripts/check_no_game_data.py` on both files: clean. Traces in the test are built by hand; no game files, no GPU. GPUs tested: n/a (CPU-only tool and test) AI-assisted: yes
A trace path that does not exist (FileNotFoundError), a folder for the
trace (IsADirectoryError) and a ds-request line with a missing field
(KeyError) or a malformed number (ValueError) stopped the tool with a
traceback. Each now prints one ERROR line and exits 2, like
tools/recomp_census.py. census() wraps the unchanged loop and names the
line and the field; main() is split out so it can be tested.

Synthetic traces only; no game files.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:21 +00:00
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:36 UTC · original · edited 2026-11-25 03:44 UTC

[KEEP]

  • No CI checks have run on fix/dstorage-census-wrong-input (none reported), so the stated test results are unverified; this is the only blocker I found.
  • The diff to tools/dstorage_census.py is small and scoped: census() now converts KeyError/ValueError into TraceError with the line number and field, and main() turns OSError/TraceError into one ERROR: line with exit code 2. Output for a good trace is unchanged.
  • New tests/test_dstorage_census.py covers missing path, folder, missing field, malformed number, truncated line and the good-trace exit 0. No overlapping open PR touches dstorage_census, and the PR is mergeable.
  • Should be ready to merge once CI is green.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1500#issuecomment-7152073044) · edited 2026-11-25 03:44 UTC **[KEEP]** - No CI checks have run on `fix/dstorage-census-wrong-input` (none reported), so the stated test results are unverified; this is the only blocker I found. - The diff to `tools/dstorage_census.py` is small and scoped: `census()` now converts `KeyError`/`ValueError` into `TraceError` with the line number and field, and `main()` turns `OSError`/`TraceError` into one `ERROR:` line with exit code 2. Output for a good trace is unchanged. - New `tests/test_dstorage_census.py` covers missing path, folder, missing field, malformed number, truncated line and the good-trace exit 0. No overlapping open PR touches `dstorage_census`, and the PR is mergeable. - Should be ready to merge once CI is green.
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-25 03:54 UTC · original · approved these changes

Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Same shape as the other wrong-input fixes (#1088, #952): an unreadable trace or a ds-request line with a missing or malformed field is one ERROR line with the line number and exit 2, and a good trace prints the same JSON as before.

AI-assisted (Claude).

**@⁠tiguan26** on GitHub · 2026-11-25 03:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1500#pullrequestreview-6051627178) · **approved these changes** Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Same shape as the other wrong-input fixes (#1088, #952): an unreadable trace or a ds-request line with a missing or malformed field is one ERROR line with the line number and exit 2, and a good trace prints the same JSON as before. AI-assisted (Claude).
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/1500/head:github-bot/gh-1500'
git switch 'github-bot/gh-1500'

Merge

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