valu_int_diff: report a bad --max-ops/--programs as a usage error #1621

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

@⁠xel1uz on GitHub · 2026-11-25 06:11 UTC · original
xel1uz:fix/valu-arg-guards → main · +35 −2 · 2 files · 1 commits · open

Item ID: VALU-ARG-GUARDS (new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here)

Claimed as: VALU-ARG-GUARDS - --max-ops 0 is reported as harness error and --programs 0 exits 0 with 0 programs. Reproduced on 42537e7b.

What and why

valu_int_diff let randint(1, 0) fail through its harness-error path, so a plain usage mistake read like a broken harness, and --programs 0 exited 0 after running nothing (0 programs (seed 1): 0 pass, 0 mismatch). Both are now rejected in main() right after parse_args with --programs must be at least 1 / --max-ops must be at least 1 through ap.error (exit 2, argument-style wording, no harness wording). The docstring's exit-code line names usage errors.

Tested

  • pytest tests/test_valu_int_diff.py -q with the tool at 42537e7b: 4 failed, 5 passed.

  • With this branch: 5 passed, 4 subtests passed.

  • CLI: --max-ops 0 and --programs -2 now exit 2 with the argument message; --programs 3 --max-ops 4 still exits 0 with 3 pass.

  • git diff --check clean; python3 -I scripts/check_no_game_data.py clean on the changed files.

GPUs tested: n/a - CPU only, no Vulkan device involved.

AI-assisted: Yes.

Checklist

  • Based on current main (42537e7b) and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption; synthetic inputs only.
  • A new translator rule in the contract table of docs/design.md - not applicable, no translator change.
**@⁠xel1uz** on GitHub · 2026-11-25 06:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1621) `xel1uz:fix/valu-arg-guards` → `main` · +35 −2 · 2 files · 1 commits · open Item ID: `VALU-ARG-GUARDS` (new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here) Claimed as: `VALU-ARG-GUARDS` - `--max-ops 0` is reported as `harness error` and `--programs 0` exits 0 with `0 programs`. Reproduced on 42537e7b. ### What and why `valu_int_diff` let `randint(1, 0)` fail through its harness-error path, so a plain usage mistake read like a broken harness, and `--programs 0` exited 0 after running nothing (`0 programs (seed 1): 0 pass, 0 mismatch`). Both are now rejected in `main()` right after `parse_args` with `--programs must be at least 1` / `--max-ops must be at least 1` through `ap.error` (exit 2, argument-style wording, no harness wording). The docstring's exit-code line names usage errors. ### Tested - `pytest tests/test_valu_int_diff.py -q` with the tool at 42537e7b: **4 failed, 5 passed**. - With this branch: **5 passed, 4 subtests passed**. - CLI: `--max-ops 0` and `--programs -2` now exit 2 with the argument message; `--programs 3 --max-ops 4` still exits 0 with `3 pass`. - `git diff --check` clean; `python3 -I scripts/check_no_game_data.py` clean on the changed files. GPUs tested: n/a - CPU only, no Vulkan device involved. AI-assisted: Yes. ### Checklist - [x] Based on current `main` (42537e7b) and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption; synthetic inputs only. - [ ] A new translator rule in the contract table of `docs/design.md` - not applicable, no translator change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:58:26 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 15:45 UTC · original

Reviewed 4895f4755: ran tests/test_valu_int_diff.py on the PR (5 tests OK) and on main with the PR's test file copied in (the new tests fail on main as intended: silent empty runs and "harness error" become exit-2 usage errors); probed the CLI on both trees: bad counts exit 2 with "must be at least 1", valid runs byte-identical; compileall clean. No findings.

AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 15:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1621#issuecomment-7167296250) Reviewed 4895f4755: ran tests/test_valu_int_diff.py on the PR (5 tests OK) and on main with the PR's test file copied in (the new tests fail on main as intended: silent empty runs and "harness error" become exit-2 usage errors); probed the CLI on both trees: bad counts exit 2 with "must be at least 1", valid runs byte-identical; compileall clean. No findings. AI-assisted review. **Recommendation:** Merge
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/1621/head:github-bot/gh-1621'
git switch 'github-bot/gh-1621'

Merge

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