Skip to content

refactor(triggers): consolidate v2 Linear triggers into same files as v1#4010

Merged
waleedlatif1 merged 11 commits intostagingfrom
waleedlatif1/add-linear-trigger-v2
Apr 7, 2026
Merged

refactor(triggers): consolidate v2 Linear triggers into same files as v1#4010
waleedlatif1 merged 11 commits intostagingfrom
waleedlatif1/add-linear-trigger-v2

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Move v2 trigger exports from separate _v2.ts files into their corresponding v1 trigger files
  • Follows the same convention as block v2 (e.g., LinearV2Block lives alongside LinearBlock in linear.ts)
  • Delete 15 standalone _v2.ts files, update barrel exports in index.ts
  • No functional changes — same trigger IDs, registry entries, provider handler, and block config

Type of Change

  • Refactor (no functional changes)

Testing

Tested manually — type-check and lint pass clean

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)

Move v2 trigger exports from separate _v2.ts files into their
corresponding v1 files, matching the block v2 convention where
LinearV2Block lives alongside LinearBlock in the same file.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 7, 2026 5:09am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 7, 2026

PR Summary

Medium Risk
Medium risk because it changes webhook idempotency key derivation (new headers and provider-body identifiers) and alters chat input behavior when pressing Enter during streaming, which could affect duplicate webhook processing and message sending UX.

Overview
Adds/updates trigger metadata and refactors Linear triggers. Gmail and Outlook integrations now advertise a polling email trigger, and the Linear webhook trigger description is clarified.

Consolidates Linear v2 trigger definitions by moving v2 TriggerConfig exports into the corresponding v1 trigger files, deleting the standalone *_v2.ts files, and updating the Linear triggers barrel exports; scripts/generate-docs.ts is updated to parse multiple exported TriggerConfigs per file.

Improves webhook deduplication support by adding extractIdempotencyId implementations for Ashby/Gong/Telegram, broadening createWebhookIdempotencyKey to recognize additional idempotency headers, and removing Zoom’s body-based idempotency extraction.

Simplifies chat queued-message sending so pressing Enter with an empty input while sending immediately dispatches the top queued message (removing the prior “prime then confirm” behavior and related onPrimedDismiss wiring).

Reviewed by Cursor Bugbot for commit ca3c7d0. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 7, 2026

Greptile Summary

This PR consolidates 15 separate _v2.ts Linear trigger files into their corresponding v1 files, following the same convention used for block definitions (e.g. LinearV2Block alongside LinearBlock in linear.ts). Each trigger file now exports both the v1 and v2 TriggerConfig objects, and triggers/linear/index.ts re-exports both named exports per file.

scripts/generate-docs.ts was updated so buildTriggerRegistry handles files with multiple TriggerConfig exports by splitting on export-declaration boundaries (exportStarts), ensuring documentation generation still correctly enumerates all trigger IDs after consolidation.

The PR also includes changes to apps/sim/lib/core/idempotency/service.ts and several webhook providers (ashby.ts, gong.ts, telegram.ts) which are not mentioned in the PR description's "No functional changes" claim. The IdempotencyService class in service.ts uses any in four places — IdempotencyResult.previousResult, ProcessingResult.result, normalizeKey's additionalContext parameter, and createWebhookIdempotencyKey's body parameter — all of which should be unknown per the project's TypeScript rules.

Key changes:

  • 15 _v2.ts trigger files deleted; v2 exports now live alongside v1 in each event file
  • index.ts barrel updated to re-export both v1 and v2 from each consolidated file
  • generate-docs.ts buildTriggerRegistry updated with multi-export file support
  • IdempotencyService in service.ts has four any-type violations that should be unknown

Confidence Score: 5/5

Safe to merge — the trigger consolidation is a clean structural refactor with no functional changes; all identified issues are minor style violations

All four findings are P2 style issues (any vs unknown types) in the idempotency service. The core trigger consolidation is correct: named exports match, the barrel is complete, and generate-docs handles multi-export files properly via the exportStarts slicing approach. No functional regressions are expected from the refactor itself.

apps/sim/lib/core/idempotency/service.ts — four any-type violations in IdempotencyResult, ProcessingResult, normalizeKey, and createWebhookIdempotencyKey that should use unknown

Important Files Changed

Filename Overview
apps/sim/triggers/linear/index.ts Barrel correctly re-exports both v1 and v2 named exports from consolidated source files for all 15 event types — no gaps
apps/sim/triggers/linear/issue_created.ts Clean consolidation — v1 and v2 TriggerConfig exports co-located; v2 uses buildLinearV2SubBlocks with includeDropdown:true as the anchor trigger
apps/sim/triggers/linear/webhook.ts linearWebhookTrigger and linearWebhookV2Trigger correctly co-located; minor pre-existing inconsistency in example header values between v1 and v2
apps/sim/triggers/linear/comment_created.ts v1 and v2 comment_created triggers cleanly consolidated; shared buildCommentOutputs() reused correctly
scripts/generate-docs.ts buildTriggerRegistry updated to handle files with multiple TriggerConfig exports via exportStarts boundary slicing — correctly supports the consolidation
apps/sim/lib/core/idempotency/service.ts IdempotencyService has four any-type violations across interface fields and method signatures; all should use unknown per project TypeScript rules

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["trigger file\ne.g. issue_created.ts"] -->|exports| B["linearIssueCreatedTrigger\nv1.0.0"]
    A -->|exports| C["linearIssueCreatedV2Trigger\nv2.0.0"]
    D["index.ts barrel"] -->|re-exports both| A
    E["triggers/registry.ts"] -->|registers all| D
    F["generate-docs.ts\nbuildTriggerRegistry"] -->|scans trigger .ts files| G{"multiple TriggerConfig\nexports in file?"}
    G -->|yes - split on exportStarts| H["parse each segment\nindependently"]
    G -->|no - single export| I["parse whole file"]
    H --> J["TriggerInfo registry map"]
    I --> J
    J --> K["integrations.json"]
Loading

Reviews (2): Last reviewed commit: "idempotency" | Re-trigger Greptile

The buildTriggerRegistry function used a single regex exec per file,
which only captured the first TriggerConfig export. Files that export
both v1 and v2 triggers (consolidated same-file convention) had their
v2 triggers silently dropped from integrations.json.

Split each file into segments per export and parse each independently.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
waleedlatif1 and others added 2 commits April 6, 2026 21:29
Restores the staging version of linear provider handler and trigger
utils that were accidentally regressed. Key restorations:
- teamId sub-block and allPublicTeams fallback in createSubscription
- Timestamp skew validation in verifyAuth
- actorType renaming in formatInput (avoids TriggerOutput collision)
- url field in formatInput and all output builders
- edited field in comment outputs
- externalId validation after webhook creation
- isLinearEventMatch returns false (not true) for unknown triggers

Adds extractIdempotencyId to the linear provider handler for webhook
deduplication support.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The idempotency service already uses the Linear-Delivery header
(which Linear always sends) as the primary dedup key. The body-based
fallback was unnecessary defensive code.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ca3c7d0. Configure here.

@waleedlatif1 waleedlatif1 merged commit 68df732 into staging Apr 7, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/add-linear-trigger-v2 branch April 7, 2026 05:13
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