Skip to content

Update delete whatIf handling#1377

Open
tgauth wants to merge 9 commits intoPowerShell:mainfrom
tgauth:update-delete-what-if
Open

Update delete whatIf handling#1377
tgauth wants to merge 9 commits intoPowerShell:mainfrom
tgauth:update-delete-what-if

Conversation

@tgauth
Copy link
Collaborator

@tgauth tgauth commented Feb 4, 2026

PR Summary

  • adds what-if argKind to resource's delete invocation which replaces existing plumbing that would route to set.
  • for the synthetic what-if for delete, it routes to test() (open to suggestions on this, but idea was to minimize overhead on resource authoring if only get/delete are implemented and the decision can't be made until the delete args are processed to determine if what-if is supported by the resource or not)
  • refactors delete() to include executionType

PR Context

@tgauth tgauth changed the title Update delete what if Update delete whatIf handling Feb 4, 2026
@tgauth tgauth requested a review from Copilot February 4, 2026 19:24
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

This PR extends the delete pipeline to support proper what-if handling, including a new arg kind and result shape, and wires that through the engine, CLI, and test harness. It also adds explicit test coverage for both native what-if delete support and synthetic what-if behavior when a resource only implements get/delete.

Changes:

  • Introduces DeleteResult/DeleteResultKind and refactors the delete invocation APIs to be execution-type aware (Actual vs WhatIf), including adapter and command-resource paths.
  • Adds a new dsctest resource (Test/WhatIfDelete), CLI subcommands, schema wiring, and end-to-end tests to validate both native what-if delete via whatIfArg and synthetic what-if delete derived from test.
  • Updates the configurator to surface delete what-if metadata into the configuration result and adjusts downstream callers (DSC CLI, MCP, Bicep extension) to the new delete signature.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/dsctest/src/whatif_delete.rs Defines the WhatIfDelete payload shape used by the new Test/WhatIfDelete test resource.
tools/dsctest/src/whatif.rs Extends the WhatIf test payload with optional _exist to align with existence semantics.
tools/dsctest/src/main.rs Wires in the whatif-delete subcommand, schema generation for WhatIfDelete, and behavior for native delete what-if responses (plus a regression in the Metadata subcommand output).
tools/dsctest/src/args.rs Adds Schemas::WhatIfDelete and a whatif-delete subcommand to the dsctest CLI to support the new test resource.
tools/dsctest/dsctest.dsc.manifests.json Registers the Test/WhatIfDelete resource with appropriate get/delete/schema commands and whatIfArg usage.
lib/dsc-lib/src/dscresources/invoke_result.rs Introduces DeleteResult/DeleteWhatIfResult and DeleteResultKind to represent delete what-if outputs and distinguish native vs synthetic vs actual deletes.
lib/dsc-lib/src/dscresources/dscresource.rs Refactors the Invoke::delete API and implementation to take an ExecutionKind and return DeleteResultKind, including adapter-aware delete behavior.
lib/dsc-lib/src/dscresources/command_resource.rs Extends command-resource delete invocation to be execution-type aware, handle whatIfArg, perform synthetic what-if via test, and parse native delete what-if output into DeleteResult.
lib/dsc-lib/src/configure/mod.rs Changes the set pipeline to drive delete with execution type, convert delete what-if (native or synthetic) into a SetResult, and surface delete what-if metadata into the result metadata (contains a move/ownership bug in the delete_result handling).
dsc/tests/dsc_whatif.tests.ps1 Adds tests covering native what-if delete (Test/WhatIfDelete) and synthetic what-if delete (Test/Delete), and validates the metadata and before/after state behavior.
dsc/src/resource_command.rs Updates direct resource delete calls from the DSC CLI to pass ExecutionKind::Actual and handle the new Result<DeleteResultKind, DscError> signature.
dsc/src/mcp/invoke_dsc_resource.rs Adjusts the MCP delete operation to call the new delete signature with ExecutionKind::Actual.
dsc-bicep-ext/src/main.rs Updates the Bicep extension’s delete path to use the new delete API with ExecutionKind::Actual.

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

@tgauth tgauth requested a review from SteveL-MSFT February 4, 2026 19:43
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.

1 participant