Repository navigation
Deduplicate normalized allow-only policy fields - #16926
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the policy-schema deduplication change.
No open issues 🎉
What changed in this PR
This PR reduces policy-schema duplication by sharing AllowOnlyPolicy fields with the normalized representation used for caching and observability, addressing part of #16837.
Changes:
- Embed a method-free derived policy type to share fields without inheriting configuration-specific unmarshalling.
- Preserve flat normalized JSON, field ordering, optional-field omission, and exclusion of raw
repos. - Add regression tests for byte-identical serialization, normalized round-trips, and input immutability.
| File | Description |
|---|---|
internal/config/guard_policy.go |
Shares policy fields and adds normalized JSON serialization that omits raw repositories. |
internal/config/guard_policy_validation.go |
Updates normalization initialization for the embedded policy fields. |
internal/config/guard_policy_marshal_test.go |
Adds serialization compatibility, round-trip, immutability, and repository-omission tests. |
Review effort: Balanced (adaptive)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Fixed the flagged |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked in any part. Part B is No readonly-stress-pass-default label applied (result is INCONCLUSIVE, not PASS).
|
Repeated policy fields risked drift between configuration and normalized representations. This change makes
AllowOnlyPolicythe single field-schema source.NormalizedGuardPolicy, avoiding inheritance of configuration-specific unmarshalling.repos.