Repository navigation
[Repo Assist] refactor(config): remove redundant AllowOnlyPolicy.MarshalJSON - #16862
Conversation
Default encoding of AllowOnlyPolicy already yields the same JSON keys, so the hand-written copy of the field list is unnecessary. Refs #16837 Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The redundant marshaler was removed while canonical JSON tags and existing serialization coverage remain intact, with no active review issues identified.
No open issues 🎉
What changed in this PR
This PR removes the redundant AllowOnlyPolicy.MarshalJSON implementation, allowing default JSON encoding to use the policy's canonical struct tags without changing serialized output.
Changes:
- Deletes the custom marshaler and duplicate serialized-field type.
- Retains canonical JSON tags and existing serialization coverage.
| File | Description |
|---|---|
| internal/config/guard_policy.go | Removes redundant custom JSON marshaling for AllowOnlyPolicy while preserving its existing JSON schema. |
Review effort: Lite (adaptive)
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE ( No issues were created; no writes attempted or leaked. Reported as INCONCLUSIVE per the test plan's methodology-gap rules, not PASS/FAIL.
|
🤖 This is an automated PR from Repo Assist.
Addresses recommendation 1 of #16837 (does not close the issue; recommendation 2 — sharing the field list with
NormalizedGuardPolicy— is left for maintainer decision).Rationale
AllowOnlyPolicy.MarshalJSONre-declared all 13 fields with the same json tags asAllowOnlyPolicyitself, so it produced byte-identical output to default encoding. Removing it deletes 22 lines and one of the three duplicated field lists.AllowOnlyPolicyalready carries the canonical json tags.Test Status
go build ./...,go vet ./internal/config/, gofmt: passgo test ./internal/config/ ./internal/guard/ ./internal/server/ ./internal/proxy/: passAdd this agentic workflow to your repo
To install this agentic workflow, run