-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Misc fixes #13631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc fixes #13631
Conversation
c644f3e to
7074c27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses issue #13627 by detecting and failing on infinite template recursion. Key changes include:
- Adding a new integration test (TestTemplateLoop) to verify infinite recursion detection.
- Introducing a recursion level check in TemplateStore with a threshold of 500.
- Removing the previously used timeout mechanism for partial inclusion in favor of direct infinite recursion detection.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tpl/tplimpl/templatestore_integration_test.go | Added a test to check for infinite recursion detection. |
| tpl/tplimpl/templatestore.go | Introduced level tracking and recursion check with a threshold. |
| tpl/template.go | Updated template info to include recursion level. |
| tpl/partials/partials_integration_test.go | Updated expected error message for infinite recursion detection. |
| tpl/partials/partials.go | Replaced the timeout-based partial inclusion with a direct call, and updated associated error assignment. |
Comments suppressed due to low confidence (1)
tpl/partials/partials.go:202
- The field 'mangager' appears to be a typo; consider renaming it to 'manager' to improve clarity.
r.mangager = depsManagerShared
| func (ns *Namespace) Include(ctx context.Context, name string, contextList ...any) (any, error) { | ||
| res := ns.includWithTimeout(ctx, name, contextList...) | ||
| res := ns.include(ctx, name, contextList...) | ||
| if res.err != nil { | ||
| return nil, res.err |
Copilot
AI
Apr 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing the call to ns.includWithTimeout with ns.include removes the timeout safeguard, which may lead to hanging execution if a partial is slow but not recursively calling itself. Consider reintroducing a timeout mechanism or an alternative safeguard for non-recursive slow partials.
30acb51 to
a4eae43
Compare
66e9729 to
e26adcf
Compare
Fixes #13627