Skip to content

Fix nested diff w/ schema and schema cache miss - #1680

Open
Steve Lee (SteveL-MSFT) wants to merge 3 commits into
PowerShell:mainfrom
SteveL-MSFT:get-diff-fix
Open

Fix nested diff w/ schema and schema cache miss#1680
Steve Lee (SteveL-MSFT) wants to merge 3 commits into
PowerShell:mainfrom
SteveL-MSFT:get-diff-fix

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

PR Summary

  • Enhance when there is a schema cache miss
  • Fix synthetic test diff when value is an object to also consider writeOnly properties
  • Fix test schema to be consistent with the embedded schema

Copilot AI lite review requested due to automatic review settings August 18, 2026 16:54

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty coherent to me. My only request would be a test to validate that it behaves as expected, particularly for the nested property with a reference.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 18, 2026 18:08

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

Improves synthetic test diffing by making schema-aware comparisons work correctly for nested object properties (including referenced schemas and writeOnly handling) and by ensuring schema comparisons still work when the schema cache is cold/missed.

Changes:

  • Pass the relevant nested schema into recursive diffing and resolve local $refs so nested writeOnly/default metadata is honored.
  • On schema cache miss, parse the schema returned by get_schema and use it immediately (with best-effort cache population).
  • Extend the SchemaDefault test resource/schema and add Pester coverage for nested writeOnly objects and $ref-referenced nested schemas.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/dsctest/src/schema_default.rs Extends the SchemaDefault test input model to include nested objects and defaults, aligned with camelCase JSON.
tools/dsctest/src/main.rs Adjusts SchemaDefault synthetic “actual state” output to include nested objects when present in input.
tools/dsctest/dsctest.dsc.manifests.json Updates the embedded schema for Test/SchemaDefault to include nested and referenced nested definitions with writeOnly secret handling.
lib/dsc-lib/src/dscresources/dscresource.rs Enhances get_diff_with_schema to recurse with the correct nested schema and resolve local $refs for accurate nested comparisons.
lib/dsc-lib/src/dscresources/command_resource.rs Improves synthetic test behavior on schema cache miss by parsing/using the returned schema directly and caching it best-effort.
dsc/tests/dsc_schema_default.tests.ps1 Adds tests verifying nested writeOnly objects are ignored and non-writeOnly nested differences are reported (including $ref cases).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants