Skip to content

add WhatIfReturns field to resource manifest#1386

Open
tgauth wants to merge 5 commits intoPowerShell:mainfrom
tgauth:update-registry-what-if
Open

add WhatIfReturns field to resource manifest#1386
tgauth wants to merge 5 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.

Comment on lines 41 to 46
"jsonInputArg": "--input",
"mandatory": true
}
]
},
"whatIf": {
"executable": "registry",
"args": [
"config",
"set",
"-w",
},
{
"jsonInputArg": "--input",
"mandatory": true
"whatIfArg": "-w"
}
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

delete.args now includes a whatIfArg: "-w", but the registry config delete subcommand does not accept -w/--what-if (only registry config set defines that flag). In what-if mode this will cause the delete invocation to fail argument parsing. Remove the whatIfArg from the delete args (so DSC falls back to synthetic what-if delete), or add what-if support to the registry delete subcommand and ensure its stdout matches the expected DeleteResult JSON contract.

Copilot uses AI. Check for mistakes.
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.

2 participants