Skip to content

tests: match complete CLI flags in documentation checks - #8089

Open
Vasanthdev2004 wants to merge 1 commit into
ItsNotRexed:mainfrom
Vasanthdev2004:codex/docs-cli-exact-flag-matching
Open

Vasanthdev2004 wants to merge 1 commit into
ItsNotRexed:mainfrom
Vasanthdev2004:codex/docs-cli-exact-flag-matching

Conversation

@Vasanthdev2004

Copy link
Copy Markdown

Claimed in the coordination issue.

What and why

The general documentation check and the per-tool check searched source text for a flag substring. A documented --job passed when the tool mentioned --jobs and --job-status, even though --job was ambiguous. Extract complete flag tokens from source with the same tokenizer used for the docs, then compare those tokens in both checks.

The synthetic regression accepts both complete names and reports the shortened name in each check.

Tested

  • On Windows with Python 3.12.10, the new regression fails with the parent implementation and passes with the fix. All four focused CLI flag tests and all seven neighboring docs path and environment checks passed.
  • The full CLI flag suite reports the same seven pre-existing spirv-opt flags on the parent and this branch. PR #7879 tracks that separate baseline issue. All five tests passed when those seven flags were allowed in memory for verification.
  • git diff --check and the changed-file no-game-data check passed.

CPU-only tests. No game files, GPU, or driver were used. AI-assisted (Codex).

  • No game data, keys, or decryption, including in logs or reports quoted here.

@Poll2512

Copy link
Copy Markdown

Checked independently on Linux (CachyOS 7.3.5, CPython 3.14.9), head c6b3d0e, no game files, no GPU.

  • python -I tests/test_docs_cli_flags.py → Ran 5 tests, 1 failure, and the failure list is exactly the seven docs/embedded_shaders.md:372-377 spirv-opt flags that also fail on dde82f2. So the stricter matching adds no false positive anywhere in the docs tree, which was the risk of moving from substring to complete-token comparison.
  • Negative control: I reverted only the two known_flags lines (keeping the new test) and test_flags_must_match_complete_tokens fails with [] != [('docs/a.md:2', '--job')]; restored, it passes. The regression does test the change rather than passing either way.
  • Sequencing: test_docs_cli_flags: allow spirv-opt pass flags cited in docs/embedded_shaders.md #7476 edits the same if flag not in FOREIGN and ... line in unknown_flags to allowlist those seven flags. The two are complementary, not alternatives — this PR alone leaves the suite red on the seven, and whichever lands first the other needs a rebase.

AI-assisted.

@devnull34 devnull34 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.

Verified via Tier 2 Free Cloud (Groq gpt-oss-120b) & local test execution:

  1. Exact token matching via set(FLAG.findall(code)) is strictly superior to raw substring search (e.g. flag not in code), as substring matching falsely accepted prefixes like --job when only --jobs existed. The new unit test test_flags_must_match_complete_tokens passes and validates this boundary.
  2. Note on CI failure: Running test_docs_name_existing_flags fails with 7 unrecognized flags in docs/embedded_shaders.md (--ssa-rewrite, --eliminate-dead-code-aggressive, --cfg-cleanup, etc.). These third-party spirv-opt passes were previously masked by substring or missing from FOREIGN. Rebasing onto main (or merging with #8057 which adds these passes to FOREIGN) resolves this failure cleanly.

@molodayamama

Copy link
Copy Markdown

Windows check at c6b3d0e4f425e65404afee0fc08e2ebe5e5f5d32: the new complete-token regression passes. The full suite has 4 pass and 1 failure. Main dde82f27e has 3 pass and 1 failure with the exact same seven flags from docs/embedded_shaders.md:372–377, all in the documented SPIRV-Tools command. The matching change does not add a failure to this checkout.

AI-assisted verification.

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