[PR #1621] valu_int_diff: report a bad --max-ops/--programs as a usage error #1637

Open
opened 2026-11-26 20:21:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1621
Author: @xel1uz
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/valu-arg-guards


📝 Commits (1)

  • 4895f47 valu_int_diff: reject a zero or negative --max-ops and --programs

📊 Changes

2 files changed (+35 additions, -2 deletions)

View changed files

📝 tests/test_valu_int_diff.py (+29 -0)
📝 tools/valu_int_diff.py (+6 -2)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1621 **Author:** [@xel1uz](https://github.com/xel1uz) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/valu-arg-guards` --- ### 📝 Commits (1) - [`4895f47`](https://github.com/ubiquitarianism/leonida/commit/4895f47555da59e2dea499ba93b11aa7873e5877) valu_int_diff: reject a zero or negative --max-ops and --programs ### 📊 Changes **2 files changed** (+35 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_valu_int_diff.py` (+29 -0) 📝 `tools/valu_int_diff.py` (+6 -2) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1637
No description provided.