fix: preserve literal code fences in template config#2072
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughObject evaluation now accepts variadic options and builds options from them; runtime evaluation disables substitution for omitted template params; tests (integration and unit) added to ensure multi-line Markdown code fences survive template interpolation; node signal handling order adjusted and tests updated to assert aborted state timing. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/intg/template_test.go (1)
223-226: ⚡ Quick winAssert the closing code fence too to tighten the regression guard.
This test proves the opening fence is preserved, but it can still pass if the trailing fence is dropped. Add one assertion for the closing fence marker.
Proposed diff
dag.AssertOutputs(t, map[string]any{ "RESULT": []test.Contains{ test.Contains("```yaml"), + test.Contains("\n```"), test.Contains("touch $TEST_FILE"), }, })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/intg/template_test.go` around lines 223 - 226, The test currently asserts the opening code fence via test.Contains("```yaml") but doesn't verify the closing fence; update the "RESULT" assertions in the template test (the slice of test.Contains entries) to include an assertion for the closing fence marker (for example test.Contains("\n```") or equivalent) right after the opening-fence check so the test fails if the trailing ``` is dropped.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/intg/template_test.go`:
- Around line 223-226: The test currently asserts the opening code fence via
test.Contains("```yaml") but doesn't verify the closing fence; update the
"RESULT" assertions in the template test (the slice of test.Contains entries) to
include an assertion for the closing fence marker (for example
test.Contains("\n```") or equivalent) right after the opening-fence check so the
test fails if the trailing ``` is dropped.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0009713c-852e-45cf-85f5-0319abe83252
📒 Files selected for processing (2)
internal/intg/template_test.gointernal/runtime/node_internal_test.go
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/runtime/node_test.go (1)
229-237: ⚡ Quick winAdd bounded waits to avoid potential test hangs on regressions.
Line 229 and Line 234 block indefinitely. If signal flow regresses, this test can stall until global
go testtimeout. Use timeout-guarded receives for faster, clearer failures.Proposed patch
- <-exec.killStarted + select { + case <-exec.killStarted: + case <-time.After(2 * time.Second): + t.Fatal("timeout waiting for Kill to start") + } require.Equal(t, core.NodeAborted.String(), node.State().Status.String()) close(exec.killContinue) - err := <-errCh + var err error + select { + case err = <-errCh: + case <-time.After(2 * time.Second): + t.Fatal("timeout waiting for Execute to return") + } require.Error(t, err) require.Contains(t, err.Error(), "signal: interrupt")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/runtime/node_test.go` around lines 229 - 237, The test currently performs unbounded receives on exec.killStarted and errCh which can hang; change those blocking receives to timeout-guarded selects (e.g., select with time.After) so the test fails fast on regressions. Specifically, replace the receive from exec.killStarted and the receive from errCh with select statements that return a helpful test error if a timeout elapses, and likewise guard the final assert after closing exec.killContinue; keep assertions using node.State().Status.String() and core.NodeAborted.String() intact but fail the test with a clear message if the timeouts trigger.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/runtime/node_test.go`:
- Around line 229-237: The test currently performs unbounded receives on
exec.killStarted and errCh which can hang; change those blocking receives to
timeout-guarded selects (e.g., select with time.After) so the test fails fast on
regressions. Specifically, replace the receive from exec.killStarted and the
receive from errCh with select statements that return a helpful test error if a
timeout elapses, and likewise guard the final assert after closing
exec.killContinue; keep assertions using node.State().Status.String() and
core.NodeAborted.String() intact but fail the test with a clear message if the
timeouts trigger.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d5de3642-a1e5-46a0-ab8c-ba995e73f59e
📒 Files selected for processing (2)
internal/runtime/node.gointernal/runtime/node_test.go
✅ Files skipped from review due to trivial changes (1)
- internal/runtime/node.go
Summary
Preserve literal fenced template data in
type: templateexecutor config.What Changed
with:data while keeping variable expansion and omitted optional param handlingWhy
Template step config evaluation was treating backticks inside
with.dataas command substitution before the template executor ran. When a prior step injected fenced YAML or Markdown into template data, executor setup tried to run that content as shell commands and failed before rendering.Validation
go test ./internal/runtime -run 'TestEvalExecutorConfig_Template' -count=1go test ./internal/intg -run 'TestTemplateExecutor' -count=1go test ./... -run '^$' -count=1Summary by CodeRabbit
Bug Fixes
Tests
Refactor