Skip to content

add WhatIfReturns field to resource manifest#1386

Merged
SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
tgauth:update-registry-what-if
Mar 11, 2026
Merged

add WhatIfReturns field to resource manifest#1386
SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
tgauth:update-registry-what-if

Conversation

@tgauth
Copy link
Collaborator

@tgauth tgauth commented Feb 11, 2026

PR Summary

  • add WhatIfReturns field to resource manifest
  • update dsc test resource to utilize WhatIfReturns (for StateAndDiff scenario)
  • update registry resource manifest to use WhatIfArg and WhatIfReturns (for State scenario)

PR Context

  • in the process of updating the registry resource manifest to use WhatIfArg, it became clear that there was no way to specify a different return between an Actual and a WhatIf execution for set

@tgauth tgauth requested a review from SteveL-MSFT February 11, 2026 21:54
@tgauth tgauth changed the title update registry manifest to use WhatIfArg add WhatIfReturns to resource manifest Feb 26, 2026
@tgauth tgauth changed the title add WhatIfReturns to resource manifest add WhatIfReturns field to resource manifest Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for specifying a different set return shape during what-if execution via a new whatIfReturns manifest field, and updates test/registry manifests and tests to exercise state-vs-stateAndDiff scenarios.

Changes:

  • Add whatIfReturns to the resource manifest set method and honor it during invoke_set when executionType=WhatIf.
  • Extend dsctest what-if output to optionally emit stateAndDiff (two-line output) and add a new test manifest entry.
  • Update the Registry resource manifest to rely on whatIfArg/whatIfReturns instead of a dedicated whatIf operation, and add/adjust PowerShell tests.

Reviewed changes

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

Show a summary per file
File Description
tools/dsctest/src/whatif.rs Adds fromResource field to dsctest what-if state payload.
tools/dsctest/src/main.rs Adds --state-and-diff mode for dsctest what-if output (state + diff).
tools/dsctest/src/args.rs Adds CLI flag to control stateAndDiff output.
tools/dsctest/dsctest.dsc.manifests.json Adds Test/WhatIfReturnDiff resource manifest using whatIfReturns.
resources/registry/registry.dsc.resource.json Migrates Registry manifest to whatIfArg/whatIfReturns and removes dedicated whatIf op.
lib/dsc-lib/src/dscresources/resource_manifest.rs Introduces whatIfReturns on SetMethod.
lib/dsc-lib/src/dscresources/command_resource.rs Uses whatIfReturns to select return parsing behavior for what-if set.
dsc/tests/dsc_whatif.tests.ps1 Adds coverage for whatIfReturns=stateAndDiff behavior.
dsc/tests/dsc_resource_set.tests.ps1 Adjusts assertion for changedProperties shape in what-if set test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SteveL-MSFT SteveL-MSFT added this to the 3.2-Consider milestone Mar 9, 2026
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Mar 11, 2026
Merged via the queue into PowerShell:main with commit 5ea1b0b Mar 11, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants