fix(engine): propagate and handle chart accessor errors#32167
Open
ankit98040 wants to merge 2 commits into
Open
fix(engine): propagate and handle chart accessor errors#32167ankit98040 wants to merge 2 commits into
ankit98040 wants to merge 2 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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/recAllTplsto return errors and propagate them up toEngine.Render. - Add a unit test asserting an error is returned for an unsupported chart type.
- Update existing tests to handle the new
allTemplatessignature.
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.
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
allTemplatesandrecAllTplsto returnerror, bubble up the errors to the publicRendermethods, and add testing coverage.Special notes for your reviewer:
The modified functions
allTemplatesandrecAllTplsare package-private, so this is a backwards-compatible change that does not alter any public-facing API signatures.If applicable:
docs neededlabel should be applied if so)