Skip to content

fix(engine): require a template before rendering the chart#217

Open
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
mainfrom
fix/template-no-templates-guard
Open

fix(engine): require a template before rendering the chart#217
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
mainfrom
fix/template-no-templates-guard

Conversation

@lexfrei

Copy link
Copy Markdown
Contributor

What

talm template with no --file/--template rendered the entire chart before checking that any template was actually requested. The render was wasted (its output is discarded), and online it fired live discovery first — so an operator who simply forgot --file saw a misleading connection refused from a node dial instead of the actionable templates are not set error.

How

Move the empty-TemplateFiles guard ahead of the chart load and render, after the online multi-node precondition (which does no network I/O). The same error is now raised before any render or node dial, in both offline and online modes.

Testing

  • New contract test pins that the guard fires before rendering: a chart body that errors if executed stays unrendered.
  • Full engine and module suite green.

Render rendered the entire chart and only afterwards checked that a
template was actually requested. When none was, the render was wasted —
its output is discarded — and online it first fired live lookups against
the target node. An operator who forgot --file / --template therefore
saw a misleading "connection refused" from discovery instead of the
actionable "templates are not set" error.

Move the empty-TemplateFiles guard ahead of the chart load and render
(after the online multi-node precondition, which does no network I/O).
The command now fails fast with the correct, actionable error in both
offline and online modes, and never renders or dials a node when there
is nothing to select.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@lexfrei, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 629 minutes and 26 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f08a2bd9-0c87-4007-8b8c-40bd1d17af86

📥 Commits

Reviewing files that changed from the base of the PR and between cb340ab and d320cc6.

📒 Files selected for processing (2)
  • pkg/engine/contract_render_test.go
  • pkg/engine/engine.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/template-no-templates-guard

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request optimizes the Render function in pkg/engine/engine.go by moving the check for empty TemplateFiles earlier in the execution flow, before the chart is loaded and rendered. This prevents unnecessary rendering overhead and ensures that the 'templates are not set' error is returned immediately rather than being masked by potential rendering errors. A corresponding contract test has been added to verify this short-circuiting behavior. There are no review comments to address, and the changes look solid.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@lexfrei Aleksei Sviridkin (lexfrei) marked this pull request as ready for review June 5, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant