-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(codegen): function prologue resolution edge cases #3005
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR standardizes variable resolution and code generation across JavaScript and Python function execution contexts. The main change fixes boolean resolution to be more strict (only the string Key improvements:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant FunctionExecute as Function Execute API
participant VariableManager
participant VariableResolver
participant BlockResolver
participant IsolatedVM as Isolated VM Worker
User->>FunctionExecute: Execute function with variables
FunctionExecute->>VariableManager: resolveForExecution(value, type)
VariableManager->>VariableManager: convertToNativeType(value, 'boolean')
Note over VariableManager: Now only 'true' string → true<br/>('1' → false, changed behavior)
VariableManager-->>FunctionExecute: Resolved boolean value
FunctionExecute->>FunctionExecute: Build prologue for JS/Python
Note over FunctionExecute: Handle null: const x = null / x = None<br/>Handle boolean: const x = true / x = True<br/>Handle number: const x = 42 / x = 42
FunctionExecute->>IsolatedVM: Execute code with contextVariables
IsolatedVM->>IsolatedVM: Set context variables in jail
Note over IsolatedVM: Explicit null handling:<br/>if (value === null) jail.set(key, null)
alt Variable reference in template
User->>VariableResolver: resolveTemplate(template, block)
VariableResolver->>VariableResolver: Extract language from block config
Note over VariableResolver: language = block.config.params.language
VariableResolver->>BlockResolver: formatValueForBlock(value, blockType, isInTemplateLiteral, language)
BlockResolver->>BlockResolver: formatValueForCodeContext(value, isInTemplateLiteral, language)
Note over BlockResolver: Python: True/False/None<br/>JS: true/false/undefined/null
BlockResolver-->>VariableResolver: Formatted value
VariableResolver-->>User: Resolved template
end
|
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.
No files reviewed, no comments
|
@cursor review |
|
@cursor review |
|
@cursor review |
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.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Summary
Codegen standardized for Python vs JS in terms of variable resolution. Main change fixes boolean resolution.
Type of Change
Testing
Tested manually
Checklist