From a3cee86137085036a89e40bec74ecc30fcc4e631 Mon Sep 17 00:00:00 2001 From: Marcus H Date: Tue, 30 Jun 2026 15:36:26 +0000 Subject: [PATCH] fix: address Copilot review on coalesce warnings - add missing 'warning:' prefix and terminal period to globals key message - simplify overly verbose 'skipped value' message (remove YAML-specific wording) - shorten test assertions to stable key-path fragments Signed-off-by: Marcus H --- pkg/chart/common/util/coalesce.go | 4 ++-- pkg/chart/common/util/coalesce_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/chart/common/util/coalesce.go b/pkg/chart/common/util/coalesce.go index 76ec5c5c0..562b26ade 100644 --- a/pkg/chart/common/util/coalesce.go +++ b/pkg/chart/common/util/coalesce.go @@ -180,7 +180,7 @@ func coalesceGlobals(printf printFn, dest, src map[string]any, prefix string, _ } } else if dv, ok := dg[key]; ok && istable(dv) { // It's not clear if this condition can actually ever trigger. - printf("key %s is a mapping. Skipping", key) + printf("warning: key %s is a mapping. Skipping.", key) } else { // TODO: Do we need to do any additional checking on the value? dg[key] = val @@ -245,7 +245,7 @@ func coalesceValues(printf printFn, c chart.Charter, v map[string]any, prefix st // If the original value is nil, there is nothing to coalesce, so we don't print // the warning if val != nil { - printf("warning: skipped value for %s.%s: destination is a mapping, but the provided value is not. Use a YAML map (key:value pairs) for this key.", subPrefix, key) + printf("warning: skipped value for %s.%s: destination is a mapping, but the provided value is not.", subPrefix, key) } } else { // If the key is a child chart, coalesce tables with Merge set to true diff --git a/pkg/chart/common/util/coalesce_test.go b/pkg/chart/common/util/coalesce_test.go index 7f1a8c69c..d67f2e163 100644 --- a/pkg/chart/common/util/coalesce_test.go +++ b/pkg/chart/common/util/coalesce_test.go @@ -720,9 +720,9 @@ func TestCoalesceValuesWarnings(t *testing.T) { } t.Logf("vals: %v", vals) - assert.Contains(t, warnings, "warning: skipped value for level1.level2.level3.boat: destination is a mapping, but the provided value is not. Use a YAML map (key:value pairs) for this key.") - assert.Contains(t, warnings, "warning: destination for level1.level2.level3.spear.tip is a mapping. Ignoring non-mapping value (true)") - assert.Contains(t, warnings, "warning: cannot overwrite mapping with non-mapping value for level1.level2.level3.spear.sail (map[cotton:true])") + assert.Contains(t, warnings, "skipped value for level1.level2.level3.boat") + assert.Contains(t, warnings, "destination for level1.level2.level3.spear.tip is a mapping") + assert.Contains(t, warnings, "cannot overwrite mapping with non-mapping value for level1.level2.level3.spear.sail") } func TestConcatPrefix(t *testing.T) {