[PR #1619] f16misc_diff: reject a zero or negative --max-ops and --programs #1633

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

📋 Pull Request Information

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

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


📝 Commits (1)

  • 1ded3b4 f16misc_diff: reject a zero or negative --max-ops and --programs

📊 Changes

2 files changed (+62 additions, -7 deletions)

View changed files

📝 tests/test_f16misc_diff.py (+49 -1)
📝 tools/f16misc_diff.py (+13 -6)

📄 Description

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

Claimed as: F16MISC-ARG-GUARDS - --max-ops 0 dies in numpy's randint and --programs 0 exits 0 having run no random program. Reproduced on 42537e7b.

What and why

f16misc_diff validated neither of its two count options, so --max-ops 0 ended in ValueError: empty range in randint(1, 0) from random.randint and --programs 0 finished with exit 0 and nothing but sweep lines. Both are now rejected in main() right after parse_args, before the sweep, --list-ops and --self-test: --max-ops must be at least 1 and --programs must be at least 1, via ap.error (exit 2, usage line, no traceback). The dead --programs > 0 stage gate and the docstring's exit-code line are updated; the smallest valid run is byte-identical before and after.

Tested

  • pytest tests/test_f16misc_diff.py -q with the tool at 42537e7b: 5 failed, 28 passed - only the new guard cases fail, the valid-run case passes on both sides.

  • With this branch: 33 passed in 39.8s.

  • CLI on the branch: --max-ops 0 and --programs 0 each print the message and exit 2; --self-test and --list-ops still exit 0.

  • 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/1619 **Author:** [@xel1uz](https://github.com/xel1uz) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/f16misc-arg-guards` --- ### 📝 Commits (1) - [`1ded3b4`](https://github.com/ubiquitarianism/leonida/commit/1ded3b4d8e2939d7cf2ca7ce535917afb440ff69) f16misc_diff: reject a zero or negative --max-ops and --programs ### 📊 Changes **2 files changed** (+62 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_f16misc_diff.py` (+49 -1) 📝 `tools/f16misc_diff.py` (+13 -6) </details> ### 📄 Description Item ID: `F16MISC-ARG-GUARDS` (new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here) Claimed as: `F16MISC-ARG-GUARDS` - `--max-ops 0` dies in numpy's randint and `--programs 0` exits 0 having run no random program. Reproduced on 42537e7b. ### What and why `f16misc_diff` validated neither of its two count options, so `--max-ops 0` ended in `ValueError: empty range in randint(1, 0)` from `random.randint` and `--programs 0` finished with exit 0 and nothing but sweep lines. Both are now rejected in `main()` right after `parse_args`, before the sweep, `--list-ops` and `--self-test`: `--max-ops must be at least 1` and `--programs must be at least 1`, via `ap.error` (exit 2, usage line, no traceback). The dead `--programs > 0` stage gate and the docstring's exit-code line are updated; the smallest valid run is byte-identical before and after. ### Tested - `pytest tests/test_f16misc_diff.py -q` with the tool at 42537e7b: **5 failed, 28 passed** - only the new guard cases fail, the valid-run case passes on both sides. - With this branch: **33 passed in 39.8s**. - CLI on the branch: `--max-ops 0` and `--programs 0` each print the message and exit 2; `--self-test` and `--list-ops` still exit 0. - `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#1633
No description provided.