feat: support XML policy fragment artifacts - #293
Open
Chris Dayne (cdayne) wants to merge 6 commits into
Open
Chris Dayne (cdayne) wants to merge 6 commits into
Chris Dayne (cdayne) wants to merge 6 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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
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.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Adds direct
policy.xmlsupport 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.jsonfor metadatapolicy.xmlfor policy contentPublishes JSON-only, XML-only, and split policy-fragment artifacts.
Treats
policy.xmlas authoritative forproperties.valueand setsproperties.formattorawxml.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.jsonartifacts containingproperties.valuecontinue to publish without requiringpolicy.xml.Validation
npm test— 61 test files, 1,524 tests passednpm run buildnpm run lint -- --quiet