vint_diff: restore globals, validate hardware oracle/shrink results and CLI options, and tighten RefError checks #1656

Open
github-bot wants to merge 1 commit from github-bot/gh-1656 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-25 07:20 UTC · original
IlyassRS3:fix/vint-diff-oracle-cli-and-ref → main · +170 −12 · 2 files · 1 commits · open

Item ID: VINT-DIFF-ORACLE-CLI-AND-REF
Claim: #1608

Summary

  • Module state restoration (tools/vint_diff.py): restore KNOWN and LITERALS in main()'s finally block (and handle --list-ops/--self-test before mutating them) so in-process runs do not leak flags.
  • Hardware oracle & shrink guards: add hw_run() validating oracle is not None and exact result-list length across both run_suite() and shrink check_fn (preventing AttributeError / IndexError on empty or short oracle responses); validate 4-word tuples/lists in _diff(); catch transient Skip during final shrunk recheck and fall back to problem.
  • CLI validation: reject empty/whitespace --hw-arch, --build, and --work.
  • Reference validation: raise RefError instead of silent misbehaviour or raw ValueError/KeyError/IndexError/TypeError on invalid operands, non-pair 64-bit sources/destinations, unknown or malformed v_cmp_* / v_cndmask_b32_e64 / s_mov_b32 forms, wrong source counts, and unsupported op_sel modifiers (non-OP_SEL_OPS, wrong length, or non-zero trailing selector bits).
  • Tests (tests/test_vint_diff.py): add 4 regression tests covering all of the above.

Verification

  • python3 -W error -I tests/test_vint_diff.py -v: 29 passed, 0 failed (2.718s).
  • Mutation check against unpatched main: ran=29, failures=9, errors=7.
  • python3 -m compileall -q tools/vint_diff.py tests/test_vint_diff.py, python3 -I tests/test_text_write_line_endings.py, python3 -I scripts/check_no_game_data.py: all pass.

AI-assisted: yes
GPUs tested: none (CPU unit tests with stubbed hardware oracle and spirv_mini_interp; no game data)

**@⁠IlyassRS3** on GitHub · 2026-11-25 07:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1656) `IlyassRS3:fix/vint-diff-oracle-cli-and-ref` → `main` · +170 −12 · 2 files · 1 commits · open Item ID: `VINT-DIFF-ORACLE-CLI-AND-REF` Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 ## Summary - **Module state restoration (`tools/vint_diff.py`)**: restore `KNOWN` and `LITERALS` in `main()`'s `finally` block (and handle `--list-ops`/`--self-test` before mutating them) so in-process runs do not leak flags. - **Hardware oracle & shrink guards**: add `hw_run()` validating `oracle is not None` and exact result-list length across both `run_suite()` and shrink `check_fn` (preventing `AttributeError` / `IndexError` on empty or short oracle responses); validate 4-word tuples/lists in `_diff()`; catch transient `Skip` during final shrunk recheck and fall back to `problem`. - **CLI validation**: reject empty/whitespace `--hw-arch`, `--build`, and `--work`. - **Reference validation**: raise `RefError` instead of silent misbehaviour or raw `ValueError`/`KeyError`/`IndexError`/`TypeError` on invalid operands, non-pair 64-bit sources/destinations, unknown or malformed `v_cmp_*` / `v_cndmask_b32_e64` / `s_mov_b32` forms, wrong source counts, and unsupported `op_sel` modifiers (non-`OP_SEL_OPS`, wrong length, or non-zero trailing selector bits). - **Tests (`tests/test_vint_diff.py`)**: add 4 regression tests covering all of the above. ## Verification - `python3 -W error -I tests/test_vint_diff.py -v`: **29 passed, 0 failed** (2.718s). - Mutation check against unpatched `main`: **ran=29, failures=9, errors=7**. - `python3 -m compileall -q tools/vint_diff.py tests/test_vint_diff.py`, `python3 -I tests/test_text_write_line_endings.py`, `python3 -I scripts/check_no_game_data.py`: all pass. AI-assisted: yes GPUs tested: none (CPU unit tests with stubbed hardware oracle and `spirv_mini_interp`; no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:59:38 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 07:20 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 07:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1656#pullrequestreview-6053382540) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 09:32 UTC · original

Independent verification (Windows, Python 3.11.9 -I -W error): restore-globals claim confirmed — KNOWN/LITERALS saved+restored in finally, mutation moved after oracle connect, --list-ops/--self-test early-return before it. hw_run/_diff validation, shrink Skip fallback, RefError tightening (incl. _e64 suffix + CMPS membership on v_cmp) all present. test_vint_diff.py 29 OK (matches body); --self-test ok; bad-CLI exit 2 / hw-unavailable 77; compileall + line-endings + check_no_game_data clean. AI-assisted verification.

**@⁠whoalin1** on GitHub · 2026-11-25 09:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1656#issuecomment-7158471149) Independent verification (Windows, Python 3.11.9 `-I -W error`): restore-globals claim confirmed — `KNOWN`/`LITERALS` saved+restored in `finally`, mutation moved after oracle connect, `--list-ops`/`--self-test` early-return before it. `hw_run`/`_diff` validation, shrink Skip fallback, RefError tightening (incl. `_e64` suffix + CMPS membership on v_cmp) all present. `test_vint_diff.py` 29 OK (matches body); `--self-test` ok; bad-CLI exit 2 / hw-unavailable 77; compileall + line-endings + check_no_game_data clean. AI-assisted verification.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1656/head:github-bot/gh-1656'
git switch 'github-bot/gh-1656'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1656'
git switch 'github-bot/gh-1656'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1656'
git switch 'github-bot/gh-1656'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1656'
git switch 'main'
git merge --squash 'github-bot/gh-1656'
git switch 'main'
git merge --ff-only 'github-bot/gh-1656'
git switch 'main'
git merge 'github-bot/gh-1656'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.