Ignore write-only properties in schema-aware diffs - #1674
Ignore write-only properties in schema-aware diffs#1674Steve Lee (SteveL-MSFT) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR reduces false-positive schema-aware differences when resources intentionally do not return “instruction-only” properties by making get_diff_with_schema() ignore schema properties marked writeOnly: true. It also updates the Windows Firewall resource schema and tests to reflect that unspecifiedRulesAction is write-only and should not affect desired-state comparisons.
Changes:
- Update
get_diff_with_schema()to skip properties whose JSON Schema setswriteOnly: true, and add unit tests for write-only behavior. - Mark
unspecifiedRulesActionaswriteOnlyin the Windows Firewall resource schema. - Adjust Windows Firewall resource tests to assert non-default
unspecifiedRulesActionvalues do not cause diffs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| resources/windows_firewall/windows_firewall.dsc.resource.json | Marks unspecifiedRulesAction as writeOnly so it’s excluded from schema-aware diffing. |
| resources/windows_firewall/tests/windows_firewall_schema_default.tests.ps1 | Updates resource tests to assert unspecifiedRulesAction does not affect inDesiredState/diff output. |
| lib/dsc-lib/src/dscresources/dscresource.rs | Implements write-only skipping in schema-aware diffs and adds unit tests for the behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
😁 Code Coverage ReportChanged Code Coverage95% (90%+ coverage)
🔵 Full Codebase Coverage82% (good)
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Properties used only as resource instructions may not be returned by a resource, which caused schema-aware comparisons to report false differences.
This change makes
get_diff_with_schema()skip properties markedwriteOnly: truein the resource schema. The Windows Firewall resource now marksunspecifiedRulesActionas write-only, and unit and resource tests cover differing, omitted, and explicitly non-write-only properties.Fix #1668