test: pin every shader reason token in the triage classifier #2002

Merged
ChazY11 merged 1 commit from upstream-pr/2009 into main 2026-11-24 23:22:41 +00:00
ChazY11 commented 2026-11-24 23:00:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:00:16Z.


What

SHADER_REASONS in tools/startup/triage_run.py maps a .fail first line to an allowlisted report token. The suite never fed the table a line
of its own, so two kinds of change went unnoticed:

mutation in SHADER_REASONS before this PR after
"SDWA UNUSED_SEXT" label → "SDWA UNUSED_SEXTX" suite still green red
mask from descriptor data pattern → one that cannot match suite still green red
sampler operand pattern → one that cannot match suite still green red

Each of those folds a known cause into other (or reports a token nobody allows), which is the failure the module's own docstring says the
table exists to prevent.

Change

One function in tests/startup_triage_run_check.py, registered in main(): 16 sample lines, one per token, asserted against
classify_shader_reason. The samples are also matched back to the table, so a new entry added without a sample fails here:

missing = [i for i in range(len(triage_run.SHADER_REASONS)) if i not in covered]

Plus the negative control that an unmodelled reason still returns OTHER (other (text omitted) downstream depends on it).

Test file only. No production change, no CMake change, no new file.

Tested

out/pe-env/Scripts/python.exe -B tests/startup_triage_run_check.py    # exit 0
out/pe-env/Scripts/python.exe -B tests/shader_census_check.py         # exit 0
out/pe-env/Scripts/python.exe -B tests/docs_links_check.py            # exit 0

Fail-first, with each mutation applied to tools/startup/triage_run.py and reverted:

SDWA UNUSED_SEXT label degraded          -> exit 1  (caught)
mask from descriptor data pattern broken -> exit 1  (caught)
sampler operand pattern broken           -> exit 1  (caught)

Two things I got wrong first, and fixed

  • My first sample for SDWA dst_unused was v_add_f32 SDWA dst_unused:…, which the mnemonic rule matches first (correctly — it is a
    v_* line). The SDWA dst_unused entry only matches lines that begin with SDWA, so the sample starts there.
  • Counting samples instead of matched entries made a 16-sample / 15-entry table look wrong. The check now compares entry indices, which
    is what actually matters, and allows two samples for the one entry that has two forms (image_load_mip tfe, … a16).

Notes

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593130152 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2009). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:00:16Z. --- ## What `SHADER_REASONS` in `tools/startup/triage_run.py` maps a `.fail` first line to an allowlisted report token. The suite never fed the table a line of its own, so two kinds of change went unnoticed: | mutation in `SHADER_REASONS` | before this PR | after | |---|---|---| | `"SDWA UNUSED_SEXT"` label → `"SDWA UNUSED_SEXTX"` | suite still green | **red** | | `mask from descriptor data` pattern → one that cannot match | suite still green | **red** | | `sampler operand` pattern → one that cannot match | suite still green | **red** | Each of those folds a known cause into `other` (or reports a token nobody allows), which is the failure the module's own docstring says the table exists to prevent. ## Change One function in `tests/startup_triage_run_check.py`, registered in `main()`: 16 sample lines, one per token, asserted against `classify_shader_reason`. The samples are also matched back to the table, so a **new entry added without a sample fails here**: ```python missing = [i for i in range(len(triage_run.SHADER_REASONS)) if i not in covered] ``` Plus the negative control that an unmodelled reason still returns `OTHER` (`other (text omitted)` downstream depends on it). Test file only. No production change, no CMake change, no new file. ## Tested ```powershell out/pe-env/Scripts/python.exe -B tests/startup_triage_run_check.py # exit 0 out/pe-env/Scripts/python.exe -B tests/shader_census_check.py # exit 0 out/pe-env/Scripts/python.exe -B tests/docs_links_check.py # exit 0 ``` Fail-first, with each mutation applied to `tools/startup/triage_run.py` and reverted: ```text SDWA UNUSED_SEXT label degraded -> exit 1 (caught) mask from descriptor data pattern broken -> exit 1 (caught) sampler operand pattern broken -> exit 1 (caught) ``` ## Two things I got wrong first, and fixed - My first sample for `SDWA dst_unused` was `v_add_f32 SDWA dst_unused:…`, which the mnemonic rule matches **first** (correctly — it is a `v_*` line). The `SDWA dst_unused` entry only matches lines that begin with `SDWA`, so the sample starts there. - Counting samples instead of matched entries made a 16-sample / 15-entry table look wrong. The check now compares **entry indices**, which is what actually matters, and allows two samples for the one entry that has two forms (`image_load_mip tfe`, `… a16`). ## Notes - AI-assisted.
tedin7 commented 2026-11-24 23:03:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T23:02:15Z.

Review: COMMENTED


Review of head 13745b1b8f4c773ba9ec154b583c21a6cfa38734.

Scope: one test file, tests/startup_triage_run_check.py (+40). No production code, no CMake change, no new dependency. Clean-room: only the project's own classifier table is exercised.

Findings: P1 = 0, P2 = 0. Nit only: one blank line before def main (PEP 8 wants two).

Commands executed locally (Linux):

  • python3 tests/startup_triage_run_check.py -> 0 failed
  • python3 tests/docs_links_check.py -> pass
  • python3 tests/bidi_controls_check.py -> pass
  • git diff --check origin/main...HEAD -> clean
  • Merge check against current main: no conflicts.

Win2025 (x2w_pipe.py win2025 2009 --wait 900): Debug (dev preset) startup_triage_run 1/1 passed; Release /O2 startup_triage_run 1/1 passed.

Mutations (each reverted with git checkout -- .):

  1. Changed the SDWA UNUSED_SEXT label in SHADER_REASONS: the test fails (classify_shader_reason('SDWA UNUSED_SEXT') -> 'SDWA UNUSED_SEXTX').
  2. Broke the undecodable word pattern: the test fails 3 ways, including SHADER_REASONS[4] ... has no sample line.
    Both killed.

CI on GitHub was still pending for the Windows jobs when this was written.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048786199 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2009#pullrequestreview-6048786199). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T23:02:15Z. **Review:** COMMENTED --- Review of head `13745b1b8f4c773ba9ec154b583c21a6cfa38734`. Scope: one test file, `tests/startup_triage_run_check.py` (+40). No production code, no CMake change, no new dependency. Clean-room: only the project's own classifier table is exercised. Findings: P1 = 0, P2 = 0. Nit only: one blank line before `def main` (PEP 8 wants two). Commands executed locally (Linux): - `python3 tests/startup_triage_run_check.py` -> `0 failed` - `python3 tests/docs_links_check.py` -> pass - `python3 tests/bidi_controls_check.py` -> pass - `git diff --check origin/main...HEAD` -> clean - Merge check against current main: no conflicts. Win2025 (`x2w_pipe.py win2025 2009 --wait 900`): Debug (dev preset) `startup_triage_run` 1/1 passed; Release /O2 `startup_triage_run` 1/1 passed. Mutations (each reverted with `git checkout -- .`): 1. Changed the `SDWA UNUSED_SEXT` label in `SHADER_REASONS`: the test fails (`classify_shader_reason('SDWA UNUSED_SEXT') -> 'SDWA UNUSED_SEXTX'`). 2. Broke the `undecodable word` pattern: the test fails 3 ways, including `SHADER_REASONS[4] ... has no sample line`. Both killed. CI on GitHub was still pending for the Windows jobs when this was written. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 00:04:53 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!2002
No description provided.