Skip to content

[Repo Assist] refactor(config): remove redundant AllowOnlyPolicy.MarshalJSON - #16862

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/improve-remove-redundant-allowonly-marshal-caa91dea48e72eef
Nov 19, 2026
Merged

lpcox merged 1 commit into
mainfrom
repo-assist/improve-remove-redundant-allowonly-marshal-caa91dea48e72eef

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 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.MarshalJSON re-declared all 13 fields with the same json tags as AllowOnlyPolicy itself, so it produced byte-identical output to default encoding. Removing it deletes 22 lines and one of the three duplicated field lists. AllowOnlyPolicy already carries the canonical json tags.

Test Status

  • go build ./..., go vet ./internal/config/, gofmt: pass
  • go test ./internal/config/ ./internal/guard/ ./internal/server/ ./internal/proxy/: pass
  • golangci-lint not installed in this environment (skipped).

Generated by Repo Assist · copilot · routed: sonnet55 high · ~48 AIC · ⊞ 9.5K · ◷
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

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]>
@lpcox
lpcox marked this pull request as ready for review November 19, 2026 22:45
Copilot AI adaptive review requested due to automatic review settings November 19, 2026 22:45

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

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)

@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads data ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) N/A — all 6 targets absent from 23-tool catalog BLOCKED ⚠️
C CLI reads data ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) N/A — gh unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) N/A — gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE

(⚠️ = INCONCLUSIVE — Part B: none of add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request appeared in the 23-tool catalog exposed via the gateway-backed github CLI, so a write-time gateway refusal could not be exercised (this reflects gh-aw's tools.github: always launching the backend with GITHUB_READ_ONLY=1, not an mcpg gap). Parts D/E: gh auth status reported "not logged into any GitHub hosts" (exit 1), so REST/GraphQL write probes against GitHub could not be attempted. No write succeeded or leaked in any part.)

No issues were created; no writes attempted or leaked. Reported as INCONCLUSIVE per the test plan's methodology-gap rules, not PASS/FAIL.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit b3fe7df into main Nov 19, 2026
26 checks passed
@lpcox
lpcox deleted the repo-assist/improve-remove-redundant-allowonly-marshal-caa91dea48e72eef branch November 19, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants