Skip to content

Ignore write-only properties in schema-aware diffs - #1674

Open
Steve Lee (SteveL-MSFT) wants to merge 2 commits into
mainfrom
stevel-msft-ignore-instructed-schema-diffs
Open

Ignore write-only properties in schema-aware diffs#1674
Steve Lee (SteveL-MSFT) wants to merge 2 commits into
mainfrom
stevel-msft-ignore-instructed-schema-diffs

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Aug 13, 2026

Copy link
Copy Markdown
Member

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 marked writeOnly: true in the resource schema. The Windows Firewall resource now marks unspecifiedRulesAction as write-only, and unit and resource tests cover differing, omitted, and explicitly non-write-only properties.

Fix #1668

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 sets writeOnly: true, and add unit tests for write-only behavior.
  • Mark unspecifiedRulesAction as writeOnly in the Windows Firewall resource schema.
  • Adjust Windows Firewall resource tests to assert non-default unspecifiedRulesAction values 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.

Comment thread lib/dsc-lib/src/dscresources/dscresource.rs
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

😁 Code Coverage Report

Changed Code Coverage

95% (90%+ coverage)

Metric Value
Changed lines analyzed 73
Lines covered by tests 70
Coverage percentage 95%

🔵 Full Codebase Coverage

82% (good)

Metric Value
Total executable lines 18820
Lines covered by tests 15500
Coverage percentage 82%

Changed code coverage measures only Rust lines added/modified in this PR.
Full codebase coverage measures all instrumented Rust lines across the project.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Enable JSONSchema property decorator to inform synthetic test to skip

2 participants