-
Notifications
You must be signed in to change notification settings - Fork 25
pkg/engine: debugPhase panics on empty patch in --debug output loop #152
Copy link
Copy link
Closed
Labels
area/engineIssues or PRs related to pkg/engine (rendering, MergeFileAsPatch, helm)Issues or PRs related to pkg/engine (rendering, MergeFileAsPatch, helm)kind/bugCategorizes issue or PR as related to a bugCategorizes issue or PR as related to a bugpriority/backlogGeneral backlog priority. Lower than priority/important-longtermGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked onIndicates an issue is ready to be actively worked on
Metadata
Metadata
Assignees
Labels
area/engineIssues or PRs related to pkg/engine (rendering, MergeFileAsPatch, helm)Issues or PRs related to pkg/engine (rendering, MergeFileAsPatch, helm)kind/bugCategorizes issue or PR as related to a bugCategorizes issue or PR as related to a bugpriority/backlogGeneral backlog priority. Lower than priority/important-longtermGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked onIndicates an issue is ready to be actively worked on
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
pkg/engine/engine.go:99indexes intopatch[0]without checking thatpatchis non-empty. An empty patch string in the slice passed todebugPhasetriggers a runtime panic instead of a clean error.Code
Trigger conditions
debugPhaseis invoked fromapplyPatchesAndRenderConfigandFullConfigProcesswhenopts.Debug == true(--debugflag /TALM_DEBUG). The argumentpatchesis the rendered chart output, one entry per template file. A template that produces an empty document (e.g. an entirely conditional template where every guard evaluates false) feeds""into the slice. Result: panic on the first iteration.The path is gated behind
--debugso the only operator-observable form is "talm crashed when I tried to debug a problem" — exactly the worst time for the tool to fail loudly.Suggested fix
Notes
Spotted by inspection while raising
pkg/enginetest coverage on branchtest/chart-contract. Not currently triggerable from the shipped charts (every template they ship produces non-empty output), but reachable by any user-authored template that conditionally emits.