Deduplicate shared config validation across TOML and stdin paths#7885
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces drift risk in configuration validation by centralizing shared validation logic used by both the TOML loader (LoadFromFile) and the JSON-stdin validation flow, and adds a regression test intended to ensure parity for invalid tool_response_filters.
Changes:
- Introduces
validateCommonServerFields(...)to share per-serverauthandtool_response_filtersvalidation across TOML and stdin paths. - Introduces
validateGatewayPayloadSizeThreshold(...)and updates both config formats to use it for gateway payload threshold validation. - Adds a parity regression test for invalid
tool_response_filtersjq expressions.
Show a summary per file
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot fix failing ci checks |
1 similar comment
|
@copilot fix failing ci checks |
Fixed in the latest commit. There were three separate issues causing CI failures:
|

Server-level config validation had drift-prone duplication between the TOML loader and JSON stdin validation flow. The same auth,
tool_response_filters, and gateway payload threshold rules were implemented in parallel, with parity enforced only by convention and comments.Shared validation helpers
validateCommonServerFields(...)to centralize per-server auth andtool_response_filtersvalidation.validateGatewayPayloadSizeThreshold(...)to centralize positive-integer validation for gateway payload threshold fields across both config formats.TOML path
LoadFromFileto delegate shared per-server validation to the new helper.payload_size_thresholdvalidation with the shared gateway helper.JSON stdin path
validateStandardServerConfigto use the shared per-server helper instead of revalidating auth and response filters inline.validateGatewayConfigto use the shared gateway payload-threshold helper.Regression coverage
tool_response_filtersinput.