tests: assert the expected count in the four hand-written operand refusals #2506

Manually merged
github merged 1 commit from gh-pr/2506/head into gh-pr/2506/base 2026-11-27 00:57:35 +00:00
Owner

@⁠ChazY11 on GitHub · 2026-11-25 18:52 UTC · original
ChazY11:startup/valu-arity-message → main · +26 −4 · 1 files · 1 commits · merged 2026-11-25 19:11 UTC

What

The four handlers #2396 guards by hand keep their operand count in a literal message
("... with N operands, expected 3"), while the VEC_F/VEC_U tables derive it from the arity. The refusal census
prints that text, so a literal that drifted from the condition raising it would be published to the reader as the
requirement.

The fixture asserted only that a refusal happens, not what it says. This PR adds the text assertion.

Evidence

Mutating the message in the merged code, before and after this change:

mutation of tools/startup/gfx2hlsl.py before after
s_bfm_b32 ... expected 3 → expected 4 not caught caught
v_cvt_i32_f32 ... expected 2 → expected 3 not caught caught
v_cndmask_b32 ... expected 3 or 4 → expected 3 — caught
v_mov_b32 ... expected 2 → expected 1 — caught
python -B tests/startup_gfx2hlsl_operand_count_check.py
operand count checks: 0 failed

Negative control and the vacuous-pass guard

v_cndmask_b32 accepts a fourth operand, so the "too many" side does not refuse and has no message to check. The
assertion therefore runs only where a refusal actually occurs, and a separate check pins that the short side always
does — otherwise the loop would pass vacuously for a handler whose guard stopped firing on the short side too.

Scope

Test-only. The guards, every accepted form and the accepted operand counts are unchanged. One reviewable behaviour:
the refusal text is part of what the fixture checks.

AI-assisted. Tested on Windows 11 build 26300.9974; the check is in the platform-independent list, so it also runs on
the Linux job.

**@⁠ChazY11** on GitHub · 2026-11-25 18:52 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2506) `ChazY11:startup/valu-arity-message` → `main` · +26 −4 · 1 files · 1 commits · merged 2026-11-25 19:11 UTC ## What The four handlers `#2396` guards by hand keep their operand count in a literal message (`"... with N operands, expected 3"`), while the `VEC_F`/`VEC_U` tables derive it from the arity. The refusal census prints that text, so a literal that drifted from the condition raising it would be published to the reader as the requirement. The fixture asserted only *that* a refusal happens, not what it says. This PR adds the text assertion. ## Evidence Mutating the message in the merged code, before and after this change: | mutation of `tools/startup/gfx2hlsl.py` | before | after | |---|---|---| | `s_bfm_b32 ... expected 3` → `expected 4` | not caught | **caught** | | `v_cvt_i32_f32 ... expected 2` → `expected 3` | not caught | **caught** | | `v_cndmask_b32 ... expected 3 or 4` → `expected 3` | — | **caught** | | `v_mov_b32 ... expected 2` → `expected 1` | — | **caught** | ``` python -B tests/startup_gfx2hlsl_operand_count_check.py operand count checks: 0 failed ``` ## Negative control and the vacuous-pass guard `v_cndmask_b32` accepts a fourth operand, so the "too many" side does not refuse and has no message to check. The assertion therefore runs only where a refusal actually occurs, and a separate check pins that the short side always does — otherwise the loop would pass vacuously for a handler whose guard stopped firing on the short side too. ## Scope Test-only. The guards, every accepted form and the accepted operand counts are unchanged. One reviewable behaviour: the refusal text is part of what the fixture checks. AI-assisted. Tested on Windows 11 build 26300.9974; the check is in the platform-independent list, so it also runs on the Linux job.
The handlers #2396 guards by hand keep their operand count in a literal
message ("... with N operands, expected 3"), while the VEC_F/VEC_U tables
derive it from the arity.  The refusal census prints that text, so a literal
that drifted from the condition raising it would be reported to the reader as
the requirement.

