interp_hw_probe: harden CLI parsing, oracle batch/word validation, and error lifecycle #1680
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!1680
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/interp-hw-probe-cli-and-oracle"
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:
INTERP-HW-PROBE-CLI-AND-ORACLE(claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156453676)Summary
tools/interp_hw_probe.py):--arch, non-positive--kernels < 1, and empty/trailing-comma--seedstokens with argparse exit code2.--seedswhile preserving order so identical random kernel batches are not run twice._validate_batch()used for both the random kernel batches and the tie kernel to verify thato.run()returns alist/tuplematching the exact kernel count and that each non-string entry is alist/tupleof at leastexpected_wordsnon-boolintwords (masking to 32 bits), preventing false passes on empty/short responses and uncaughtIndexError/TypeError.runner.Unavailable(exit77) andRuntimeError(exit2) raised duringo.run()insidetry ... finally: o.close().2iftallyis empty (no checks executed).(o[i2] & 0xFFFFFFFF) >> 16 == 0xDEADincheck_random().tests/test_interp_hw_probe.py):--arch, non-positive--kernels, malformed/deduplicated--seeds, malformed oracle batch/word responses,runner.Unavailable-> exit77,RuntimeError-> exit2, and 32-bit canary masking incheck_random().Checklist & Verification
python3 -I scripts/check_no_game_data.py tools/interp_hw_probe.py tests/test_interp_hw_probe.pypassed)python3 -W error -I tests/test_interp_hw_probe.py -v:Ran 24 tests ... OKtests/test_interp_hw_probe.pyagainst unpatchedmaintools/interp_hw_probe.py):Ran 24 tests ... FAILED (failures=8, errors=5)python3 -m compileall -q make_game.py tools tests: passedpython3 -I tests/test_text_write_line_endings.py:Ran 3 tests ... OKIndependent verification (Windows, Python 3.11.9
-I -W error):_validate_batchenforces kernel count + per-result non-bool int words (masked 32-bit,expected_words= nout*LANES verified), CLI rejects empty--arch/--kernels<1/bad--seedswith dedup, Unavailable->77 / RuntimeError->2 with close() in finally, canary check mask fix correct.test_interp_hw_probe.py24 OK; all bad-CLI probes -> SystemExit 2; compileall + line-endings + check_no_game_data clean. AI-assisted verification.Independent review (CPU-only Windows 11, python 3.14.9
-I; head73e962741, current main57ba40bd6).Coordination. Claim 7156453676 (IlyassRS3, 2026-11-25T07:58:05Z) predates the PR (07:59:32Z); roster shows
done: INTERP-HW-PROBE-CLI-AND-ORACLE -> #1680.gh pr list --search interp_hw_probe --state allreturns only this PR.The new tests bite (inverse check).
tests/test_interp_hw_probe.pyat head:Ran 24 tests ... OK(main's copy runs 22, so +2 exactly as claimed). The same file against main'stools/interp_hw_probe.py:FAILED (failures=8, errors=5)— every failure is inside the two new CliTest methods (subTest inflates the count): empty/whitespace--arch,--kernels 0/-2, malformed--seedsall exit 0/77 instead of 2 on main, and the malformed-oracle cases raise uncaughtTypeError/IndexError/AttributeErrortracebacks on main where the patched tool returns clean exit-2harness error:lines. All 22 pre-existing tests stay green against main, so the delta is fully localized.Code notes.
_validate_batchcovers empty/None batch, short rows, bool words, and string rejections; the string-rejection check comes before the type check, so an assembler rejection still printskernel failed:-equivalent asharness error: kernel failed: ...with exit 2. Fine, but note the old code'sprint("kernel failed: ...")path now folds into the generic harness-error text — a message change, not a behavior regression.dict.fromkeys, preserving order —--seeds "7, 7"runs one seed batch plus the tie kernel (test assertscalls == [1, 1]), verified at head.--seedsvalidation rejects any empty token ("1,",",2",""), exit 2;--kernelsgets its own< 1guard since argparsetype=intalready rejects non-numeric.if not tally: harness error: no checks were executedprevents a vacuous exit 0.Mergeability.
git diff 3f81d46ac..origin/mainover the PR's two files is 0 bytes — main's later merges touch disjoint files, so this rebases clean.check_no_game_data.pyon both files exits 0;compileallclean. CI (change-scope,no-game-data) pending at head when I looked.Verdict: LGTM — hardening is real against unpatched main (crashes turn into clean exit-2 harness errors), tests localize to the new code, and the branch rebases onto current main.
AI-assisted (Hermes overnight shift). Note whoalin1's independent verification comment above already covers the oracle-behavior probes; mine adds the count-move gate (22→24) and the rebase check against moved main.
#1680 | head
73e962741df29d97dade8213e52f631124fdeee0|python3 -I tests/test_interp_hw_probe.py -v| red: 24 run, 8 failures, 5 errors | green: 24 passed | Red → greenThe tests exercised CLI parsing, malformed oracle batches and word counts, and failure cleanup. All 24 passed after merging.
Copied the PR tests onto clean main
4a54aedcb6b66525e0c9f72a6ea10263337c9141for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.Merged, thank you @IlyassRS3! This PR (interp_hw_probe: harden CLI parsing, oracle batch/word validation, and error lifecycle) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.