Repository navigation
[test] Add tests for config.compileSchemaDocument - #16338
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
A moderate active finding remains because the test compiles an unregistered HTTPS URL, making it dependent on network access and potentially slow or flaky instead of deterministically testing the missing-resource error.
1 open issue
What changed in this PR
Adds focused unit coverage for compileSchemaDocument and schemaCompileError in internal/config, covering successful compilation, validation, resource handling, compilation failures, and error unwrapping.
Changes:
- Tests successful schema compilation and instance validation.
- Exercises multiple resource IDs and resource registration failures.
- Verifies compile errors,
Error(),Unwrap(), anderrors.Isbehavior.
| File | Description |
|---|---|
| internal/config/compile_schema_document_test.go | Adds unit tests for schema compilation, validation, resource handling, failure paths, and wrapped compile-error behavior. |
Review effort: Lite (auto)
| }) | ||
|
|
||
| t.Run("success with no resource IDs fails at compile as unresolved", func(t *testing.T) { | ||
| schema, cerr := compileSchemaDocument(newCompiler(), "https://example.test/missing.json", validDoc) |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No write leaked through mcpg in any surface tested. Full log:
|
Co-authored-by: lpcox <[email protected]>
Fixed the testifylint failure by changing the successful schema validation check to |

Test Coverage Improvement: compileSchemaDocument
Function Analyzed
internal/configcompileSchemaDocument(+schemaCompileError.Unwrap)Unwrap0%;compileSchemaDocumentonly partially covered via indirect pathsWhy This Function?
Package coverage is already high (~98%);
Unwrapwas the only 0% function in the config package, and the error-typed return ofcompileSchemaDocumentis core to schema validation error reporting.Tests Added
AddResourcefailure (resourceID populated,compile=false)Compilefailure on invalid schema (compile=true)Error()/Unwrap()/errors.IsTest Execution
Generated by Test Coverage Improver
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.