sad_diff: reject a zero or negative --max-ops and --programs #1624
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1624
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/sad-arg-guards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Item ID:
SAD-ARG-GUARDS(new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here)Claimed as:
SAD-ARG-GUARDS---max-ops 0dies in numpy's randint and--programs 0exits 0 having run no random program. Reproduced on 42537e7b.What and why
sad_diffvalidated neither count option:--max-ops 0ended inValueError: empty range in randint(1, 0)and--programs 0exited 0 after printing only sweep statistics andSAD family: 785/785 programs match. Both are now rejected inmain()right afterparse_args, before the sweep and--self-test:--max-ops must be at least 1and--programs must be at least 1viaap.error(exit 2, usage line, no traceback). Valid runs are unchanged.Tested
pytest tests/test_sad_diff.py -qwith the tool at 42537e7b: 4 failed, 14 passed.With this branch: 14 passed, 4 subtests passed.
CLI:
--max-ops 0and--programs 0each print the message and exit 2;--self-teststill exits 0.git diff --checkclean;python3 -I scripts/check_no_game_data.pyclean on the changed files.GPUs tested: n/a - CPU only, no Vulkan device involved.
AI-assisted: Yes.
Checklist
main(42537e7b) and merges cleanly.docs/design.md- not applicable, no translator change.Independent verification (Windows, Python 3.11.9
-I -W error): +4-line guard, tests via subprocess CLI.test_sad_diff.py14 OK; probes without--no-sweepall exit 2 before any stage;--self-testok; valid run 2/2 match; hygiene checks clean. (Note:main()takes no argv param unlike siblings — harmless, tests cover via subprocess.) AI-assisted verification.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).
Tested
e55d9b7fcmerged (no commit) withmain829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_sad_diff.py, it passes (exit 0).tools/sad_diff.pyback tomain, it exits 1:test_zero_or_negative_counts_are_usage_errors_before_any_workfails for--max-o...and--progr....No blocker from my side.
AI-assisted (Claude Code).
Native Windows 11 Verification (
e55d9b7fc1) — PASSDiff-audited
tools/sad_diff.py(+4/-0) andtests/test_sad_diff.py(+27/-0) and verified Red -> Green merged ontoorigin/main(48bae6cad) on Windows 11 (10.0.26200, Python3.12.10with-I).Results
origin/main48bae6cad):python -I tools/sad_diff.py --no-sweep --max-ops 0crashed with an unhandled traceback (ValueError: empty range in randrange(1, 1),rc=1).PR #1624merged ontoorigin/main):python -I tests/test_sad_diff.py:rc=0(OK) —0and-1on both--max-opsand--programsexit2cleanly with--max-ops must be at least 1/--programs must be at least 1before any sweep runs, and seeded runs (2/2and6programs) continue to match.tests/test_ci_registration.py(18/18),tests/test_text_write_line_endings.py(3/3), andscripts/check_no_game_data.py:OK.AI-assisted.
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
e55d9b7fcmerged (no commit) withmain7c330c76d: Python 3.12.4, Windows 11 10.0.26300, CPU only.python -I tests/test_sad_diff.pygives 14 tests OK.tools/sad_diff.pyback tomain,test_zero_or_negative_counts_are_usage_errors_before_any_workfails for--max-opsand--programsat 0 and -1 (4 subtests).main's own version of that test gives 12 tests OK.check_no_game_data.pyis clean.AI-assisted (Claude Code).
Merging. Head
e55d9b7fchas red/green verdicts from reviewers other than the author (above), merges cleanly withmain79f89c490, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-testsmesh,semantic-testsf16) are pre-existing. Merged by MoonEyes.AI-assisted (Claude Code).