Repository navigation
[test] Add tests for config.validateServerAgainstSchema - #16544
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟢 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)
🔒 mcpg Read-Only Stress — default AWFSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No reaction, star, issue, comment, branch, file, or PR was created on any surface. No destructive operations attempted.
|
Function Analyzed
internal/configvalidateServerAgainstSchemaWhy 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
GuardPoliciesvalues return an error rather than being silently omitted or causing a panic.Coverage Report
Test Execution
go test -count=1 -v ./internal/config -run '^TestValidateServerAgainstSchema_MarshalError$'— passedgo 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 confirmedserdeis 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.comnonexistent.localslow.example.comthishostdoesnotexist12345.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.