The fixture checked only that a refusal happens, not what it says.  Rewriting
`s_bfm_b32 ... expected 3` to `expected 4` and `v_cvt_i32_f32 ... expected 2`
to `expected 3` left it green; both are caught now, and so are the equivalent
edits for `v_mov_b32` and `v_cndmask_b32`.

v_cndmask_b32 accepts a fourth operand, so the long side is checked only where
a refusal actually occurs.  A separate check pins that the short side always
refuses, so the loop cannot pass vacuously if a guard stopped firing there.

    python -B tests/startup_gfx2hlsl_operand_count_check.py
    operand count checks: 0 failed

Test-only; the guards and every accepted form are unchanged.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:57:33 +00:00
github manually merged commit dff7ade33d into gh-pr/2506/base 2026-11-27 00:57:35 +00:00
Author
Owner

@⁠MasterDomino on GitHub · 2026-11-25 19:11 UTC · original · approved these changes

Approved at head dff7ade3, a rebase of c6c3462d with a byte-identical test file; I re-ran everything below at dff7ade3. The change is test-only: tests/startup_gfx2hlsl_operand_count_check.py now asserts the refusal text for the four handlers whose expected operand count is a literal.

Commands executed (Windows 11 build 26300, Python 3.13)

python -B tests/startup_gfx2hlsl_operand_count_check.py
  • At dff7ade3: operand count checks: 0 failed.
  • Merge base: the commit's parent is on current main, so this run is also the merged result.

Negative control

I mutated each literal message in tools/startup/gfx2hlsl.py one at a time, ran main's copy of the check and this PR's, then reverted:

mutated message main check this PR's check
s_bfm_b32 … expected 3 changed to expected 4 exit 0 (survives) exit 1
v_cvt_i32_f32 … expected 2 changed to expected 3 exit 0 exit 1
v_cndmask_b32 … expected 3 or 4 changed to expected 3 exit 0 exit 1
v_mov_b32 … expected 2 changed to expected 1 exit 0 exit 1

This matches the description. The separate short-side check also keeps the v_cndmask_b32 loop from passing vacuously.

Merge checks: required CI passed at this head. The /O2 and coverage skips come from explicit workflow conditions. There are no review threads.

AI-assisted; commands listed were executed locally.

**@⁠MasterDomino** on GitHub · 2026-11-25 19:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2506#pullrequestreview-6063471474) · **approved these changes** Approved at head `dff7ade3`, a rebase of `c6c3462d` with a byte-identical test file; I re-ran everything below at `dff7ade3`. The change is test-only: `tests/startup_gfx2hlsl_operand_count_check.py` now asserts the refusal text for the four handlers whose expected operand count is a literal. ### Commands executed (Windows 11 build 26300, Python 3.13) ```powershell python -B tests/startup_gfx2hlsl_operand_count_check.py ``` - **At `dff7ade3`:** `operand count checks: 0 failed`. - **Merge base:** the commit's parent is on current `main`, so this run is also the merged result. ### Negative control I mutated each literal message in `tools/startup/gfx2hlsl.py` one at a time, ran `main`'s copy of the check and this PR's, then reverted: | mutated message | `main` check | this PR's check | |---|---|---| | `s_bfm_b32 … expected 3` changed to `expected 4` | exit 0 (survives) | exit 1 | | `v_cvt_i32_f32 … expected 2` changed to `expected 3` | exit 0 | exit 1 | | `v_cndmask_b32 … expected 3 or 4` changed to `expected 3` | exit 0 | exit 1 | | `v_mov_b32 … expected 2` changed to `expected 1` | exit 0 | exit 1 | This matches the description. The separate short-side check also keeps the `v_cndmask_b32` loop from passing vacuously. Merge checks: required CI passed at this head. The `/O2` and coverage skips come from explicit workflow conditions. There are no review threads. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.