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

Manually merged
github merged 1 commit from gh-pr/1999/head into gh-pr/1999/base 2026-11-26 05:13:58 +00:00
Owner

@⁠brandostrong on GitHub · 2026-11-25 00:34 UTC · original
brandostrong:coverage-gate → main · +215 −0 · 3 files · 1 commits · merged 2026-11-25 01:12 UTC

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

**@⁠brandostrong** on GitHub · 2026-11-25 00:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1999) `brandostrong:coverage-gate` → `main` · +215 −0 · 3 files · 1 commits · merged 2026-11-25 01:12 UTC 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)
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 notes, not
failures, so a changed corpus is visible without blocking. The baseline is
counts only - no program names, no game data - generated with
`xcl shaders <pack> --direct --sample 0 --json` (threads 8) on a contributor's
shader pack: 22 445 programs, all translated, on current main.

Co-Authored-By: Claude Code <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:56 +00:00
github manually merged commit 3229445bb2 into gh-pr/1999/base 2026-11-26 05:13:58 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 00:54 UTC · original

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.
**@⁠futurepro62** on GitHub · 2026-11-25 00:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7149010850) 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.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 00:56 UTC · original

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).

**@⁠raylitebull** on GitHub · 2026-11-25 00:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7149053266) 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).
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 01:09 UTC · original

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.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 01:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7149260775) 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:42 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1999#issuecomment-7152171990) 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.