Skip to content

[test] Add tests for config.NormalizeAllowOnlyReposValue - #14640

Merged
lpcox merged 1 commit into
mainfrom
test/normalize-allow-only-repos-32beb4e4230dcd01
Oct 9, 2026
Merged

lpcox merged 1 commit into
mainfrom
test/normalize-allow-only-repos-32beb4e4230dcd01

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Test Coverage Improvement: NormalizeAllowOnlyReposValue

  • Package: internal/config
  • Function: NormalizeAllowOnlyReposValue
  • Previous coverage: 25.0%
  • New coverage: 100.0%

Why

Lowest-coverage non-trivial function with a type switch and multiple validation branches (strings, []interface{}, []string, invalid types) that feeds policy normalization.

Tests added

Table-driven TestNormalizeAllowOnlyReposValue covering: all/public case and whitespace normalization, invalid strings, normalized+sorted slices (both slice types), empty slices, non-string entries, duplicates, all combined with other scopes, invalid and blank scopes, nil, and unsupported types.

go test ./internal/config -run TestNormalizeAllowOnlyReposValue passes.

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • example.com
  • nonexistent.local
  • slow.example.com
  • thishostdoesnotexist12345.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"
    - "nonexistent.local"
    - "slow.example.com"
    - "thishostdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Test Coverage Improver · copilot · auto · 19.1 AIC · ⊞ 10.6K · ◷

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review October 9, 2026 19:57
Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:57

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 tests accurately cover all branches and follow repository testing conventions.

0 open findings

What changed in this PR

Adds comprehensive unit coverage for allow-only repository value normalization.

Changes:

  • Covers valid string and slice normalization.
  • Covers invalid values, duplicates, empty slices, and unsupported types.
File Description
internal/​config/​guard_policy_normalize_repos_test.go Adds table-driven normalization and validation tests.

🧠 Review effort: Balanced


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

@github-actions

github-actions Bot commented Oct 9, 2026

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) all 6 tools absent from 23-tool catalog BLOCKED ⚠️
C CLI reads data ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh unauthenticated (no GH_TOKEN) BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh unauthenticated (no GH_TOKEN) BLOCKED ⚠️

Overall: INCONCLUSIVE

  • No write succeeded anywhere — zero leak risk.
  • Part B: the gateway's exposed catalog contains only 23 read-only tools (get_*, list_*, search_*, issue_read, pull_request_read); none of the 6 targeted write tools exist to call. This confirms gh-aw's GITHUB_READ_ONLY=1 backend wrapper but does not independently exercise mcpg's own DIFC/guard write-blocking layer, since no write-capable tool ever reaches it.
  • Parts D/E: gh auth status shows no authenticated host (GH_TOKEN not set in this job), so REST/GraphQL write attempts could not even reach GitHub's API — the token-scope boundary was not exercised this run.
  • No reaction, star, issue, comment, branch, file, or PR was created in any part.

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

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