feat(cargo-wdk): add --infverif-args passthrough to customize inverif options - #734
feat(cargo-wdk): add --infverif-args passthrough to customize inverif options#734Shravan Vasista (svasista-ms) wants to merge 6 commits into
--infverif-args passthrough to customize inverif options#734Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The implementation and test coverage look solid, with only a minor README help-text indentation nit noted.
Pull request overview
Adds an --infverif-args passthrough to cargo-wdk build so callers can customize the infverif invocation during packaging, while still preventing conflicts with cargo-wdk-controlled mode flags and the INF operand.
Changes:
- Introduces
--infverif-argsto the CLI, including parsing/tokenization and conflict validation for reservedinfverifarguments. - Plumbs the parsed args through
BuildActionintoPackageTask, appending them to theinfverifcommand before the INF path. - Adds integration/unit tests covering argument forwarding and reserved-argument rejection.
File summaries
| File | Description |
|---|---|
| crates/cargo-wdk/src/cli.rs | Adds --infverif-args option, validates reserved args, and includes CLI tests. |
| crates/cargo-wdk/src/actions/build/mod.rs | Threads infverif_args through build action parameters/state. |
| crates/cargo-wdk/src/actions/build/package_task.rs | Appends custom infverif args in run_infverif and adds targeted unit tests. |
| crates/cargo-wdk/src/actions/build/tests.rs | Updates build-action test harness initialization with the new param. |
| crates/cargo-wdk/tests/build_command_test.rs | Adds an integration test asserting the infverif command line includes forwarded args. |
| crates/cargo-wdk/README.md | Documents the new CLI option in the help output snippet. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #734 +/- ##
==========================================
+ Coverage 82.93% 83.26% +0.33%
==========================================
Files 25 25
Lines 6685 6825 +140
Branches 6685 6825 +140
==========================================
+ Hits 5544 5683 +139
Misses 1029 1029
- Partials 112 113 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Add rejected flag's name in `infverif-args` error - Rename tests for consistency - Fix indentation in README
There was a problem hiding this comment.
🔵 Needs a closer look
The new CLI validation incorrectly treats /k as a cargo-wdk-derived InfVerif mode flag even though cargo-wdk never derives or supplies it.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
crates/cargo-wdk/src/cli.rs:246
MODE_FLAGSincludes "k", but cargo-wdk never derives or supplies the/kmode flag (TargetPlatform::as_infverif_flag() only returns/u,/h,/w). Rejecting/khere (and claiming it is derived from--target-platform) is misleading and may block a valid InfVerif mode flag.
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
- Print user supplied flag as is in rejection messages - Stop reserving `/k` as cargo-wdk does not derive it
There was a problem hiding this comment.
🟡 Changes recommended
The implementation doesn’t reject /k even though the PR description states /k is a reserved InfVerif mode flag derived by cargo-wdk, creating a behavior/doc mismatch and leaving an unintended override path.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
crates/cargo-wdk/src/cli.rs:616
- Tests for reserved InfVerif mode flags don’t cover
/k, so the intended reserved-switch behavior for/k(mentioned in the PR description) isn’t validated.
fn infverif_args_rejects_mode_flags() {
for (value, mode_flag) in [("/h", "/h"), ("/w", "/w"), ("/U", "/U"), ("/info -w", "-w")]
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The new CLI option is fully plumbed through to the packaging step, includes reserved-argument validation, and is covered by unit and integration tests.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
- set `allow_hyphen_values` for `infverif-args` - add README section for `infverif-args` - remove redundant test when empty `infverif-args` is supplied
There was a problem hiding this comment.
🟡 Changes recommended
--infverif-args currently enables allow_hyphen_values and includes tests for --prefixed switches, which can unexpectedly swallow CLI flags like -v and appears inconsistent with InfVerif’s documented /-prefixed usage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
crates/cargo-wdk/src/cli.rs:647
- This test asserts that
--infverif-argssupports a raw value beginning with-("-rulever ..."). Ifinfverifswitches are intended to be/-prefixed (as documented) andallow_hyphen_valuesis removed to prevent swallowing other CLI flags, the-rulevervariant should be dropped from the test.
for value in ["/rulever 10.0.22621 /info", "-rulever 10.0.22621 -info"] {
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
- use mixed arg prefix in tests - fix README
There was a problem hiding this comment.
🟢 Approval recommended
The new CLI flag is correctly validated, cleanly propagated into the packaging invocation, and is covered by both unit and integration tests alongside updated documentation.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
cargo-wdkcurrently hardcodes itsinfverifinvocation during packaging. Only the validation mode is reachable (through--target-platform), so options like/rulever(pin or preview the InfVerif rule version),/info,/stampinf,/osver,/providercannot be used at all.This PR adds
--infverif-argsto thecargo wdk buildcommand similar to other tools.The mode flags
| /h, /w, /u |are derived bycargo-wdkfrom--target-platform, and the.inffile operand is the generated package INF. So, they are rejected at parse time.Resolves #730
Screenshots
infverif-args: