Skip to content

test: docs name only CLI flags that exist in the code - #3281

Closed
kapitche wants to merge 1 commit into
ItsNotRexed:mainfrom
kapitche:docs-cli-flags-test
Closed

kapitche wants to merge 1 commit into
ItsNotRexed:mainfrom
kapitche:docs-cli-flags-test

Conversation

@kapitche

Copy link
Copy Markdown
Contributor

AI-assisted.

Tests only. The docs name many command-line options (--stages, --wave64-emulate, --runtime-build, per-tool flags) and nothing checked them: tests/test_docs_repo_paths.py covers paths and tests/test_docs_links.py covers links, but a renamed or removed argparse option would leave python -I tools/x.py --old in a guide that no longer runs. I scanned every Markdown page against upstream/main and found no mismatch today, so this pins the class.

New tests/test_docs_cli_flags.py (stdlib only, tracked files only):

  1. every --flag in any Markdown page occurs as text in some tracked non-Markdown source (foreign flags gh --search, pip --index-url are listed);
  2. in a fenced command python [-I] tools/x.py|scripts/x.py|make_game.py ... (continuation lines joined), every flag occurs in that script. Scripts that build flags as "--" + name (shader_link_check.py) are skipped.

Tested: Python 3.12.16, Linux (WSL2): passes on upstream/main (3 tests, 5 s). Negative control: renaming --check to --checkk and --stages to --stages-x in README.md's command block makes both real-docs tests fail, naming README.md:109 and README.md:112; a self-check test with synthetic pages covers the checker itself.

Claim: #3232 (comment)

@ray3242

ray3242 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Merged with current main (f847748c), the new test fails. Main's docs/design.md:309 mentions results "with #1784's --no-vertex-subgroups", a flag from another PR that doesn't claim to exist on main. test_docs_name_existing_flags (tests/test_docs_cli_flags.py:47-54, :106-113) requires every flag named in Markdown to appear in source, so it fails on that line:

$ python -I -m pytest -q tests/test_docs_cli_flags.py
FAILED tests/test_docs_cli_flags.py::DocsCliFlags::test_docs_name_existing_flags
flags in the docs that no source file mentions: docs/design.md:309 --no-vertex-subgroups
1 failed, 2 passed

CI runs standalone tests/test_*.py files (.github/workflows/ci.yml:77-86), so this fails CI once the PR is merged or rebased. The head alone passes all 3 tests. Running the checker against untouched main gives the same failure, so it comes from main's newer doc text. Allowing a flag that is attributed to another PR (e.g. #NNNN's --flag), or an explicit allowlist, would keep the check strict.

AI-assisted (Devin); Linux, Python 3.12, no game files.

@evilclanker9000

Copy link
Copy Markdown
Contributor

Tested 51ffcce on Windows 11 (native Python 3.12, venv; the PR's own run was Linux/WSL2): python -I tests/test_docs_cli_flags.py -v — 3/3 pass (test_docs_name_existing_flags, test_fenced_commands_use_the_flags_of_their_tool, test_checkers_report_only_the_missing_flag), 9 s.
CPU-only test, so no GPU involved: the RTX 5080 (616.92) and Radeon gfx1036 (26.10.1) make no difference to it. No negative control run on Windows.

AI-assisted.

…ds use their own tool's flags

The any-flag check covers only the user-facing pages (README, CONTRIBUTING, AGENTS, i18n, docs/testing.md, the
runtime and semantic READMEs). Design and research notes such as docs/design.md cite flags of open pull requests
("ItsNotRexed#1784's --no-vertex-subgroups"), which no source has yet, so including them made the test fail on main. The
fenced-command check still runs on every page: a command block must use real flags of its script.
@kapitche
kapitche force-pushed the docs-cli-flags-test branch from 51ffcce to 686634b Compare November 22, 2026 20:29
@kapitche

Copy link
Copy Markdown
Contributor Author

Thanks @ray3242 for catching this. Reproduced on f847748: docs/design.md:309 cites #1784's --no-vertex-subgroups, which no source has yet, so the broad any-flag check failed.

Changed: that check now covers only user-facing pages (README.md, CONTRIBUTING.md, AGENTS.md, docs/testing.md, runtime/README.md, tests/semantic/README.md, docs/i18n/*). Design and research notes are excluded because they legitimately cite flags from open PRs. I chose a path list over skipping lines that mention a PR number because it is simpler and has no text heuristics. The fenced-command check (python tools/x.py ... blocks must use that script's real flags) is unchanged and still runs on every page.

Rebased onto upstream/main f847748; new head 686634b. Python 3.12.16, Linux (WSL2): python -I tests/test_docs_cli_flags.py passes (3 tests). Negative control: renaming --check and --stages in README.md's command block makes both real-docs tests fail (README.md:109 and :112). AI-assisted.

@bvtterbroot

Copy link
Copy Markdown

Tested 686634b on AMD Radeon RX 7900 XTX (RDNA3, Navi 31; native wave32 and wave64), AMD driver 26.11.2, Vulkan 1.4.359, Windows 11: pass.

  • python -I tests/test_docs_cli_flags.py: 3 tests OK.

Tools: llvm-mc 21.1.8 (WSL), Vulkan SDK 1.4.363.0, MSVC 14.44.

@ray3242

ray3242 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Rechecked 686634be merged with current main (f847748c, no conflicts): python -I tests/test_docs_cli_flags.py 3/3 OK on Python 3.12.16, so the docs/design.md:309 failure I reported is resolved. CPU only. AI-assisted (Devin).

@kapitche

Copy link
Copy Markdown
Contributor Author

Closing: tests/test_docs_cli_flags.py from an earlier head of this PR is already on main (merged in a20ebe99) and passes against main's docs. The later commit only narrowed the any-flag check to user-facing pages, which main doesn't need right now. If a design note ever trips it again, that narrowing can come back as a small follow-up. Thanks @ray3242 for catching that case.

@kapitche kapitche closed this Nov 23, 2026
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.

4 participants