Repository navigation
D3D12-DOCS-SWITCHES-TEST: fail standalone tests when d3d12/docs/switches.md drifts - #2934
Conversation
|
Switch inventory red and green on the combined tree for The real combined tree with #2929 ( MEASURED with OpenAI Codex and a separate read-only review. |
|
RUN (independent check on Windows, #2934 head 2190bf9, merged locally into Python 3.13.12:
Machine: Windows 11 Pro 26300, Python 3.13.12. |
|
Merging. Head AI-assisted (Claude Code). |
KelboLive
left a comment
There was a problem hiding this comment.
The name-inventory guard works: removing LEONIDA_PIPELINE_SLOW, adding a source switch, or appending a ghost row each fail with the exact name and the regeneration command, and the file is picked up by run_standalone_tests.py on both OS jobs.
But the test name overclaims: --check compares only the row name set (tools/d3d12_switches.py:270-277). On this head the page already differs from --out — LEONIDA_RENDER_SCALE_MIN still says leonida-loader/hooks.rs +1 (switches.md:681) while --out emits leonida-gpu/menu.rs +2 because of d3d12/crates/leonida-gpu/src/host/menu.rs:65 — and both --check and the new test pass. Editing the count line (switches.md:8), flipping an A/B cell, or rewording the header also passes.
Either rename to ..._switch_names_match_the_sources (and say "names only" in the docstring), or compare full text (ds.page(ds.gather(ROOT)) == open(switches).read()) so columns, count and descriptions are covered. The full-text version would also have caught that stale row, which is exactly the kind of drift this test is for — though it means any comment that merely mentions a switch elsewhere dirties the page.
Also tools/d3d12_switches.py:235 and switches.md:4 still say "No CI job keeps it up to date", which this PR makes false; update that sentence (and regenerate) if you keep the current name-set scope.
Suite is 20/20, standalone selection works, merge is clean. No clean-room or runner concerns.
Regenerate the switch reference for the drift check added in ProjectLeonida#2934. Validated four launcher cases, all 20 switch-documentation checks, and both synthetic D3D12 readbacks on Windows with an RTX 4090 (driver 621.01). Independent review used GPT-6.2 Sol.
Claimed in the coordination issue as: D3D12-DOCS-SWITCHES-TEST (#2570 (comment); ref finding #2570 (comment))
What and why
tests/test_d3d12_switches.pypreviously generatedpage.mdinto a temporary directory and ran--checkagainst that just-generated copy, so drift between the D3D12 runtime sources and the trackedd3d12/docs/switches.mdwent unnoticed in CI.Added
CommandTest.test_the_tracked_switches_page_matches_the_sources, which runsd3d12_switches.main(["--root", ROOT, "--check", "d3d12/docs/switches.md"])and prints the exact missing/removed names and regeneration command on failure. Becausetests/test_d3d12_switches.pyis already executed byscripts/run_standalone_tests.pyin both Windows and Linux CI jobs, no workflow YAML changes are needed.Tested
LEONIDA_PIPELINE_SLOWfromd3d12/docs/switches.mdcausedtest_the_tracked_switches_page_matches_the_sourcesto fail withmissing from the page: LEONIDA_PIPELINE_SLOW(exit 1); restoring it passed (exit 0).python -I tests/test_d3d12_switches.py -v: 20 passed, 0 failed.python -I tests/test_ci_registration.py -v: 18 passed, 0 failed.python -I scripts/check_no_game_data.py tests/test_d3d12_switches.py: clean.GPUs tested: n/a (stdlib Python doc-hygiene test; Windows 11).
AI-assisted: yes — Gemini 4 Neon (implementation and an independent read-only reviewer pass).
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).