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

Manually merged
github merged 1 commit from github-bot/gh-2934 into gh-pr/2934/base 2026-12-01 21:35:58 +00:00 AGit
Owner

@⁠bobcatchris on GitHub · 2026-12-01 19:56 UTC · original
bobcatchris:test/d3d12-switches-page-drift → main · +15 −1 · 1 files · 1 commits · merged 2026-12-01 21:35 UTC

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

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.
**@⁠bobcatchris** on GitHub · 2026-12-01 19:56 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2934) `bobcatchris:test/d3d12-switches-page-drift` → `main` · +15 −1 · 1 files · 1 commits · merged 2026-12-01 21:35 UTC Claimed in the coordination issue as: D3D12-DOCS-SWITCHES-TEST (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570; ref finding https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570) ### 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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:00:02 +00:00
Author
Owner

@⁠merzleckeier on GitHub · 2026-12-01 20:26 UTC · original

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.

**@⁠merzleckeier** on GitHub · 2026-12-01 20:26 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2934#issuecomment-7324691350) 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.
Author
Owner

@⁠enlight3d on GitHub · 2026-12-01 21:16 UTC · original

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

Python 3.13.12:

  • main 1fff69129 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.

**@⁠enlight3d** on GitHub · 2026-12-01 21:16 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2934#issuecomment-7325996788) RUN (independent check on Windows, #2934 head 2190bf988, merged locally into `main` 1fff69129 with `git merge --no-ff`, no conflicts.) Python 3.13.12: - `main` 1fff69129 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.
github-bot changed target branch from main to gh-pr/2934/base 2026-12-01 21:35:57 +00:00
github manually merged commit 2190bf988f into gh-pr/2934/base 2026-12-01 21:35:58 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-12-01 21:35 UTC · original

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** on GitHub · 2026-12-01 21:35 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2934#issuecomment-7326481201) 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).
Author
Owner

@⁠KelboLive on GitHub · 2026-12-01 21:37 UTC · original · reviewed

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.

**@⁠KelboLive** on GitHub · 2026-12-01 21:37 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2934#pullrequestreview-6140602312) · **reviewed** 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.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2934
No description provided.