Problem statement
Code review identified several uncovered branches across the templating and transport packages. Key gaps:
Templating (validation.go)
rootFromDigArgs — 0% coverage. The dig function root extraction is completely untested. Needs tests for {{ dig "key" "subkey" .steps }} and dot-root patterns.
walkTemplateNode — 21.1% coverage. Missing tests for IfNode, RangeNode (including AllowRange rejection), WithNode, and TemplateNode (inclusion rejection).
walkJSONTemplates — No test for $bubuTemplate with non-string value (type error branch).
rootNameFromNode — Missing tests for ChainNode with DotNode, PipeNode, and CommandNode bases.
Transport (dial.go)
classifyCallError — Missing tests for: (a) timeout=0 with parent DeadlineExceeded (should NOT wrap with timeout message), (b) callback returns non-context error passthrough, (c) callback returns nil but context is Canceled.
deriveCallContext — No test for nil context or zero/negative timeout.
Proposed change
Add the following test functions:
// templating/validation_test.go
TestValidateTemplateStringWithIfNode
TestValidateTemplateStringWithRangeNodeAllowed
TestValidateTemplateStringWithRangeNodeRejected
TestValidateTemplateStringWithWithNode
TestValidateTemplateStringRejectsTemplateInclusion
TestValidateTemplateStringRejectsDigBypass
TestValidateJSONTemplatesRejectsNonStringExprKey
TestValidateTemplateStringDigWithDotRoot
// runtime/transport/connector/dial_test.go
TestCallWithTimeoutPassesCallbackError
TestCallWithTimeoutZeroTimeoutDoesNotWrapDeadline
TestCallWithTimeoutNilContext
TestCallWithTimeoutSuccessButContextCancelled
Affected area
Compatibility / migration
Test-only changes. No behavior changes.
Alternatives considered
N/A — these are straightforward missing test cases.
Additional context
Current coverage: templating 49.9%, runtime/transport/connector 65.4%. These tests would significantly improve branch coverage in the most critical paths. Identified during code review.
Problem statement
Code review identified several uncovered branches across the templating and transport packages. Key gaps:
Templating (
validation.go)rootFromDigArgs— 0% coverage. Thedigfunction root extraction is completely untested. Needs tests for{{ dig "key" "subkey" .steps }}and dot-root patterns.walkTemplateNode— 21.1% coverage. Missing tests forIfNode,RangeNode(includingAllowRangerejection),WithNode, andTemplateNode(inclusion rejection).walkJSONTemplates— No test for$bubuTemplatewith non-string value (type error branch).rootNameFromNode— Missing tests forChainNodewithDotNode,PipeNode, andCommandNodebases.Transport (
dial.go)classifyCallError— Missing tests for: (a)timeout=0with parentDeadlineExceeded(should NOT wrap with timeout message), (b) callback returns non-context error passthrough, (c) callback returns nil but context isCanceled.deriveCallContext— No test for nil context or zero/negative timeout.Proposed change
Add the following test functions:
Affected area
templatingruntime/*Compatibility / migration
Test-only changes. No behavior changes.
Alternatives considered
N/A — these are straightforward missing test cases.
Additional context
Current coverage:
templating49.9%,runtime/transport/connector65.4%. These tests would significantly improve branch coverage in the most critical paths. Identified during code review.