Conversation
Add meaningful debug log calls to trace which schema compatibility fixes are applied in fixSchemaBytes. This helps diagnose schema-related issues when the upstream JSON schema changes structure. Each fix now logs: - customServerConfig type fix (negative-lookahead replacement) - customSchemas patternProperties fix (key replacement) - registry and guard-policies additions to stdio/http server configs - trustedBots and keepaliveInterval additions to gatewayConfig Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances operator visibility into schema compatibility workarounds by adding debug logging to fixSchemaBytes in internal/config/validation_schema.go, so it’s easier to tell which schema mutations were applied when validating gateway configs against an embedded/upstream JSON Schema.
Changes:
- Added debug logs for the
customServerConfig.typenegative-lookahead workaround (apply/skip). - Added debug logs for the
customSchemas.patternPropertiesnegative-lookahead key replacement. - Added debug logs when injecting gateway/server extension fields (registry, guard-policies, trustedBots, keepaliveInterval).
Show a summary per file
| File | Description |
|---|---|
| internal/config/validation_schema.go | Adds debug log statements inside fixSchemaBytes to report schema fix application/injection. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
internal/config/validation_schema.go:184
- Same as above: this log claims registry/guard-policies were "Added" to httpServerConfig, but the code overwrites any existing definitions without checking. Either avoid overwriting when already present, or adjust the log wording / log conditionally so debug output reflects what happened.
if props, ok := httpConfig["properties"].(map[string]interface{}); ok {
props["registry"] = registryProperty
props["guard-policies"] = guardPoliciesProperty
logSchema.Print("Added registry and guard-policies fields to httpServerConfig")
}
internal/config/validation_schema.go:213
- This log says trustedBots/keepaliveInterval were "Added" to gatewayConfig, but the code unconditionally assigns these keys and can overwrite upstream schema definitions if they get added later. Consider only setting them when missing and logging accordingly, or change the message to something like "Ensured" to avoid misleading debug output.
props["keepaliveInterval"] = map[string]interface{}{
"type": "integer",
"description": "Keepalive ping interval in seconds for HTTP MCP backends. Use -1 to disable, 0 or unset for gateway default (1500s), or a positive integer for a custom interval.",
}
logSchema.Print("Added trustedBots and keepaliveInterval fields to gatewayConfig")
}
- Files reviewed: 1/1 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 5 meaningful debug log calls to the
fixSchemaBytesfunction ininternal/config/validation_schema.go. This function applies several compatibility workarounds to the upstream JSON Schema before validation, but previously only logged the total elapsed time — making it difficult to determine which individual fixes were applied or skipped.Changes
Each compatibility fix in
fixSchemaBytesnow emits a debug log:not-enumconstraint (or skipped if schema structure is missing)stdioServerConfigandhttpServerConfigWhy This Helps
When the upstream schema version changes and a fix stops applying (e.g. the nested key is renamed), operators can enable
DEBUG=config:*to quickly identify which fix was skipped instead of having to diff schema bytes manually.Testing
TestFetchAndFixSchema_NetworkErrorexists onmainbefore these changes)go build ./...andgo vet ./...pass with Go 1.25.0Warning
The following domain was blocked by the firewall during workflow execution:
invalidhostthatdoesnotexist12345.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.