Scripts: fail a shader coverage regression against a committed baseline #1989

Merged
brandostrong merged 1 commit from upstream-pr/1999 into main 2026-11-25 01:12:10 +00:00
brandostrong commented 2026-11-25 00:34:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brandostrong on 2026-11-25T00:34:39Z.


A sibling project lost 323 shader translations to a refactor and nobody noticed until users saw black menus. The tool to catch that exists (xcl shaders --direct --sample 0 --json reports per-stage outcome counts) but had no baseline. coverage_gate.py runs the sweep (or compares a saved report) and fails when a stage translates fewer programs than the baseline or gains validator failures, panics or timeouts; totals that move are printed as notes, not failures, so a changed corpus is visible without blocking. Part of the validation line claimed on #1269.

What is in it

  • scripts/coverage_gate.py: sweep + compare + --update (counts only — no program names, no game data)
  • scripts/test_coverage_gate.py: 9 unit tests for the compare and report-parse logic (no game needed)
  • tests/data/coverage-baseline.json: generated with xcl shaders <pack> --direct --sample 0 --json --threads 8 on a contributor's shader pack at 62265d3: 22 445 programs, all translated (CS 1 636, GS 390, MS 8 724, PS 9 511, VS 2 184)

Tested

  • RTX 4090, i9-13900K, 32 GB RAM, Windows 11 26200, Python 3.12
  • python scripts/test_coverage_gate.py: 9 tests, OK
  • full sweep + --update on the pack above (exit 0); gate re-run against the written baseline: "coverage gate: no regressions"

Not tested

  • CI (the sweep needs a shader pack, so the gate runs locally / on contributor machines; the unit tests are CI-safe)
  • other packs / adapters

AI use

  • Claude Code, Claude Opus 5.5: wrote the script, the tests, the baseline run and this description; the user reviewed the diff.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6594367045 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1999). Originally posted by [brandostrong](https://github.com/brandostrong) on 2026-11-25T00:34:39Z. --- A sibling project lost 323 shader translations to a refactor and nobody noticed until users saw black menus. The tool to catch that exists (`xcl shaders --direct --sample 0 --json` reports per-stage outcome counts) but had no baseline. `coverage_gate.py` runs the sweep (or compares a saved report) and fails when a stage translates fewer programs than the baseline or gains validator failures, panics or timeouts; totals that move are printed as notes, not failures, so a changed corpus is visible without blocking. Part of the validation line claimed on #1269. **What is in it** - `scripts/coverage_gate.py`: sweep + compare + `--update` (counts only — no program names, no game data) - `scripts/test_coverage_gate.py`: 9 unit tests for the compare and report-parse logic (no game needed) - `tests/data/coverage-baseline.json`: generated with `xcl shaders <pack> --direct --sample 0 --json --threads 8` on a contributor's shader pack at `62265d3`: 22 445 programs, all translated (CS 1 636, GS 390, MS 8 724, PS 9 511, VS 2 184) **Tested** - RTX 4090, i9-13900K, 32 GB RAM, Windows 11 26200, Python 3.12 - `python scripts/test_coverage_gate.py`: 9 tests, OK - full sweep + `--update` on the pack above (exit 0); gate re-run against the written baseline: "coverage gate: no regressions" **Not tested** - CI (the sweep needs a shader pack, so the gate runs locally / on contributor machines; the unit tests are CI-safe) - other packs / adapters **AI use** - Claude Code, Claude Opus 5.5: wrote the script, the tests, the baseline run and this description; the user reviewed the diff. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
futurepro62 commented 2026-11-25 01:10:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T00:54:25Z.


Tested exact head 3229445, script tests only, since this PR has no test report yet.

Tested

  • Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here).
  • python -m pytest scripts/test_coverage_gate.py at the head: 9 passed.
  • The PR's test file against current main's script (7994cd1): not applicable: coverage_gate.py is new in this PR, so on main the test stops at ModuleNotFoundError: No module named 'coverage_gate'.

Not tested

  • The gate against a real xcl coverage run (only its unit tests), the CI workflow itself.

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7149010850 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7149010850). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T00:54:25Z. --- Tested exact head `3229445`, script tests only, since this PR has no test report yet. **Tested** - Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here). - `python -m pytest scripts/test_coverage_gate.py` at the head: 9 passed. - The PR's test file against current main's script (`7994cd1`): not applicable: `coverage_gate.py` is new in this PR, so on main the test stops at `ModuleNotFoundError: No module named 'coverage_gate'`. **Not tested** - The gate against a real `xcl coverage` run (only its unit tests), the CI workflow itself. **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
raylitebull commented 2026-11-25 01:10:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T00:56:56Z.


