Skip to content

Conversation

@GraemeF
Copy link
Contributor

@GraemeF GraemeF commented Jan 3, 2026

Summary

GetYamlConfig was not normalizing key aliases (e.g., sync.branchsync-branch), causing bd config get sync.branch to return "not set" even when the value was correctly stored.

SetYamlConfig already normalized keys, but GetYamlConfig did not, leading to a confusing mismatch where set appeared to work but get could not find the value.

Reproduction

bd config set sync.branch beads-sync
# Output: Set sync.branch = beads-sync (in config.yaml)

bd config get sync.branch  
# Output: sync.branch (not set in config.yaml)

cat .beads/config.yaml | grep sync
# Output: sync-branch: "beads-sync"  # It IS there!

Fix

Added key normalization to GetYamlConfig to match SetYamlConfig:

func GetYamlConfig(key string) string {
    if v == nil {
        return ""
    }
    normalizedKey := normalizeYamlKey(key)  // Added this line
    return v.GetString(normalizedKey)
}

Test Plan

  • Added TestGetYamlConfig_KeyNormalization - verifies aliased key lookup works
  • Existing TestNormalizeYamlKey still passes
  • Existing TestSetYamlConfig_KeyNormalization still passes
  • All ./internal/config/... tests pass

Fixes #873

GetYamlConfig was not normalizing key aliases (e.g., sync.branch ->
sync-branch), causing 'bd config get sync.branch' to return 'not set'
even when the value was correctly stored.

SetYamlConfig already normalized keys, but GetYamlConfig did not,
leading to a confusing mismatch where set appeared to work but get
could not find the value.

Added TestGetYamlConfig_KeyNormalization to verify the fix.

Fixes steveyegge#873
@GraemeF GraemeF force-pushed the fix/get-yaml-config-normalize-keys branch from c033ca6 to 6b07ba0 Compare January 3, 2026 15:22
@steveyegge steveyegge merged commit e623746 into steveyegge:main Jan 3, 2026
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.

[Bug] GetYamlConfig doesn't normalize key aliases like SetYamlConfig does

2 participants