Skip to content

D3D12-DOCS-SWITCHES-TEST: fail standalone tests when d3d12/docs/switches.md drifts - #2934

Merged
MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
bobcatchris:test/d3d12-switches-page-drift
Dec 1, 2026
Merged

MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
bobcatchris:test/d3d12-switches-page-drift

Conversation

@bobcatchris

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D12-DOCS-SWITCHES-TEST (#2570 (comment); ref finding #2570 (comment))

What and why

tests/test_d3d12_switches.py previously generated page.md into a temporary directory and ran --check against that just-generated copy, so drift between the D3D12 runtime sources and the tracked d3d12/docs/switches.md went unnoticed in CI.

Added CommandTest.test_the_tracked_switches_page_matches_the_sources, which runs d3d12_switches.main(["--root", ROOT, "--check", "d3d12/docs/switches.md"]) and prints the exact missing/removed names and regeneration command on failure. Because tests/test_d3d12_switches.py is already executed by scripts/run_standalone_tests.py in both Windows and Linux CI jobs, no workflow YAML changes are needed.

Tested

  • Red/green check: temporarily removing LEONIDA_PIPELINE_SLOW from d3d12/docs/switches.md caused test_the_tracked_switches_page_matches_the_sources to fail with missing 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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.

@merzleckeier

Copy link
Copy Markdown
Contributor

Switch inventory red and green on the combined tree for 2190bf98 merged into 19d5f83c. The clean test file was 19/19 on main and 20/20 with the PR. I removed the existing LEONIDA_PANEL row on each tree. The standalone --check failed on both, while the normal test file stayed green on main and failed in the new test on the PR, reporting that exact name. Changing only that row’s description kept the new test green, so this covers the switch-name inventory.

The real combined tree with #2929 (51818b7e) failed in the new test and in --check on exactly LEONIDA_PIPELINE_STACK_MIB and LEONIDA_VRAM_GUARD_PCT. Running python -I tools/d3d12_switches.py --out d3d12/docs/switches.md made --check and all 20 tests pass again.

MEASURED with OpenAI Codex and a separate read-only review.

@enlight3d

Copy link
Copy Markdown
Contributor

RUN (independent check on Windows, #2934 head 2190bf9, merged locally into main 1fff691 with git merge --no-ff, no conflicts.)

Python 3.13.12:

  • main 1fff691 itself: python -I tools/d3d12_switches.py --check d3d12/docs/switches.md exits 0, so the tracked page is in sync today and the new test passes on the merge from the start.
  • Green on the merge: python -I tests/test_d3d12_switches.py: 20 tests, OK. python -I tests/test_ci_registration.py: 18 tests, OK.
  • Red: with the LEONIDA_PIPELINE_SLOW row removed from d3d12/docs/switches.md, test_the_tracked_switches_page_matches_the_sources fails ("missing from the page: LEONIDA_PIPELINE_SLOW"), the other 19 pass; with the row put back, 20 OK.
  • Read: the test calls d3d12_switches.main with --root on the repository and --check on the tracked page, and prints the regeneration command on failure. Note for maintainers: once merged, any change that adds or renames a LEONIDA_ switch without regenerating the page fails the standalone tests, on pull requests and on direct pushes alike (the page has drifted on main several times this week).

Machine: Windows 11 Pro 26300, Python 3.13.12.

@MoonEyes

MoonEyes commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Merging. Head 2190bf988 merges cleanly with main 1fff69129 and does not force a rebase of #2566. Ran main plus the PR myself: test_d3d12_switches 20 green, ci_registration 18, line endings 3, stdout encoding 4 green; test-only change. Third-party red/green by enlight3d on this head; internal code review ACCEPTE. Merged by MoonEyes.

AI-assisted (Claude Code).

@MoonEyes
MoonEyes merged commit 1a52f5b into ProjectLeonida:main Dec 1, 2026
5 checks passed

@KelboLive KelboLive left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

invismann added a commit to invismann/mandy that referenced this pull request Dec 1, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants