Skip to content

fix(code-subblock): added validation to not parse non-variables as variables in the code subblock#1240

Merged
waleedlatif1 merged 4 commits intostagingfrom
sim-47
Sep 3, 2025
Merged

fix(code-subblock): added validation to not parse non-variables as variables in the code subblock#1240
waleedlatif1 merged 4 commits intostagingfrom
sim-47

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

added validation to not parse non-variables as variables in the code subblock, fixed styling of wand prompt bar and icons not visible in dark mode

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Before:
Screenshot 2025-09-03 at 1 03 04 PM

After:
Screenshot 2025-09-03 at 1 03 16 PM

@vercel
Copy link

vercel bot commented Sep 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 3, 2025 11:07pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 3, 2025 11:07pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses two main issues: variable parsing bugs in code subblocks and dark mode styling problems across the UI. The core fix implements validation logic in the InputResolver (resolver.ts) to prevent non-variable patterns like comparison operators (<=, >=) and HTML-like tags from being incorrectly parsed as variable references. The new isValidVariableReference() method ensures only properly formatted variable references containing dots (e.g., <block.property>) are processed, preventing runtime errors and unintended variable substitution in user code.

The styling improvements span multiple components to fix dark mode visibility issues. The wand (AI generation) button styling is standardized across input components by changing hover text color from text-primary to text-foreground, ensuring proper contrast in dark themes. The wand prompt bar positioning is updated from absolute top positioning to bottom-full positioning, making it appear above trigger elements with better visual hierarchy. Additionally, the code editor replaces custom HTML buttons with standardized Button components for consistency.

The PR also removes JSON validation UI indicators from the code subblock component while preserving the underlying validation logic. This prevents non-JSON content (like JavaScript or Python) from being incorrectly flagged with red borders and error tooltips. The custom tool modal receives UX improvements by replacing text-based error display with icon-based tooltips using the AlertTriangle icon.

These changes work together to create a more robust variable parsing system while ensuring consistent, theme-aware UI behavior across the workflow editor components.

7 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

<AlertTriangle className='h-4 w-4 cursor-pointer text-destructive' />
</TooltipTrigger>
<TooltipContent side='top'>
<p>Invalid JSON</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider making the tooltip message more specific to the actual error type rather than generic 'Invalid JSON'

@vercel vercel bot temporarily deployed to Preview – docs September 3, 2025 23:03 Inactive
@waleedlatif1 waleedlatif1 merged commit 26243b9 into staging Sep 3, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the sim-47 branch September 3, 2025 23:09
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…riables in the code subblock (simstudioai#1240)

* fix(code-subblock): added validation to not parse non-variables as variables in the code subblock

* fix wand prompt bar styling

* fix error message for available connected blocks to only show connected available blocks, not block ID's

* ui
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