Skip to content

Make config load failures explicit and preserve defaults for missing config#35

Draft
JanSmrcka with Copilot wants to merge 7 commits into
masterfrom
copilot/improve-config-load-observability
Draft

Make config load failures explicit and preserve defaults for missing config#35
JanSmrcka with Copilot wants to merge 7 commits into
masterfrom
copilot/improve-config-load-observability

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown

Config loading was silently swallowing parse failures, which made bad user config hard to diagnose as the config surface expanded. This change makes invalid config errors explicit while keeping missing config on the existing graceful-defaults path.

  • Config load behavior

    • Change internal/config.Load / LoadFrom to return (Config, error).
    • Treat missing config file as a non-error and return defaults.
    • Surface invalid JSON and file read failures with contextual, user-facing errors.
  • CLI error propagation

    • Update command entrypoints to handle config load errors instead of continuing with partially understood state.
    • Preserve normal startup behavior when no config file exists.
  • Malformed config coverage

    • Extend config tests to distinguish:
      • missing file → defaults, no error
      • invalid JSON → defaults plus explicit error
      • valid file → loaded config, no error

Example of the new load contract:

cfg, err := config.LoadFrom(path)
if err != nil {
    return fmt.Errorf("invalid config: %w", err)
}

Copilot AI changed the title [WIP] Improve config load observability and error reporting Make config load failures explicit and preserve defaults for missing config Jun 23, 2026
Copilot AI requested a review from JanSmrcka June 23, 2026 12:20
@JanSmrcka JanSmrcka requested a review from Copilot June 23, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread internal/config/config.go Outdated
Comment thread internal/config/config.go Outdated
Comment thread cmd/root.go Outdated
Comment thread cmd/root.go Outdated
Comment thread cmd/root.go Outdated
JanSmrcka and others added 5 commits July 8, 2026 09:17
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>
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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants