Skip to content

Jlohmer/coalesce nil#31979

Open
Y0-L0 wants to merge 5 commits intohelm:mainfrom
Y0-L0:jlohmer/coalesce-nil
Open

Jlohmer/coalesce nil#31979
Y0-L0 wants to merge 5 commits intohelm:mainfrom
Y0-L0:jlohmer/coalesce-nil

Conversation

@Y0-L0
Copy link
Copy Markdown

@Y0-L0 Y0-L0 commented Mar 28, 2026

Fix nil value preservation regression introduced by #31644, which was too aggressive — it preserved nil values from subchart defaults, not just user overrides. This caused three downstream problems:

  1. %!s(<nil>) in rendered output — subchart default null values survive coalescing and produce %!s(<nil>) when stringified (breaks Bitnami common.secrets.key / subPath mounts)
  2. User null can't erase subchart defaults--values with null no longer deletes child values, breaking documented behavior
  3. Subchart default nil shadows global valuespluck-based fallback patterns return nil instead of falling through to globals (Subchart default nil values shadow global values via pluck (regression from #31644) #31971)

Changes

closes #31919
closes #31971

Special notes for your reviewer:

If applicable:

  • this PR contains unit tests
  • this PR has been tested for backwards compatibility.

Copilot AI review requested due to automatic review settings March 28, 2026 19:21
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 28, 2026
@Y0-L0 Y0-L0 force-pushed the jlohmer/coalesce-nil branch from bfbdf7f to 06ed8a9 Compare March 28, 2026 19:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds regression tests around Helm values coalescing when subchart defaults contain nil, aiming to prevent nils from being preserved in final merged values (which can break pluck-style fallbacks and lead to nil stringification artifacts during rendering).

Changes:

  • Add 3 unit tests covering subchart-default-nil cleanup, user null erasure behavior, and global fallback behavior during coalescing.
  • Add 1 engine-level render test intended to cover the “%!s(<nil>) in rendered output” regression.
  • Minor doc comment tweaks, .gitignore update, and Go module dependency bumps.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/registry/client.go Comment/docstring refinements for registry client options and login.
pkg/engine/engine_test.go Adds an integration-style render test for subchart default nil behavior.
pkg/chart/common/util/coalesce_test.go Adds regression-focused unit tests for coalescing behavior around nils.
go.mod Bumps github.com/ProtonMail/go-crypto and github.com/lib/pq versions.
go.sum Updates checksums corresponding to the module version bumps.
.gitignore Adds .claude to ignored files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Y0-L0 Y0-L0 force-pushed the jlohmer/coalesce-nil branch from 06ed8a9 to cfbde43 Compare March 28, 2026 19:33
Copilot AI review requested due to automatic review settings March 28, 2026 20:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Y0-L0 Y0-L0 force-pushed the jlohmer/coalesce-nil branch from 723037d to 06d510b Compare March 28, 2026 20:18
Copilot AI review requested due to automatic review settings March 29, 2026 18:11
@Y0-L0 Y0-L0 force-pushed the jlohmer/coalesce-nil branch from 06d510b to a307ce0 Compare March 29, 2026 18:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

banjoh
banjoh previously approved these changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@banjoh banjoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this contribution to fix the regression.

Note to self: The fix ensures that no null values are left behind after merging. These null values cause conditionals such as subPath: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") | quote }} template to evaluate as subPath: null since existingSecret would be null instead of being removed

As a side comment, this code has gotten really complex overtime (not related to you PR, just an observation)

Copilot AI review requested due to automatic review settings April 1, 2026 18:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Y0-L0
Copy link
Copy Markdown
Author

Y0-L0 commented Apr 2, 2026

As a side comment, this code has gotten really complex overtime (not related to you PR, just an observation)

100% agree. While implementing the fix, I had to stop myself multiple times from refactoring things. 😉
I'm quite tempted to refactor it. And with some more property-based regression tests around it, I believe I could do it quite safely.

On the other hand with the values/v1 plugin, I suppose bigger changes are coming to this part of the code. Maybe we wait until that's fleshed out further to avoid a double refactoring. 🤔
Also a refactoring in v4 would make future backports harder...

Y0-L0 and others added 3 commits April 2, 2026 15:48
Three test cases that cover the regression scenarios introduced
by the helm#31644 nil preservation fix:

- subchart default nils should be cleaned up
when parent doesn't set those keys (helm#31919)
- user-supplied null should erase subchart defaults (helm#31919)
- subchart default nil should not shadow global values via pluck (helm#31971)

Tests are expected to fail until the regression is fixed.

Signed-off-by: Johannes Lohmer <jojo.dev@lohmer.com>
Regression test for the Bitnami common.secrets.key issue.

Signed-off-by: Johannes Lohmer <jojo.dev@lohmer.com>
Only user-supplied nils should survive coalescing. Chart-default nils
defaults, not just user overrides. This caused:
- %!s(<nil>) in templates using Bitnami common.secrets.key (helm#31919)
- pluck fallbacks returning nil instead of falling through to globals
  (helm#31971)

Fixes helm#31919
Fixes helm#31971

Signed-off-by: Johannes Lohmer <jojo.dev@lohmer.com>
Y0-L0 and others added 2 commits April 2, 2026 15:48
…rt maps

Signed-off-by: Johannes Lohmer <jojo.dev@lohmer.com>
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
@Y0-L0 Y0-L0 force-pushed the jlohmer/coalesce-nil branch from 00d224f to cd697b9 Compare April 2, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subchart default nil values shadow global values via pluck (regression from #31644) Regression in null merging between parent.values and --values

3 participants