[log] Add debug logging to config validation error factories by github-actions[bot] · Pull Request #8108 · github/gh-aw-mcpg · GitHub
Skip to content

[log] Add debug logging to config validation error factories#8108

Merged
lpcox merged 2 commits into
mainfrom
log/config-validation-errors-logging-b7c7e23fbfb2e6f0
Jun 26, 2026
Merged

[log] Add debug logging to config validation error factories#8108
lpcox merged 2 commits into
mainfrom
log/config-validation-errors-logging-b7c7e23fbfb2e6f0

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds logValidation.Printf debug logging to four validation error factory functions in internal/config/validation_errors.go that were previously silent.

Changes

Added debug logging to:

  • UndefinedVariable — logs the JSON path and variable name when an env var reference is unresolved
  • MissingRequired — logs field name, server type, and JSON path when a required field is absent
  • InvalidPattern — logs field name and value when a pattern match fails (e.g. container image, URL, mount)
  • SchemaValidationError — logs server type and message for schema validation failures

UnsupportedType already had a log call; InvalidValue and UnsupportedField are either trivial delegates or general-purpose and left unlogged.

Why

When debugging configuration issues (e.g. DEBUG=config:*), there was no way to trace which specific validation path triggered an error. Logging at construction time provides the exact JSON path and context without any side effects on the returned error values.

Validation

  • go test ./internal/config/...
  • go vet ./internal/config/...
  • go build

Generated by Go Logger Enhancement · 208.8 AIC · ⊞ 8.3K ·

Add logValidation.Printf calls to UndefinedVariable, MissingRequired,
InvalidPattern, and SchemaValidationError in internal/config/validation_errors.go.

These factory functions create ValidationError values for config failures.
Logging at creation time makes it easier to trace which validation path
triggered an error when debugging configuration issues with DEBUG=config:*.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Jun 25, 2026
@lpcox lpcox marked this pull request as ready for review June 26, 2026 14:33
Copilot AI review requested due to automatic review settings June 26, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves debuggability of configuration validation by adding logValidation.Printf debug logs inside several ValidationError factory helpers, so DEBUG=config:* output includes the specific JSON path and context that triggered the validation failure.

Changes:

  • Added debug logging to UndefinedVariable, MissingRequired, InvalidPattern, and SchemaValidationError.
  • Kept existing error values/formatting unchanged while increasing diagnostic context at error-construction time.
Show a summary per file
File Description
internal/config/validation_errors.go Adds debug logs to key ValidationError constructors to surface JSON path + context during config validation failures.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread internal/config/validation_errors.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
GitHub Advanced Security started work on behalf of lpcox June 26, 2026 15:08 View session
GitHub Advanced Security finished work on behalf of lpcox June 26, 2026 15:08
@lpcox lpcox merged commit 5fa1bf2 into main Jun 26, 2026
27 checks passed
@lpcox lpcox deleted the log/config-validation-errors-logging-b7c7e23fbfb2e6f0 branch June 26, 2026 15:15
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