Skip to content

[log] log: add debug logging to fixSchemaBytes in validation_schema.go#4986

Merged
lpcox merged 3 commits intomainfrom
log/validation-schema-fix-logging-62968af82751945e
May 2, 2026
Merged

[log] log: add debug logging to fixSchemaBytes in validation_schema.go#4986
lpcox merged 3 commits intomainfrom
log/validation-schema-fix-logging-62968af82751945e

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 2, 2026

Summary

Adds 5 meaningful debug log calls to the fixSchemaBytes function in internal/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 fixSchemaBytes now emits a debug log:

  • customServerConfig type fix – logs when the negative-lookahead pattern is replaced with a not-enum constraint (or skipped if schema structure is missing)
  • customSchemas patternProperties fix – logs the exact key being replaced
  • registry / guard-policies additions – logs when these extension fields are injected into stdioServerConfig and httpServerConfig
  • trustedBots / keepaliveInterval additions – logs when these gateway config fields are injected

Why 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

  • Existing tests pass (one pre-existing failure TestFetchAndFixSchema_NetworkError exists on main before these changes)
  • go build ./... and go vet ./... pass with Go 1.25.0

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • invalidhostthatdoesnotexist12345.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "invalidhostthatdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Go Logger Enhancement · ● 9.1M ·

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>
@github-actions github-actions Bot added automation enhancement New feature or request labels May 2, 2026
@lpcox lpcox requested a review from Copilot May 2, 2026 15:16
@lpcox lpcox marked this pull request as ready for review May 2, 2026 15:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.type negative-lookahead workaround (apply/skip).
  • Added debug logs for the customSchemas.patternProperties negative-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

Comment thread internal/config/validation_schema.go Outdated
Comment thread internal/config/validation_schema.go Outdated
lpcox and others added 2 commits May 2, 2026 08:19
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>
@lpcox lpcox merged commit 4c84f1c into main May 2, 2026
14 checks passed
@lpcox lpcox deleted the log/validation-schema-fix-logging-62968af82751945e branch May 2, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants