Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

This PR enhances the internal/config/validation_schema.go file with debug logging to help troubleshoot schema validation issues.

Changes

  • Added logger declaration: Created logSchema logger with namespace config:validation_schema following the pkg:filename naming convention
  • Enhanced fetchAndFixSchema function: Added 4 logging calls to track schema fetching from remote URL, HTTP errors, and success
  • Enhanced validateJSONSchema function: Added 3 logging calls to track validation start, failures, and success
  • Enhanced validateStringPatterns function: Added 2 logging calls to track server count and individual server validation

Logging Calls Added (7 total)

fetchAndFixSchema

  1. Entry: logSchema.Printf("Fetching schema from URL: %s", url)
  2. Error on fetch failure: logSchema.Printf("Schema fetch failed: %v", err)
  3. Error on non-OK status: logSchema.Printf("Schema fetch returned non-OK status: %d", resp.StatusCode)
  4. Success: logSchema.Print("Schema fetched successfully, applying fixes")

validateJSONSchema

  1. Entry: logSchema.Printf("Starting JSON schema validation: data_size=%d bytes", len(data))
  2. Error: logSchema.Printf("Schema validation failed: %v", err)
  3. Success: logSchema.Print("Schema validation completed successfully")

validateStringPatterns

  1. Entry: logSchema.Printf("Validating string patterns: server_count=%d", len(stdinCfg.MCPServers))
  2. Per-server: logSchema.Printf("Validating server: name=%s, type=%s", name, server.Type)

Rationale

The validation_schema.go file (371 lines) handles JSON schema validation - a complex operation that can fail in multiple ways. These debug logs will help developers:

  • Track schema fetching from remote URLs
  • Diagnose HTTP errors during schema retrieval
  • Understand validation failures
  • Debug configuration issues with specific servers

Quality Checklist

  • ✅ Exactly 1 file modified (focused, single-file PR)
  • ✅ No test files modified
  • ✅ Logger naming follows pkg:filename convention
  • ✅ Logger arguments have no side effects
  • ✅ Logging messages are meaningful and helpful
  • ✅ No duplicate logging with existing logs
  • ✅ Follows AGENTS.md guidelines

Testing

Enable debug logging with:

DEBUG=config:validation_schema ./awmg --config config.toml

Or enable all debug logs:

DEBUG=* ./awmg --config config.toml

AI generated by Go Logger Enhancement

- Add logger import and create logSchema logger with namespace 'config:validation_schema'
- Add logging to fetchAndFixSchema: URL, errors, and success messages
- Add logging to validateJSONSchema: data size, validation results
- Add logging to validateStringPatterns: server count and validation details
- Total of 7 meaningful debug logging calls for troubleshooting schema validation issues
@github-actions github-actions bot added automation enhancement New feature or request labels Jan 23, 2026
@lpcox lpcox marked this pull request as ready for review January 23, 2026 15:53
@lpcox lpcox merged commit 767da25 into main Jan 23, 2026
@lpcox lpcox deleted the go-logger/config-validation-schema-enhancement-1e20226fe61d12c5 branch January 23, 2026 15:53
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