Is your feature request related to a problem? Please describe.
The helper conversion approach (introduced in #92) uses call-site-driven type detection to determine whether a helper produces structured YAML (CUE struct) or plain text (CUE string). Type signals have two confidence levels:
- Strong: determined by pipeline functions (e.g.
quote → scalar, join → struct). These definitively constrain the helper's output type.
- Weak: inferred from YAML position (inline string, block scalar, etc.). Position tracking can be imprecise in complex templates.
When a helper is used in multiple call sites with different inferred types:
- Strong–strong conflicts produce an error (template is skipped).
- Weak conflicts (at least one side is position-inferred) emit a warning and proceed with first-encounter-wins.
The weak-conflict warnings surface cases where the converter's output may be incorrect for some call sites. In the integration test charts, these warnings appear for helpers like kube-prometheus-stack.namespace and common.tplvalues.render that are genuinely used in both struct and scalar YAML positions.
Describe the solution you'd like
This is a tracking issue for improvements to helper type detection. Potential directions:
- Dual-form helpers: generate both a struct and scalar form of a helper when conflicting contexts are detected, selecting the appropriate form at each call site.
- Variable usage analysis: when a helper is included via variable assignment (
$x := include ...), analyse how $x is used to determine the type instead of relying on position defaults.
- Improved position tracking: reduce false weak-conflict warnings by improving
isScalarContext precision in complex templates (nested control structures, block scalars with conditionals, etc.).
Describe alternatives you've considered
The current approach (warn on weak conflicts, error on strong conflicts) is a pragmatic balance. It avoids conversion regressions while surfacing ambiguities. No immediate action is needed — this issue tracks the known limitation for future improvement.
Additional context
See doc.go for the full helper conversion strategy. The helperTypeInfo struct in convert.go carries the confidence level. Integration test golden files (testdata/integration/*.txt) capture the current warnings.
Is your feature request related to a problem? Please describe.
The helper conversion approach (introduced in #92) uses call-site-driven type detection to determine whether a helper produces structured YAML (CUE struct) or plain text (CUE string). Type signals have two confidence levels:
quote→ scalar,join→ struct). These definitively constrain the helper's output type.When a helper is used in multiple call sites with different inferred types:
The weak-conflict warnings surface cases where the converter's output may be incorrect for some call sites. In the integration test charts, these warnings appear for helpers like
kube-prometheus-stack.namespaceandcommon.tplvalues.renderthat are genuinely used in both struct and scalar YAML positions.Describe the solution you'd like
This is a tracking issue for improvements to helper type detection. Potential directions:
$x := include ...), analyse how$xis used to determine the type instead of relying on position defaults.isScalarContextprecision in complex templates (nested control structures, block scalars with conditionals, etc.).Describe alternatives you've considered
The current approach (warn on weak conflicts, error on strong conflicts) is a pragmatic balance. It avoids conversion regressions while surfacing ambiguities. No immediate action is needed — this issue tracks the known limitation for future improvement.
Additional context
See
doc.gofor the full helper conversion strategy. ThehelperTypeInfostruct inconvert.gocarries the confidence level. Integration test golden files (testdata/integration/*.txt) capture the current warnings.