Skip to content

feat: Add --what-if for Microsoft.Windows/UpdateList#1616

Open
Gijsreyn wants to merge 2 commits into
PowerShell:mainfrom
Gijsreyn:gh-1529/main/add-whatif-updatelist
Open

feat: Add --what-if for Microsoft.Windows/UpdateList#1616
Gijsreyn wants to merge 2 commits into
PowerShell:mainfrom
Gijsreyn:gh-1529/main/add-whatif-updatelist

Conversation

@Gijsreyn

Copy link
Copy Markdown
Collaborator

PR Summary

This pull request adds --what-if support for Microsoft.Windows/UpdateList.

PR Context

Partially addresses #1529

Copilot AI review requested due to automatic review settings July 10, 2026 12:33

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.

Pull request overview

This PR adds --what-if support for the built-in Microsoft.Windows/UpdateList resource by wiring the manifest to pass the what-if flag, projecting “after” state during what-if execution, and exposing what-if messages via _metadata.

Changes:

  • Updated the Microsoft.Windows/UpdateList resource manifest to declare what-if behavior for set (whatIfArg/whatIfReturns) and align with v3 manifest fields (implementsPretest).
  • Added projected what-if behavior in the Windows Update set implementation, returning _metadata.whatIf messages instead of mutating state.
  • Added Pester tests covering what-if behavior for installing and already-installed updates.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
resources/WindowsUpdate/windowsupdate.dsc.resource.json Enables what-if for set and adds _metadata.whatIf schema support.
resources/WindowsUpdate/tests/windowsupdate_whatif.tests.ps1 Adds what-if integration tests for Microsoft.Windows/UpdateList.
resources/WindowsUpdate/src/windows_update/types.rs Introduces _metadata Rust types and includes them in UpdateInfo.
resources/WindowsUpdate/src/windows_update/set.rs Implements what-if projection for update installation with localized what-if messages.
resources/WindowsUpdate/src/windows_update/export.rs Ensures UpdateInfo construction includes metadata: None.
resources/WindowsUpdate/src/main.rs Threads what-if detection into handle_set.
resources/WindowsUpdate/locales/en-us.toml Adds localized what-if message template for update installation.

Comment on lines +109 to +112
#[cfg(windows)]
fn parse_what_if_arg(args: &[String]) -> bool {
args.iter().skip(2).any(|arg| arg == "-w" || arg == "--what-if")
}
Comment on lines 27 to 31
"input": "stdin",
"preTest": true,
"return": "state"
"implementsPretest": true,
"return": "state",
"whatIfReturns": "state"
},
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.

2 participants