[PR #1661] vrel_diff: reject malformed --ops tokens, guard compare() lane/word counts, handle shrink Skip, and tighten RefError checks #1676

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

📋 Pull Request Information

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

Base: main ← Head: fix/vrel-diff-cli-compare-and-ref


📝 Commits (1)

  • 0f7b01b vrel_diff: harden --ops parsing, compare() lane/word bounds, shrink Skip handling, and RefError checks

📊 Changes

2 files changed (+103 additions, -11 deletions)

View changed files

📝 tests/test_vrel_diff.py (+61 -0)
📝 tools/vrel_diff.py (+42 -11)

📄 Description

Item ID: VREL-DIFF-CLI-COMPARE-AND-REF
Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155832832

Summary

  • CLI --ops validation (tools/vrel_diff.py): check args.ops is not None (previously --ops "" silently ran all ops and --ops " , " crashed with IndexError), reject empty/trailing comma tokens, and deduplicate op tokens preserving order.
  • Comparison bounds (compare()): reject mismatched lane counts (previously got == [] silently returned None as a false pass) and non-32-word lane payloads (previously IndexError).
  • Shrink stability (run_suite()): catch transient Skip when re-evaluating the shrunk program and fall back to the original mismatch detail.
  • Reference & event validation (State, step(), rel(), events()): raise RefError instead of IndexError/ValueError/TypeError on empty tokens, wrong operand counts, non-integer v_writelane_b32 lane indices, and uninitialized m0 in events().
  • Tests (tests/test_vrel_diff.py): add 4 regression tests covering all of the above.

Verification

  • python3 -W error -I tests/test_vrel_diff.py -v: 23 passed, 0 failed (2.569s).
  • Mutation check against unpatched main: ran=23, failures=8, errors=11.
  • python3 -m compileall -q tools/vrel_diff.py tests/test_vrel_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 spirv_wave_interp; no game data)


🔄 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/1661 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/vrel-diff-cli-compare-and-ref` --- ### 📝 Commits (1) - [`0f7b01b`](https://github.com/ubiquitarianism/leonida/commit/0f7b01b7cd1441e57d7e54a6cdfaab16681db8d8) vrel_diff: harden --ops parsing, compare() lane/word bounds, shrink Skip handling, and RefError checks ### 📊 Changes **2 files changed** (+103 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_vrel_diff.py` (+61 -0) 📝 `tools/vrel_diff.py` (+42 -11) </details> ### 📄 Description Item ID: `VREL-DIFF-CLI-COMPARE-AND-REF` Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155832832 ## Summary - **CLI `--ops` validation (`tools/vrel_diff.py`)**: check `args.ops is not None` (previously `--ops ""` silently ran all ops and `--ops " , "` crashed with `IndexError`), reject empty/trailing comma tokens, and deduplicate op tokens preserving order. - **Comparison bounds (`compare()`)**: reject mismatched lane counts (previously `got == []` silently returned `None` as a false pass) and non-32-word lane payloads (previously `IndexError`). - **Shrink stability (`run_suite()`)**: catch transient `Skip` when re-evaluating the shrunk program and fall back to the original mismatch detail. - **Reference & event validation (`State`, `step()`, `rel()`, `events()`)**: raise `RefError` instead of `IndexError`/`ValueError`/`TypeError` on empty tokens, wrong operand counts, non-integer `v_writelane_b32` lane indices, and uninitialized `m0` in `events()`. - **Tests (`tests/test_vrel_diff.py`)**: add 4 regression tests covering all of the above. ## Verification - `python3 -W error -I tests/test_vrel_diff.py -v`: **23 passed, 0 failed** (2.569s). - Mutation check against unpatched `main`: **ran=23, failures=8, errors=11**. - `python3 -m compileall -q tools/vrel_diff.py tests/test_vrel_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 `spirv_wave_interp`; no game data) --- <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#1676
No description provided.