Fix reason validation on adapter#1338
Merged
SteveL-MSFT merged 4 commits intoPowerShell:mainfrom Mar 4, 2026
Merged
Conversation
ce15677 to
1daee6b
Compare
Collaborator
Author
|
@SteveL-MSFT - if you have some time to review, we discussed this during WG that this was missing for adapters, thus we could pull it in. If it's of course good :) |
1daee6b to
4209792
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes adapter-backed resource validation failures so that when an adapter’s validate operation returns valid: false with a custom reason, DSC surfaces that reason instead of a generic message (addresses #1337).
Changes:
- Use
ValidateResult.reason(when present) as theDscError::Validationmessage for command-resource JSON verification failures. - Add a PowerShell adapter integration test asserting the custom validation reason appears in error output.
- Update the TestAdapter
Validateoperation to emitvalid: falseplus areasonfor a specific test case.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/dsc-lib/src/dscresources/command_resource.rs | Propagates adapter/command validate failure reason into returned validation errors. |
| adapters/powershell/Tests/powershellgroup.resource.tests.ps1 | Adds a regression test that expects the adapter-provided validation reason to be printed. |
| adapters/powershell/Tests/TestAdapter/testadapter.resource.ps1 | Adds a validation-failure path that returns a custom reason for test coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4209792 to
a7be0d4
Compare
SteveL-MSFT
approved these changes
Mar 4, 2026
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
Fixed the adapter to properly display validation error reasons when operations fail on adapted resources.
PR Context
Fix #1337.