Skip to content

Fix reason validation on adapter#1338

Merged
SteveL-MSFT merged 4 commits intoPowerShell:mainfrom
Gijsreyn:gh-1337/main/fix-reason-adapter
Mar 4, 2026
Merged

Fix reason validation on adapter#1338
SteveL-MSFT merged 4 commits intoPowerShell:mainfrom
Gijsreyn:gh-1337/main/fix-reason-adapter

Conversation

@Gijsreyn
Copy link
Collaborator

@Gijsreyn Gijsreyn commented Jan 2, 2026

PR Summary

Fixed the adapter to properly display validation error reasons when operations fail on adapted resources.

PR Context

Fix #1337.

@Gijsreyn Gijsreyn force-pushed the gh-1337/main/fix-reason-adapter branch 2 times, most recently from ce15677 to 1daee6b Compare February 27, 2026 04:30
@Gijsreyn
Copy link
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 :)

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

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 the DscError::Validation message for command-resource JSON verification failures.
  • Add a PowerShell adapter integration test asserting the custom validation reason appears in error output.
  • Update the TestAdapter Validate operation to emit valid: false plus a reason for 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.

@Gijsreyn Gijsreyn force-pushed the gh-1337/main/fix-reason-adapter branch from 4209792 to a7be0d4 Compare March 3, 2026 03:01
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Mar 4, 2026
Merged via the queue into PowerShell:main with commit 17ac7c0 Mar 4, 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.

Validation reason is not displayed when adapter validate operation fails

3 participants