Open
Conversation
Contributor
There was a problem hiding this comment.
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/DeleteResultKindand refactors thedeleteinvocation APIs to be execution-type aware (ActualvsWhatIf), 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 viawhatIfArgand synthetic what-if delete derived fromtest. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
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)delete()to includeexecutionTypePR Context
setanddeleteto support what-if #1361