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

Merged
bobcatchris merged 1 commit from upstream-pr/2934 into main 2026-12-01 21:35:06 +00:00
bobcatchris commented 2026-12-01 19:56:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T19:56:31Z.


Claimed in the coordination issue as: D3D12-DOCS-SWITCHES-TEST (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7323577585; ref finding https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7302596030)

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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5593405868 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2934). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-01T19:56:31Z. --- Claimed in the coordination issue as: D3D12-DOCS-SWITCHES-TEST (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7323577585; ref finding https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7302596030) ### 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.
merzleckeier commented 2026-12-01 20:26:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T20:26:32Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7324691350 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2934#issuecomment-7324691350). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T20:26:32Z. --- 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 commented 2026-12-01 21:16:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-01T21:16:05Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7325996788 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2934#issuecomment-7325996788). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-01T21:16:05Z. --- 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.
MoonEyes commented 2026-12-01 21:35:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T21:35:01Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7326481201 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2934#issuecomment-7326481201). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T21:35:01Z. --- 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).
KelboLive commented 2026-12-01 21:37:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T21:37:42Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6140602312 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2934#pullrequestreview-6140602312). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T21:37:42Z. **Review:** COMMENTED --- 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.
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
ProjectLeonida/mandy!2934
No description provided.