Skip to content

feat(cargo-wdk): add --infverif-args passthrough to customize inverif options - #734

Open
Shravan Vasista (svasista-ms) wants to merge 6 commits into
microsoft:mainfrom
svasista-ms:feat/730-infverif-args
Open

feat(cargo-wdk): add --infverif-args passthrough to customize inverif options#734
Shravan Vasista (svasista-ms) wants to merge 6 commits into
microsoft:mainfrom
svasista-ms:feat/730-infverif-args

Conversation

@svasista-ms

@svasista-ms Shravan Vasista (svasista-ms) commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

cargo-wdk currently hardcodes its infverif invocation 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, /provider cannot be used at all.

This PR adds --infverif-args to the cargo wdk build command similar to other tools.

The mode flags | /h, /w, /u | are derived by cargo-wdk from --target-platform, and the .inf file operand is the generated package INF. So, they are rejected at parse time.

Resolves #730

Screenshots

  • Help Output:
after-01-help
  • With custom infverif-args:
after-03-appended
  • Reserved switches are rejected:
after-04-reserved

Copilot AI lite review requested due to automatic review settings September 2, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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-args to the CLI, including parsing/tokenization and conflict validation for reserved infverif arguments.
  • Plumbs the parsed args through BuildAction into PackageTask, appending them to the infverif command 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.

Comment thread crates/cargo-wdk/README.md Outdated
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.28571% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.26%. Comparing base (3655880) to head (4012a42).

Files with missing lines Patch % Lines
crates/cargo-wdk/src/cli.rs 98.63% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
Comment thread crates/cargo-wdk/src/actions/build/package_task.rs Outdated
- Add rejected flag's name in `infverif-args` error
- Rename tests for consistency
- Fix indentation in README
Copilot AI review requested due to automatic review settings September 3, 2026 05:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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_FLAGS includes "k", but cargo-wdk never derives or supplies the /k mode flag (TargetPlatform::as_infverif_flag() only returns /u, /h, /w). Rejecting /k here (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

Comment thread crates/cargo-wdk/src/cli.rs Outdated
- Print user supplied flag as is in rejection messages
- Stop reserving `/k` as cargo-wdk does not derive it
Copilot AI review requested due to automatic review settings September 4, 2026 04:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Copilot AI review requested due to automatic review settings September 7, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

Comment thread crates/cargo-wdk/README.md
Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/tests/build_command_test.rs Outdated
- set `allow_hyphen_values` for `infverif-args`
- add README section for `infverif-args`
- remove redundant test when empty `infverif-args` is supplied
Copilot AI review requested due to automatic review settings September 8, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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-args supports a raw value beginning with - ("-rulever ..."). If infverif switches are intended to be /-prefixed (as documented) and allow_hyphen_values is removed to prevent swallowing other CLI flags, the -rulever variant 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

Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs
Comment thread crates/cargo-wdk/README.md Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated
Comment thread crates/cargo-wdk/src/cli.rs Outdated
- use mixed arg prefix in tests
- fix README
Copilot AI review requested due to automatic review settings September 10, 2026 07:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

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.

Support infverif passthrough in cargo-wdk

4 participants