fix(codegen): guard against infinite recursion on cyclic helper bindings#45
Merged
Merged
Conversation
_collect_security_ta_binding_stacks recursed into an Identifier's helper binding (the `isinstance(expr_node, Identifier)` + _security_lookup_helper_binding path) WITHOUT the `resolving` cycle guard that the mutable/global/func paths in the same function already carry. A cyclic helper binding — an identifier bound to an expression that transitively references the same binding — recursed forever (hungpixi-macd-enhanced-mtf: RecursionError, transpile crash, even at limit 300000). Guard that path too, keyed by the bound node's id so acyclic bindings are completely unaffected (the guard never fires → byte-identical emission; the corpus + all other strategies are unchanged). Turns a transpiler crash into a terminating traversal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
_collect_security_ta_binding_stacksrecursed into an Identifier's helper binding without theresolvingcycle guard that the sibling mutable/global/func paths already carry. A cyclic helper binding (an identifier bound to an expression that transitively references the same binding) recursed forever —hungpixi-macd-enhanced-mtfcrashed the transpiler with RecursionError even at limit 300000.Fix
Guard that path too, keyed by the bound node's id. Acyclic bindings never trip the guard → byte-identical emission.
Verification
🤖 Generated with Claude Code