From 34807fc4f86fcfc77e5777d9d6b4d2338e83730a Mon Sep 17 00:00:00 2001 From: eilaytal Date: Thu, 30 Jul 2026 17:12:49 +0300 Subject: [PATCH] fix(chartutil): clarify unclear 'table' coalesce warnings The coalesce warnings used the term 'table' and 'non-table value' without explaining what they mean, which confused users (see #11118). This expands the three affected messages to explain, in plain terms, that a table is a nested map of keys and why the supplied value was ignored, and hints at how to resolve it. Closes #11118 Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: eilaytal --- pkg/chart/common/util/coalesce.go | 6 +++--- pkg/chart/common/util/coalesce_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/chart/common/util/coalesce.go b/pkg/chart/common/util/coalesce.go index c1f73b16d..f52dd1ec7 100644 --- a/pkg/chart/common/util/coalesce.go +++ b/pkg/chart/common/util/coalesce.go @@ -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: Not a table.", subPrefix, key) + printf("warning: skipped value for %s.%s: the chart default here is a table (a nested map of keys), but the supplied value is not, so it was ignored.", subPrefix, key) } } else { // If the key is a child chart, coalesce tables with Merge set to true @@ -349,10 +349,10 @@ func coalesceTablesFullKey(printf printFn, dst, src map[string]any, prefix strin if istable(dv) { coalesceTablesFullKey(printf, dv.(map[string]any), val.(map[string]any), fullkey, merge) } else { - printf("warning: cannot overwrite table with non table for %s (%v)", fullkey, val) + printf("warning: cannot overwrite table with non table for %s (%v): the destination is a table (a nested map of keys) but the source value is not, so the source value was ignored.", fullkey, val) } case istable(dv) && val != nil: - printf("warning: destination for %s is a table. Ignoring non-table value (%v)", fullkey, val) + printf("warning: destination for %s is a table (a nested map of keys), but the supplied value (%v) is not a table, so it was ignored. If you meant to replace the whole table, unset it first.", fullkey, val) } } return dst diff --git a/pkg/chart/common/util/coalesce_test.go b/pkg/chart/common/util/coalesce_test.go index e058bd996..961c1aa5c 100644 --- a/pkg/chart/common/util/coalesce_test.go +++ b/pkg/chart/common/util/coalesce_test.go @@ -616,9 +616,9 @@ func TestCoalesceValuesWarnings(t *testing.T) { require.NoError(t, err) t.Logf("vals: %v", vals) - assert.Contains(t, warnings, "warning: skipped value for level1.level2.level3.boat: Not a table.") - assert.Contains(t, warnings, "warning: destination for level1.level2.level3.spear.tip is a table. Ignoring non-table value (true)") - assert.Contains(t, warnings, "warning: cannot overwrite table with non table for level1.level2.level3.spear.sail (map[cotton:true])") + assert.Contains(t, warnings, "warning: skipped value for level1.level2.level3.boat: the chart default here is a table (a nested map of keys), but the supplied value is not, so it was ignored.") + assert.Contains(t, warnings, "warning: destination for level1.level2.level3.spear.tip is a table (a nested map of keys), but the supplied value (true) is not a table, so it was ignored. If you meant to replace the whole table, unset it first.") + assert.Contains(t, warnings, "warning: cannot overwrite table with non table for level1.level2.level3.spear.sail (map[cotton:true]): the destination is a table (a nested map of keys) but the source value is not, so the source value was ignored.") } func TestConcatPrefix(t *testing.T) {