Skip to content

feat: support XML policy fragment artifacts - #293

Open
Chris Dayne (cdayne) wants to merge 8 commits into
Azure:mainfrom
cdayne:feat/policy-fragment-xml
Open

Chris Dayne (cdayne) wants to merge 8 commits into
Azure:mainfrom
cdayne:feat/policy-fragment-xml

Conversation

@cdayne

@cdayne Chris Dayne (cdayne) commented Sep 21, 2026 •

Copy link
Copy Markdown

Summary

Adds direct policy.xml support for service-level and workspace policy fragments while retaining compatibility with existing JSON-only artifacts.

Changes

  • Extracts policy fragments using the split APIOps layout:

  • policyFragmentInformation.json for metadata

  • policy.xml for policy content

  • Publishes JSON-only, XML-only, and split policy-fragment artifacts.

  • Treats policy.xml as authoritative for properties.value and sets properties.format to rawxml.

  • Supports policy-fragment XML throughout artifact discovery, incremental publishing, transitive dependency resolution, environment mapping, policy-reference rewriting, and secret-redaction checks.

  • Skips fragments when no string policy value is available after overrides, while allowing explicitly empty string values.

  • Applies the same missing-value behaviour during dry runs.

  • Updates reference documentation and integration expectations for the split artifact layout.

Backwards Compatibility

Existing policyFragmentInformation.json artifacts containing properties.value continue to publish without requiring policy.xml.

Validation

  • npm test — 61 test files, 1,524 tests passed

  • npm run build

  • npm run lint -- --quiet

Related Issue(s)

Refs #304 — addresses the policy fragment body differences (items 3 and 4). The named values/, policy fragments/ and version sets/ folder-name differences are not covered by this PR.

Chris Dayne and others added 5 commits September 21, 2026 12:44
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 04:30

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.

Copilot review overview

🟢 Approval recommended

The implementation is cohesive and well tested; remaining feedback concerns diagnostic accuracy and documentation consistency.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds split policy.xml support for service and workspace policy fragments while preserving legacy JSON-only artifacts.

Changes:

  • Adds extraction, publishing, discovery, mapping, redaction, and dependency handling for XML policy fragments.
  • Handles partial artifact deletion and missing policy values consistently, including dry runs.
  • Expands unit, integration, and reference documentation coverage.
File Description
src/​services/​policy-fragment-artifact.ts Implements split artifact reading and writing.
src/​services/​resource-extractor.ts Extracts fragment XML separately from metadata.
src/​services/​resource-publisher.ts Publishes XML-only, JSON-only, and split fragments.
src/​services/​publish-service.ts Reconciles partial fragment deletions.
src/​services/​dry-run-reporter.ts Plans fragment skips and publications.
src/​services/​transitive-resolver.ts Scans fragment XML references.
src/​services/​transitive-extractor.ts Writes transitive fragments in split format.
src/​services/​secret-redaction-guard.ts Scans fragment payloads for redaction markers.
src/​lib/​resource-path.ts Recognizes fragment policy.xml paths.
tests/​unit/​services/​policy-fragment-artifact.test.ts Tests split artifact helpers.
tests/​unit/​services/​resource-extractor.test.ts Tests split extraction.
tests/​unit/​services/​resource-publisher.test.ts Tests publishing variants and missing values.
tests/​unit/​services/​publish-service.test.ts Tests incremental deletion behavior.
tests/​unit/​services/​dry-run-reporter.test.ts Tests dry-run fragment handling.
tests/​unit/​services/​transitive-resolver.test.ts Tests XML reference discovery.
tests/​unit/​services/​secret-redaction-guard.test.ts Tests XML redaction detection.
tests/​unit/​services/​git-diff-service.test.ts Tests XML change mapping.
tests/​unit/​lib/​resource-path.test.ts Tests service/workspace path parsing.
tests/​unit/​clients/​artifact-store.test.ts Tests XML-only discovery.
tests/​integration/​all-resource-types/​expected-structure.json Expects extracted fragment XML files.
docs/​reference/​resource-types.md Documents fragment file layout.
docs/​reference/​artifact-format.md Documents split and legacy representations.

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

Comment thread src/services/secret-redaction-guard.ts Resolved
Comment thread docs/reference/artifact-format.md Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 04:44

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.

Copilot review overview

🟢 Approval recommended

The implementation consistently supports split and legacy artifacts across extraction, publishing, discovery, validation, and tests.

Review effort: Balanced
Findings: None

Resolved since last review (2)

Preserve both policy-fragment handling and current main behavior, and keep dry-run WebSocket operation plans ineligible.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 04:42

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.

🟡 Changes recommended

Extraction can omit policy content or alter XML entities, and dry-run actions and workspace diagnostics need correction.

4 open issues

Review effort: Balanced

Comment thread src/services/resource-extractor.ts Resolved
Comment thread src/services/dry-run-reporter.ts Resolved
Comment thread src/services/secret-redaction-guard.ts Resolved
Preserve raw XML fragments, fetch full fragment payloads, align dry-run spec-import actions with publishing, and report workspace override provenance.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 05:12

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.

🟢 Approval recommended

No unresolved blocking issues remain, and tests cover the supported layouts and key workflow integrations.

No open issues 🎉

4 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants