From 2c57d4127586443fe5489f0a3bf32cf3813e953f Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Mon, 29 Dec 2025 14:03:31 -0800 Subject: [PATCH] fix: Show warning when config.yaml overrides database config (bd-20j) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bd config list now shows a warning when config.yaml or environment variables override database settings. This addresses the confusion when sync.branch from config.yaml takes precedence over the database value. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cmd/bd/config.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cmd/bd/config.go b/cmd/bd/config.go index a53b5f4c..07a34e12 100644 --- a/cmd/bd/config.go +++ b/cmd/bd/config.go @@ -209,9 +209,36 @@ var configListCmd = &cobra.Command{ for _, k := range keys { fmt.Printf(" %s = %s\n", k, config[k]) } + + // Check for config.yaml overrides that take precedence (bd-20j) + // This helps diagnose when effective config differs from database config + showConfigYAMLOverrides(config) }, } +// showConfigYAMLOverrides warns when config.yaml or env vars override database settings. +// This addresses the confusion when `bd config list` shows one value but the effective +// value used by commands is different due to higher-priority config sources. +func showConfigYAMLOverrides(dbConfig map[string]string) { + var overrides []string + + // Check sync.branch - can be overridden by BEADS_SYNC_BRANCH env var or config.yaml sync-branch + if dbSyncBranch, ok := dbConfig[syncbranch.ConfigKey]; ok && dbSyncBranch != "" { + effectiveBranch := syncbranch.GetFromYAML() + if effectiveBranch != "" && effectiveBranch != dbSyncBranch { + overrides = append(overrides, fmt.Sprintf(" sync.branch: database has '%s' but effective value is '%s' (from config.yaml or env)", dbSyncBranch, effectiveBranch)) + } + } + + if len(overrides) > 0 { + fmt.Println("\n⚠️ Config overrides (higher priority sources):") + for _, o := range overrides { + fmt.Println(o) + } + fmt.Println("\nNote: config.yaml and environment variables take precedence over database config.") + } +} + var configUnsetCmd = &cobra.Command{ Use: "unset ", Short: "Delete a configuration value",