Skip to content

[test] Add tests for config.validateServerAgainstSchema - #16544

Merged
lpcox merged 1 commit into
mainfrom
test/coverage-config-validate-server-schema-52a828b7399436a8
Nov 14, 2026
Merged

lpcox merged 1 commit into
mainfrom
test/coverage-config-validate-server-schema-52a828b7399436a8

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Function Analyzed

  • Package: internal/config
  • Function: validateServerAgainstSchema
  • Previous coverage: 83.3%
  • New coverage: 88.9%
  • Improvement: +5.6 percentage points
  • Complexity: High (reasoned estimate based on JSON marshaling/parsing, additional-property merging, schema validation, and multiple error paths)

Why This Function?

The coverage report showed this validation path as the most substantial nontrivial under-tested candidate after excluding trivial functions and unreachable error branches. The new test exercises a reachable failure mode that had no coverage: JSON marshaling fails when a supported server configuration field contains an unsupported value.

Tests Added

  • Verifies unsupported GuardPolicies values return an error rather than being silently omitted or causing a panic.
  • Confirms the error identifies the marshal-validation failure and preserves the internal-error guidance.

Coverage Report

Before: 83.3%
After:  88.9%
Improvement: +5.6 percentage points
Overall Go coverage: 97.5%

Test Execution

  • go test -count=1 -v ./internal/config -run '^TestValidateServerAgainstSchema_MarshalError$' — passed
  • go test -count=1 -coverprofile=/tmp/gh-aw/agent/coverage-final.out ./... — passed; overall coverage 97.5%
  • make agent-finished — formatting, build, Go lint stage, and all Go unit/integration tests passed. The pipeline could not complete its Rust guard stage because crates.io dependency resolution failed on the configured invalid TLS certificate; offline mode also confirmed serde is not cached.

No production behavior or dependencies were changed.

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 · routed: gpt56 xhigh · ~12 AIC · ⊞ 5K · ◷

@lpcox
lpcox marked this pull request as ready for review November 14, 2026 20:47
Copilot AI adaptive review requested due to automatic review settings November 14, 2026 20:47

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

No active review issues remain, and the added regression coverage addresses marshal failures for unsupported server configuration values with the expected error context.

No open issues 🎉

What changed in this PR

Adds focused regression coverage for the marshal-error path in validateServerAgainstSchema, ensuring unsupported server configuration values produce a descriptive internal validation error.

Changes:

  • Adds a test using an unsupported function value in GuardPolicies.
  • Verifies the returned error includes marshal-failure context and internal-error guidance.
  • Leaves production behavior and dependencies unchanged.
File Description
internal/​config/​validate_server_against_schema_test.go Adds regression coverage for JSON marshaling failures during server schema validation.

Review effort: Lite (dynamic)

@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default AWF

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 (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
B MCP writes (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) all 6 absent from the 23-tool catalog; 2 probed calls returned \"unknown tool\" (-32602) BLOCKED ⚠️
C CLI reads via proxied github CLI data returned for all 4 reads ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh not authenticated (no GH_TOKEN) — not attempted BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh not authenticated (no GH_TOKEN) — not attempted BLOCKED ⚠️

Overall: INCONCLUSIVE

⚠️ Part B: none of the targeted write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) appear in the gateway-backed GitHub MCP tool catalog for this workflow (only 23 read-only tools listed). The 2 probed calls failed with \"unknown tool\" (JSON-RPC -32602), which only proves backend/toolset configuration (gh-aw's tools.github: always sets GITHUB_READ_ONLY=1), not mcpg's own independent DIFC/guard enforcement layer. No write succeeded or leaked.

⚠️ Parts D/E: gh CLI is not authenticated in this environment (no GH_TOKEN), so the token-scope boundary could not be exercised. No write was attempted or leaked.

No reaction, star, issue, comment, branch, file, or PR was created on any surface. No destructive operations attempted.

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

@lpcox
lpcox merged commit 085199a into main Nov 14, 2026
28 checks passed
@lpcox
lpcox deleted the test/coverage-config-validate-server-schema-52a828b7399436a8 branch November 14, 2026 20:54
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