[test-improver] Improve tests for internal/config (remote schema $ref byte budget) - #11469
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds coverage for aggregate remote $ref byte-budget enforcement.
Changes:
- Tests cumulative schema size rejection.
- Verifies the expected error and request count.
Show a summary per file
| File | Description |
|---|---|
internal/config/validate_against_custom_schema_test.go |
Adds remote-reference byte-budget coverage. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked through. No FAIL conditions observed.
|
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. All reads succeeded. References: §32261095813
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE Notes:
References: §32261095238
|
Summary
Improved test coverage for
internal/config/validate_against_custom_schema_test.go, which tests the custom JSON-Schema validation path ininternal/config/validation_schema.goandvalidation_server.go.File analyzed
internal/config/validate_against_custom_schema_test.go(already testify-based; 97.2% package coverage before this change).Improvement
Added
TestValidateAgainstCustomSchema_RemoteRefByteBudgetIsEnforced, covering the previously-untestedreserveBytesaggregate byte-budget error path inschemaURLLoader.Load(validation_schema.go). The existing test suite only covered the document-count budget (maxRemoteRefDocuments) for remote$refchains, but not the aggregate byte-size budget (maxRemoteRefTotalBytes) enforced byreserveBytes.The new test serves two remote
$refdocuments that are each individually underfetchSchema's per-fetch size limit, but together exceed the aggregatemaxRemoteRefTotalBytesbudget, verifying:Coverage
reserveBytes83.3%, package total 97.2%reserveBytes100%, package total 97.4%Test output
Full package suite (
go test -count=3 ./internal/config/) passes,gofmt -lreports no issues, andgo vet ./internal/config/is clean.