Skip to content

fix(engine): propagate and handle chart accessor errors#32167

Open
ankit98040 wants to merge 2 commits into
helm:mainfrom
ankit98040:fix/propagate-accessor-errors
Open

fix(engine): propagate and handle chart accessor errors#32167
ankit98040 wants to merge 2 commits into
helm:mainfrom
ankit98040:fix/propagate-accessor-errors

Conversation

@ankit98040
Copy link
Copy Markdown

Ensure that errors returned by NewAccessor are propagated and handled correctly rather than ignored, which prevents a potential nil-pointer dereference panic in recAllTpls. Added TestRenderInvalidChartType to prevent future regressions.

What this PR does / why we need it:
This PR updates the Helm template rendering engine to cleanly handle and propagate errors returned by the chart accessor (ci.NewAccessor). Previously, the returned error was logged or discarded, which could cause a nil-pointer dereference panic if an unsupported or invalid chart type was supplied.

We update the internal functions allTemplates and recAllTpls to return error, bubble up the errors to the public Render methods, and add testing coverage.

Special notes for your reviewer:
The modified functions allTemplates and recAllTpls are package-private, so this is a backwards-compatible change that does not alter any public-facing API signatures.

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Ensure that errors returned by NewAccessor are propagated and handled correctly rather than ignored, which prevents a potential nil-pointer dereference panic in recAllTpls. Added TestRenderInvalidChartType to prevent future regressions.

Signed-off-by: Ankit Pramanik <59945244+ankit98040@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 06:44
@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 28, 2026
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

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the engine template collection pipeline to propagate errors (instead of silently logging/ignoring them), and adds a regression test for unsupported chart types.

Changes:

  • Change allTemplates / recAllTpls to return errors and propagate them up to Engine.Render.
  • Add a unit test asserting an error is returned for an unsupported chart type.
  • Update existing tests to handle the new allTemplates signature.

Reviewed changes

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

File Description
pkg/engine/engine.go Propagates template/discovery errors via error returns instead of ignoring/logging them.
pkg/engine/engine_test.go Updates tests for new signatures and adds a new negative test case for invalid chart types.

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

Comment thread pkg/engine/engine_test.go
Comment thread pkg/engine/engine.go Outdated
Comment thread pkg/engine/engine.go Outdated
…med mock chart type

Appends subchart name/path metadata to dependency errors in recAllTpls, wraps root template collection errors in Render, and refactors TestRenderInvalidChartType to use a named unsupportedChart struct.

Signed-off-by: Ankit Pramanik <59945244+ankit98040@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants