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

Merged
leonida/mandy
xel1uz merged 1 commit from fix/valu-arg-guards into main 2026-11-29 19:00:53 +00:00

Pull request successfully merged and closed

xel1uz commented 2026-11-25 06:11:29 +00:00

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.
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.
PierreEbele commented 2026-11-25 15:45:36 +00:00

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

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
MoonEyes commented 2026-11-28 03:02:43 +00:00

Hi @xel1uz, thanks for this pull request.

CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post claiming: <ID> there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one.

The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time.

Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough.

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

Hi @xel1uz, thanks for this pull request. CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post `claiming: <ID>` there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one. The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time. Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough. AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 20:43:32 +00:00

#1621 | head 4895f47555da59e2dea499ba93b11aa7873e5877 (merged cleanly with main 1bc055e6c2) | python -I tests/test_valu_int_diff.py | red on main: FAILED (failures=4) (--max-ops 0 and -1 reported harness error: empty range in randrange, while --programs 0 and -1 exited 0 silently) | green on PR+main: 5 tests OK | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited tools/valu_int_diff.py and tests/test_valu_int_diff.py on Windows 11, verifying args.programs < 1 and args.max_ops < 1 raise ap.error(...) (exit 2) before --self-test or run_fuzz, while preserving --programs 1 --max-ops 1 and 100-program seeded runs. Also verified tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

#1621 | head 4895f47555da59e2dea499ba93b11aa7873e5877 (merged cleanly with main 1bc055e6c2) | `python -I tests/test_valu_int_diff.py` | red on main: `FAILED (failures=4)` (`--max-ops 0` and `-1` reported `harness error: empty range in randrange`, while `--programs 0` and `-1` exited `0` silently) | green on PR+main: `5 tests OK` | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `tools/valu_int_diff.py` and `tests/test_valu_int_diff.py` on Windows 11, verifying `args.programs < 1` and `args.max_ops < 1` raise `ap.error(...)` (exit `2`) before `--self-test` or `run_fuzz`, while preserving `--programs 1 --max-ops 1` and 100-program seeded runs. Also verified `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-29 00:17:05 +00:00

Tested 4895f4755 merged (no commit) with main 829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • Green: tests/test_valu_int_diff.py, 5 tests pass.
  • Red: with tools/valu_int_diff.py back to main, 4 failures (0 != 2).

No blocker from my side.

AI-assisted (Claude Code).

Tested `4895f4755` merged (no commit) with `main` `829530dbd`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - Green: `tests/test_valu_int_diff.py`, 5 tests pass. - Red: with `tools/valu_int_diff.py` back to `main`, 4 failures (`0 != 2`). No blocker from my side. AI-assisted (Claude Code).
TheGeogeo commented 2026-11-29 11:51:54 +00:00

Tested green here earlier on this same head (see my comment above). The only thing missing for a merge is your claim in the coordination issue #2570.

AI-assisted (Claude Code).

Tested green here earlier on this same head (see my comment above). The only thing missing for a merge is your claim in the coordination issue #2570. AI-assisted (Claude Code).
TheGeogeo commented 2026-11-29 18:50:06 +00:00

Tested 4895f4755 merged (no commit) with main 7c330c76d: Python 3.12.4, Windows 11 10.0.26300, CPU only.

  • Green: tests/test_valu_int_diff.py gives 5 tests OK.
  • Red: with tools/valu_int_diff.py back to main, test_rejects_nonpositive_count_arguments fails for --max-ops and --programs at 0 and -1 (4 subtests, 0 != 2).
  • Base: main's own version gives 3 tests OK. check_no_game_data.py is clean.

AI-assisted (Claude Code).

Tested `4895f4755` merged (no commit) with `main` `7c330c76d`: Python 3.12.4, Windows 11 10.0.26300, CPU only. - Green: `tests/test_valu_int_diff.py` gives 5 tests OK. - Red: with `tools/valu_int_diff.py` back to `main`, `test_rejects_nonpositive_count_arguments` fails for `--max-ops` and `--programs` at 0 and -1 (4 subtests, `0 != 2`). - Base: `main`'s own version gives 3 tests OK. `check_no_game_data.py` is clean. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 19:00:49 +00:00

Merging. Head 4895f4755 has red/green verdicts from reviewers other than the author (above), merges cleanly with main 545f610fa, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-tests mesh, semantic-tests f16) are pre-existing. Merged by MoonEyes.

AI-assisted (Claude Code).

Merging. Head `4895f4755` has red/green verdicts from reviewers other than the author (above), merges cleanly with `main` `545f610fa`, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (`translator-tests` mesh, `semantic-tests` f16) are pre-existing. Merged by MoonEyes. AI-assisted (Claude Code).
Sign in to join this conversation.
No description provided.