fix(values): erase parent-defined subchart defaults when user sets null by abhay1999 · Pull Request #31976 · helm/helm

AI review requested due to automatic review settings

March 28, 2026 10:19

@abhay1999

When a parent chart defines a value for a subchart in its own values.yaml,
and the user supplies null for that key via --values, the null should erase
the parent-defined default per documented Helm behavior.

Previously, childChartMergeTrue correctly preserved null values through the
parent coalesce pass so they could be erased during subchart-level coalescing
(when the subchart itself has a default for that key). However, when the key
only exists in the parent chart's values.yaml and not in the subchart's own
values.yaml, no cleanup occurred — the nil persisted in the final result.

Fix: after coalescing each subchart dependency, call eraseNullsWithParentDefaults
to remove any remaining nil values where the parent chart defined a non-nil
default. This covers the gap without disturbing keys already cleaned up at
subchart level.

Fixes helm#31919

Signed-off-by: Abhay Chaurasiya <abhaychaurasiya19@gmail.com>
Signed-off-by: abhay1999 <abhaychaurasiya19@gmail.com>

@abhay1999

Use require.True/require.NoError instead of assert.True/assert.NoError
for type assertion guards before map indexing, so the test stops
immediately on failure rather than panicking.

Signed-off-by: Abhay Chaurasiya <abhaychaurasiya19@gmail.com>
Signed-off-by: abhay1999 <abhaychaurasiya19@gmail.com>