CLI: reject unknown options and invalid values in xcl rpf and xcl shaders (#2266) #2285
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2285
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2285/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@GustavoEllwanger on GitHub · 2026-11-25 12:26 UTC · original
GustavoEllwanger:fix/cli-rpf-shaders-reject-unknown-options→main· +429 −85 · 6 files · 1 commits · merged 2026-11-25 18:21 UTCFixes #2266.
What is in it
Replaces the ad-hoc
args.iter().position(...)/.ok()option lookups inxcl rpfandxcl shaderswith a single-pass strict CLI parser (crates/xcl/src/cli.rs) shared by both subcommands:crates/xcl/src/cli.rs:Parserhelper (value,parse_usize,parse_u64,parse_bool_01,parse_hex_u64,unexpected) that rejects missing option values (end-of-arguments or another--flagin the value position), malformed integers/hex hashes, unknown-/--options, and stray positional arguments, plus unit tests.crates/xcl/src/rpf.rs: parsesxcl rpfoptions intoRpfOptionsup front, rejecting unknown flags (--fnid), stray arguments, missing values (--extract,--find,--out,--top), and invalid--topvalues withxcl rpf: ...on stderr and exit code2while preserving--probeconflict diagnostics.crates/xcl/src/shaders.rs: parses allxcl shadersoptions (including--directoptions such as--sample,--seed,--threads,--max-bytes,--timeout,--hash,--dump, and--split 0|1) intoShadersOptionsup front before reading/scanning the input, so typos like--hash 0xZZor--top abcfail immediately withxcl shaders: ...on stderr and exit code2instead of silently falling back to defaults.crates/xcl/tests/rpf_e2e.rs&crates/xcl/tests/shaders_e2e.rs: adds end-to-end CLI tests covering missing values, mistyped numbers/hashes, unknown options, and stray arguments (asserting exit code2, diagnostic on stderr, and empty stdout).Tested
32.0.16.1088), Windows 11, Rust1.95.0, DXC1.8.2502.11(debug build).cargo test -p xcl --lib cli::: 1 passed, 0 failed, 0 ignored.cargo test -p xcl --lib rpf::: 5 passed, 0 failed, 0 ignored.cargo test -p xcl --lib shaders::: 9 passed, 0 failed, 0 ignored (SKIPPED GPU test:shaders::tests::pso_measurement_compiles_an_exact_synthetic_record— Windows Developer Mode required for cache disable).cargo test -p xcl --test rpf_e2e --test shaders_e2e --test disasm_e2e -- --test-threads=4:rpf_e2e3 passed,shaders_e2e7 passed,disasm_e2e7 passed (0 failed, 0 ignored).cargo test -p xcl --lib -- --test-threads=4(RTX 5060): 1182 passed, 0 failed, 26 ignored (SKIPPED GPU tests: native-wave64-onlylower/lower_dxil/recomptests +pso_measurement_compiles_an_exact_synthetic_record).Regression run
Paired 60 s
scripts/smoke.ps1regression run on a retail title (release, default settings, A pressed every 4 s from 20 s; NVIDIA GeForce RTX 3060 12 GB, Windows 11, Rust1.100.0), courtesy of @Anon64 (comment):Base (
1a0bbe3):This PR (
9a7e0ed):Not tested
xcl rpf/xcl shadersCLI commands changed by this PR (those are verified by the unit andrpf_e2e/shaders_e2esuites above).shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(skipped locally without Windows Developer Mode).AI use
rpf.rs,shaders.rs,disasm.rs, and the CLI e2e tests, implementedcli.rsand the parser updates, added the unit/e2e tests, and ran the local test suites.@Anon64 on GitHub · 2026-11-25 12:34 UTC · original
Regression run: a retail title, from
scripts/smoke.ps1as printed. 60 s, release, default settings, A pressed every 4 s from 20 s. RTX 3060 12 GB, Windows 11, Rust 1.100.0. The base is this PR's merge base withmain.base (
1a0bbe3):this PR:
No device removal or crash. Frames are 100.3 % of the base's and peak commit is 102.0 %. Both runs slow to a few presents per 2 s near the end, the same on the base. This is a regression check only: it does not run the
xcl rpf/xcl shaderscommands this PR changes.AI use: Claude Code (Claude Opus 5.5) built both commits, ran the smoke pair and wrote this comment.
@GustavoEllwanger on GitHub · 2026-11-25 12:37 UTC · original
Thanks @Anon64 for running the paired regression smoke test! Added the blocks to Regression run in the PR description with credit so PR checks can pass.
@luckyteagirl on GitHub · 2026-11-25 12:43 UTC · original
Independent Windows/RX 6800M verification of exact PR head
9a7e0edd87d4f4c540dc91c7eba7291e0d856ca1, with an owned-title smoke comparison against main1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6.Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Debug tests and release smoke binaries used isolated Cargo targets. No game data was copied or attached.Tested
cargo test --locked -p xcl --test rpf_e2e -j 2 -- --test-threads=1 --show-output: 3/0/0. The correspondingshaders_e2ecommand: 7/0/0. The added CLI cases passed.cargo build --locked --workspace -j 2andcargo build --locked --workspace --release -j 2passed on the clean PR head.XCL_ADAPTER=6800M XCL_DIRECT_DXIL=1 cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output: main 1080 passed, 170 failed, 46 ignored; PR 1083 passed, 170 failed, 46 ignored, across 23 test targets. Both had 9 explicitSKIPPEDmessages and the same 170 failing test names. The broad suite is red on this machine due to the RX 6800M device-suspension behavior, so these counts are not a green-suite claim.Regression run
Same owned title and GPU, seven seconds each, default translation mode, separate fresh data/cache directories. Both completed without my external memory guard firing. Exact
xcl-smokeblocks:Main:
PR head:
Limits: The smoke runs reached only the first frame. They check for startup regressions, not world-load behavior or CLI operation in the running title. The e2e tests are the CLI behavior check. A new PR head requires a new PR-head smoke run.
AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows builds and tests, monitored the owned-title smoke pair, compared full-suite failure names, and drafted this report. No game files were uploaded.
@throny on GitHub · 2026-11-25 15:07 UTC · original
Two contributors checked independently and found that #2303 solves the same problem (for #2266) in a different way: #1607, group D78. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@GustavoEllwanger on GitHub · 2026-11-25 15:49 UTC · original
Thanks for the triage hint! @b3IKK — I compared
#2285and#2303side by side so we can pick one cleanly for#2266:#2285was opened first, has two independent retail smoke + GPU verifications (@Anon64RTX 3060 and@luckyteagirlRX 6800M), and uses a single-passParserintoRpfOptions/ShadersOptions:xcl rpf pkg.rpf extraorxcl shaders pack extra), whichcli::unknownchecking only--prefixed args still ignores.--splitstrictly as0or1(parse_bool_01) instead of accepting any non-zero integer astrue.crates/xcl/tests/rpf_e2e.rsandcrates/xcl/tests/shaders_e2e.rschecking exit code2, stderr diagnostics, and empty stdout.#2303has a slightly smaller diff and accepts0xhex prefixes incli::number.Happy to consolidate on
#2285(keeping head9a7e0eduntouched so the paired smoke blocks stay valid) — or let me know if you see any case in#2303that#2285misses.@itsonewi on GitHub · 2026-11-25 15:55 UTC · original
Heads-up on coordination: #2303 also fixes #2266 and creates the same new file (
crates/xcl/src/cli.rs) with a different API, so the two cannot both merge. There is a side-by-side comparison of #2285 and #2303 on #2266 (options, exit codes, tests, changed lines, and the one behavioural difference inunknown()) so the maintainers can pick one without reading both diffs.Nothing here needs an action from you; the note is only so the work is not lost to a rebase.
AI use: read both patches and the current
mainthrough the GitHub API for that comparison; no code was written by an agent here and no build was run.@itsonewi on GitHub · 2026-11-25 15:56 UTC · original · edited 2026-11-25 16:03 UTC
Duplicate of the note above (client retry); GitHub returns 500 on deleting it, so it is shortened instead.
@DavidM1911 on GitHub · 2026-11-25 17:17 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
github-bot referenced this pull request2026-11-26 06:18:31 +00:00