fix(variables, webhook): fix variable tag dropdown for escaped < and allow empty webhook payload#1851
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR fixes two distinct bugs: variable tag dropdown incorrectly handling escaped < characters (like in comparisons < <block.output>), and webhook processor rejecting valid empty payloads.
Key Changes:
- Introduced
splitReferenceSegment()function to properly parse variable references when preceded by comparator operators (<,<=, etc.) - Updated
getTagSearchTerm()to uselastIndexOf()to find the most recent unclosed<bracket - Modified webhook processor to accept empty request bodies and empty JSON objects, returning
{body: {}, rawBody: ''}instead of 400 errors - Applied the new reference parsing logic consistently across tag dropdown, formatted text display, and code/condition input components
- Added comprehensive test coverage for the new parsing logic
- Removed unused
OAuthServiceimport
The changes are well-structured with proper separation of concerns. The new splitReferenceSegment utility is reusable and tested. The webhook change aligns with common webhook patterns where empty payloads are valid.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are well-tested, focused, and address specific bugs without introducing complexity. The new
splitReferenceSegmentfunction has proper test coverage and is applied consistently. The webhook change is a simple, logical fix that improves compatibility. No breaking changes or security concerns identified. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/workflows/references.ts | 5/5 | Added splitReferenceSegment function to properly handle escaped < characters in variable references and updated isLikelyReferenceSegment to use it |
| apps/sim/lib/webhooks/processor.ts | 5/5 | Changed to allow empty webhook payloads by returning empty objects instead of 400 errors |
| apps/sim/components/ui/tag-dropdown.tsx | 5/5 | Extracted getTagSearchTerm and updated search logic to use lastIndexOf for proper handling of escaped < characters |
| apps/sim/components/ui/formatted-text.tsx | 5/5 | Updated to use splitReferenceSegment for proper handling of escaped < in display text highlighting |
Sequence Diagram
sequenceDiagram
participant User
participant UI as Tag Dropdown/Input
participant Split as splitReferenceSegment
participant Filter as Tag Filter Logic
participant Display as Formatted Text
Note over User,Display: Scenario 1: Variable Tag Dropdown
User->>UI: Types "< <block.output>"
UI->>Split: getTagSearchTerm("< <block.output>", 18)
Split->>Split: lastIndexOf('<') finds last <
Split->>Split: Check if > after last <
Split-->>UI: Returns "" (empty search)
UI->>UI: Shows all tags
Note over User,Display: Scenario 2: Reference Highlighting
User->>Display: Displays text with "< <block.output>"
Display->>Split: splitReferenceSegment("< <block.output>")
Split->>Split: Finds last < at position 2
Split->>Split: Extracts leading="< ", reference="<block.output>"
Split-->>Display: {leading: "< ", reference: "<block.output>"}
Display->>Display: Render "< " as plain, "<block.output>" as blue
Note over User,Display: Scenario 3: Webhook Empty Payload
participant Webhook as Webhook Processor
participant Parser as parseWebhookBody
User->>Webhook: POST /webhook (empty body)
Webhook->>Parser: parseWebhookBody(request)
Parser->>Parser: Read body text
Parser->>Parser: Check if empty
Parser-->>Webhook: {body: {}, rawBody: ''}
Webhook->>Webhook: Continue processing with empty object
9 files reviewed, no comments
waleedlatif1
pushed a commit
that referenced
this pull request
Nov 9, 2025
…allow empty webhook payload (#1851) * Fix << tags * Allow empty webhook body * Variable highlighting in loop conditions
waleedlatif1
pushed a commit
that referenced
this pull request
Nov 12, 2025
…allow empty webhook payload (#1851) * Fix << tags * Allow empty webhook body * Variable highlighting in loop conditions
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.
Summary
Fix variable tag dropdown for escaped < and allow empty webhook payload
Type of Change
Testing
Manual
Checklist