[codex] fix config precedence resolution#609
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #609 +/- ##
==========================================
+ Coverage 70.83% 71.01% +0.17%
==========================================
Files 53 53
Lines 5644 5682 +38
==========================================
+ Hits 3998 4035 +37
- Misses 1418 1419 +1
Partials 228 228 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes configuration precedence between CLI flags, environment variables, and the TOML config file by tracking whether options were explicitly provided via CLI/env (even when set to their default values), and only applying TOML values when an option wasn’t explicitly supplied. It also delays backend node defaulting until after TOML resolution so config-file-provided nodes can take effect.
Changes:
- Track explicit config sources (CLI vs env) using Kong parse context metadata and gate TOML application accordingly.
- Apply backend node defaults after TOML merge to ensure config-file nodes aren’t overridden by command defaults.
- Add regression tests covering explicit default-valued CLI/env options and backend precedence behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/confd/config.go | Introduces explicit-source tracking + shouldApplyTOML() to correctly resolve precedence using TOML metadata and Kong parsing info. |
| cmd/confd/cli.go | Captures explicit-source info via AfterApply() and centralizes backend node defaults in applyBackendDefaults() after TOML merge. |
| cmd/confd/config_test.go | Adds precedence regression tests for explicit default-valued CLI/env settings and backend default-vs-TOML precedence. |
| cmd/confd/cli_test.go | Updates precedence test setup for new explicit-source tracking and adds direct coverage for applyBackendDefaults(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Why
Fixes #601. The old merge logic compared parsed values against hard-coded defaults, so an explicit default-valued CLI/env setting could be treated as unset and overwritten by TOML.
Validation