OLD-9807: buffer_bounds_probe non-numeric --waves exits 2 instead of a traceback (carries #80) #1299

Closed
muhammadumairmustafa wants to merge 3 commits from upstream-pr/1299 into main
muhammadumairmustafa commented 2026-11-24 21:30:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by muhammadumairmustafa on 2026-11-24T21:30:30Z.


Claimed in the coordination issue as: OLD-9807 (in #14)

What and why

Carries forward old-pr/9807 (draft #80, originally by nino-exe).

A non-numeric --waves argument (e.g. --waves 32,abc) in tools/buffer_bounds_probe.py raised an uncaught ValueError traceback and exited 1, whereas the docstring specifies bad arguments exit 2. Wrapping the integer parse in try / except ValueError lets invalid values fall through to the existing validation check that prints the error and returns 2. Adds test_waves_that_are_not_numbers in tests/test_buffer_bounds_probe.py.

Tested

Ran python -I tests/test_buffer_bounds_probe.py locally on Windows (CPU-only, synthetic tests only, no game files): 6 tests run in 0.830s, OK.

AI-assisted: yes

Checklist

  • 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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480665625 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1299). Originally posted by [muhammadumairmustafa](https://github.com/muhammadumairmustafa) on 2026-11-24T21:30:30Z. --- Claimed in the coordination issue as: OLD-9807 (in #14) ### What and why Carries forward `old-pr/9807` (draft #80, originally by `nino-exe`). A non-numeric `--waves` argument (e.g. `--waves 32,abc`) in `tools/buffer_bounds_probe.py` raised an uncaught `ValueError` traceback and exited `1`, whereas the docstring specifies bad arguments exit `2`. Wrapping the integer parse in `try / except ValueError` lets invalid values fall through to the existing validation check that prints the error and returns `2`. Adds `test_waves_that_are_not_numbers` in `tests/test_buffer_bounds_probe.py`. ### Tested Ran `python -I tests/test_buffer_bounds_probe.py` locally on Windows (CPU-only, synthetic tests only, no game files): 6 tests run in 0.830s, OK. AI-assisted: yes ### Checklist - [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.
fin-github commented 2026-11-24 21:41:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fin-github on 2026-11-24T21:41:35Z.

Review: COMMENTED


  • python -I tests/test_buffer_bounds_probe.py on the PR: 6 tests OK.
  • The PR's test file against main (4a50cafc7): test_waves_that_are_not_numbers fails, so the test catches it.

Turning the ValueError into an empty list so the existing message and exit 2 handle it is neat. Nit: the new test
method has no blank line before or after it (the old blank line after test_bad_waves was replaced), unlike the
rest of the class.

Tested on Windows 11 Pro 26200, CPython 3.14.4, applied on main 4a50cafc7. No GPU or game files used. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6047867492 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1299#pullrequestreview-6047867492). Originally posted by [fin-github](https://github.com/fin-github) on 2026-11-24T21:41:35Z. **Review:** COMMENTED --- - `python -I tests/test_buffer_bounds_probe.py` on the PR: 6 tests OK. - The PR's test file against `main` (4a50cafc7): `test_waves_that_are_not_numbers` fails, so the test catches it. Turning the `ValueError` into an empty list so the existing message and exit 2 handle it is neat. Nit: the new test method has no blank line before or after it (the old blank line after `test_bad_waves` was replaced), unlike the rest of the class. Tested on Windows 11 Pro 26200, CPython 3.14.4, applied on main 4a50cafc7. No GPU or game files used. AI-assisted (Claude Code).
muhammadumairmustafa commented 2026-11-24 22:07:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by muhammadumairmustafa on 2026-11-24T22:07:01Z.


  • python -I tests/test_buffer_bounds_probe.py on the PR: 6 tests OK.
  • The PR's test file against main (4a50caf): test_waves_that_are_not_numbers fails, so the test catches it.

Turning the ValueError into an empty list so the existing message and exit 2 handle it is neat. Nit: the new test method has no blank line before or after it (the old blank line after test_bad_waves was replaced), unlike the rest of the class.

Tested on Windows 11 Pro 26200, CPython 3.14.4, applied on main 4a50caf. No GPU or game files used. AI-assisted (Claude Code).

Thanks for testing and reviewing! Restored the blank lines before and after test_waves_that_are_not_numbers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7145824266 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1299#issuecomment-7145824266). Originally posted by [muhammadumairmustafa](https://github.com/muhammadumairmustafa) on 2026-11-24T22:07:01Z. --- > * `python -I tests/test_buffer_bounds_probe.py` on the PR: 6 tests OK. > * The PR's test file against `main` ([4a50caf](https://github.com/ubiquitarianism/leonida/commit/4a50cafc7af8b5a842c85a3794b286232495068d)): `test_waves_that_are_not_numbers` fails, so the test catches it. > > Turning the `ValueError` into an empty list so the existing message and exit 2 handle it is neat. Nit: the new test method has no blank line before or after it (the old blank line after `test_bad_waves` was replaced), unlike the rest of the class. > > Tested on Windows 11 Pro 26200, CPython 3.14.4, applied on main [4a50caf](https://github.com/ubiquitarianism/leonida/commit/4a50cafc7af8b5a842c85a3794b286232495068d). No GPU or game files used. AI-assisted (Claude Code). Thanks for testing and reviewing! Restored the blank lines before and after `test_waves_that_are_not_numbers`.
DadaCap commented 2026-11-28 11:33:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:33:52Z.


Thanks for the fix! We're closing this because #2203 contains the same change to tools/buffer_bounds_probe.py (a non-numeric --waves exits with a usage error instead of a traceback), with the same test, plus matching fixes in find_hash_lookup, so the two cannot both be merged. If this looks like a mistake, mention @DadaCap here at any time.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238634958 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1299#issuecomment-7238634958). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T11:33:52Z. --- Thanks for the fix! We're closing this because #2203 contains the same change to `tools/buffer_bounds_probe.py` (a non-numeric `--waves` exits with a usage error instead of a traceback), with the same test, plus matching fixes in `find_hash_lookup`, so the two cannot both be merged. If this looks like a mistake, mention @DadaCap here at any time. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1299
No description provided.