Skip to content

fix(variables, webhook): fix variable tag dropdown for escaped < and allow empty webhook payload - #1851

Merged
Sg312 merged 3 commits into
stagingfrom
fix/variable-tag-highlighting
Nov 8, 2025
Merged

fix(variables, webhook): fix variable tag dropdown for escaped < and allow empty webhook payload#1851
Sg312 merged 3 commits into
stagingfrom
fix/variable-tag-highlighting

Conversation

@Sg312

@Sg312Sg312 commented Nov 8, 2025

Copy link
Copy Markdown
Collaborator

Summary

Fix variable tag dropdown for escaped < and allow empty webhook payload

Type of Change

  • Bug fix

Testing

Manual

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)

@vercel

vercelBot commented Nov 8, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 8, 2025 1:58am

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 use lastIndexOf() 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 OAuthService import

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 splitReferenceSegment function 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

FilenameScoreOverview
apps/sim/lib/workflows/references.ts5/5Added splitReferenceSegment function to properly handle escaped < characters in variable references and updated isLikelyReferenceSegment to use it
apps/sim/lib/webhooks/processor.ts5/5Changed to allow empty webhook payloads by returning empty objects instead of 400 errors
apps/sim/components/ui/tag-dropdown.tsx5/5Extracted getTagSearchTerm and updated search logic to use lastIndexOf for proper handling of escaped < characters
apps/sim/components/ui/formatted-text.tsx5/5Updated 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
Loading

9 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Sg312
Sg312 merged commit f62568e into stagingNov 8, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/variable-tag-highlighting branch November 8, 2025 23:27
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
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto 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

@Sg312