Code review on 3229445:

  • scripts/coverage_gate.py cleanly parses the trailing JSON line from xcl shaders --direct --sample 0 --json, fails on translated drops, missing stages, or increases in validator_failed/panicked/timeout, and treats corpus total changes or new stages as informational notes. All 9 unit tests in scripts/test_coverage_gate.py look solid.
  • Both CI checks are green.

What is still needed before merge: Independent second-reviewer / cross-machine verification of test_coverage_gate.py (and optionally --run-json against a real sweep).

<!-- greyfinch-sync:ivall/xcl:comment:7149053266 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7149053266). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T00:56:56Z. --- Code review on `3229445`: - `scripts/coverage_gate.py` cleanly parses the trailing JSON line from `xcl shaders --direct --sample 0 --json`, fails on `translated` drops, missing stages, or increases in `validator_failed`/`panicked`/`timeout`, and treats corpus total changes or new stages as informational notes. All 9 unit tests in `scripts/test_coverage_gate.py` look solid. - Both CI checks are green. **What is still needed before merge:** Independent second-reviewer / cross-machine verification of `test_coverage_gate.py` (and optionally `--run-json` against a real sweep).
JJAutoCompare commented 2026-11-25 01:11:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:09:18Z.


I verified the saved-report CLI on exact PR head 3229445bb27ce02a6710495d972a58f4eee49aa2 with a clean worktree.

Tested

Windows 11 Enterprise Evaluation x64 (build 26200.9974), AMD Ryzen 7 3800X, CPython 3.13.7 x64 (portable NuGet package).

  • A local harness invoked python -B scripts/coverage_gate.py --baseline <baseline.json> --run-json <report.json> with small synthetic saved reports. All 8 cases passed, with 0 failed, 0 ignored, and 0 skipped. A matching report and a report with a corpus-size change plus a new stage returned 0. A translated-count drop, a missing stage, and individual increases in validator_failed, panicked, and timeout each returned 1 with the expected diagnostic. A missing baseline returned 2 with a diagnostic on stderr.
  • As an independent rerun of the checked-in tests, python -B -m unittest discover -s scripts -p test_coverage_gate.py -v passed 9 tests, with 0 failed, 0 ignored, and 0 skipped.

Not tested

Live xcl shaders sweeps, game assets, GPU execution, the Cargo workspace suite, and the CI workflow.

AI use

Codex (gpt-6.2-sol) ran the tests, wrote the temporary CLI harness, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7149260775 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7149260775). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T01:09:18Z. --- I verified the saved-report CLI on exact PR head `3229445bb27ce02a6710495d972a58f4eee49aa2` with a clean worktree. **Tested** Windows 11 Enterprise Evaluation x64 (build 26200.9974), AMD Ryzen 7 3800X, CPython 3.13.7 x64 (portable NuGet package). - A local harness invoked `python -B scripts/coverage_gate.py --baseline <baseline.json> --run-json <report.json>` with small synthetic saved reports. All 8 cases passed, with 0 failed, 0 ignored, and 0 skipped. A matching report and a report with a corpus-size change plus a new stage returned `0`. A translated-count drop, a missing stage, and individual increases in `validator_failed`, `panicked`, and `timeout` each returned `1` with the expected diagnostic. A missing baseline returned `2` with a diagnostic on stderr. - As an independent rerun of the checked-in tests, `python -B -m unittest discover -s scripts -p test_coverage_gate.py -v` passed 9 tests, with 0 failed, 0 ignored, and 0 skipped. **Not tested** Live `xcl shaders` sweeps, game assets, GPU execution, the Cargo workspace suite, and the CI workflow. **AI use** Codex (gpt-6.2-sol) ran the tests, wrote the temporary CLI harness, and wrote this report.
upstream-sync closed this pull request 2026-11-25 02:08:15 +00:00
DavidM1911 commented 2026-11-25 04:10:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T03:42:45Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7152171990 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7152171990). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T03:42:45Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
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
xcl-dev/xcl!1989
No description provided.