Skip to content

Conversation

choeqq
Copy link
Contributor

@choeqq choeqq commented Sep 27, 2025

WHY

#18484

Summary by CodeRabbit

  • New Features

    • Added an option to skip existing records on first activation for the “Record Updated” trigger, preventing historical events from being emitted on initial setup.
    • Improved first-run behavior for polling-based triggers to honor the skip setting and avoid initial backfill.
  • Chores

    • Bumped the Salesforce REST API component and multiple triggers to patch versions, including Case Updated, Email Template Updated, Knowledge Article Updated, New Case, New Email Template, New Knowledge Article, New Record, Record Deleted, Record Updated, and New Outbound Message.

Copy link
Contributor

coderabbitai bot commented Sep 27, 2025

Walkthrough

Version increments across Salesforce REST API package and multiple sources. Introduces skip-first-run behavior: guards initial historical emissions in common-updated-record deploy hook and early-exit logic for timer-driven runs in common.mjs. Adds a new boolean prop skipFirstRun to record-updated-instant. No other functional changes.

Changes

Cohort / File(s) Summary of Changes
Package version bump
components/salesforce_rest_api/package.json
Version: 1.9.0 → 1.9.1.
Source metadata version bumps
components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs, .../email-template-updated-instant/email-template-updated-instant.mjs, .../knowledge-article-updated-instant/knowledge-article-updated-instant.mjs, .../new-case-instant/new-case-instant.mjs, .../new-email-template-instant/new-email-template-instant.mjs, .../new-knowledge-article-instant/new-knowledge-article-instant.mjs, .../new-outbound-message/new-outbound-message.mjs, .../new-record-instant/new-record-instant.mjs, .../record-deleted-instant/record-deleted-instant.mjs
Version fields bumped only (no logic changes).
Initial-run guard in deploy hook
components/salesforce_rest_api/sources/common/common-updated-record.mjs
Wraps historical event emission in deploy with if (!this.skipFirstRun), preventing initial backfill when enabled.
Timer initial-run guard
components/salesforce_rest_api/sources/common/common.mjs
In run(event): when timer-triggered and no webhook, if skipFirstRun is true and no prior timestamp, set latest timestamp to now and exit early.
New prop to control first run
components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs
Version bump; adds props.skipFirstRun (boolean, optional, default false) to allow ignoring existing records on activation.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as User
  participant Src as Source (record-updated-instant)
  participant Common as Common Logic
  participant SF as Salesforce API
  participant Store as State Storage
  participant Timer as Timer
  participant Hook as Webhook

  User->>Src: Activate with skipFirstRun=[true|false]
  alt Webhook-enabled
    Note over Src,Hook: Webhook path unchanged
    Hook-->>Src: Update event
    Src->>Common: process update
    Common->>SF: Fetch details
    SF-->>Common: Data
    Common->>Store: Update cursor/metadata
    Common-->>Src: Emit event
  else Timer-based polling
    Timer-->>Src: Tick
    Src->>Common: run(event=timer)
    alt First run AND skipFirstRun=true
      Common->>Store: Initialize latest timestamp = now
      Common-->>Src: Exit (no emit)
    else Subsequent runs or skipFirstRun=false
      Common->>Store: Read last timestamp
      Common->>SF: Query updates since cursor
      SF-->>Common: Records
      Common->>Store: Update cursor
      Common-->>Src: Emit events
    end
  end
Loading
sequenceDiagram
  autonumber
  participant Src as Source (updated-record variants)
  participant Deploy as deploy()
  participant SF as Salesforce API
  participant Store as State Storage

  Deploy->>Src: On activation
  alt skipFirstRun=true
    Note over Src: Historical backfill skipped
    Deploy-->>Src: Complete without emits
  else skipFirstRun=false
    Src->>SF: List recent items
    SF-->>Src: Recent items
    loop last 25 items
      Src->>Store: Generate metadata
      Src-->>Deploy: Emit historical event
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my whiskers at versioned delight,
Skipping first runs in the soft moonlight.
No backlog burrows, no history to chase—
Timers tiptoe, leaving nary a trace.
With clean little hops through Salesforce fields,
I nibble new changes and harvest neat yields. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The pull request title “Issue 18484” merely references the issue number without describing the substantive changes or main intent of the PR. A reviewer scanning history won’t know what was changed or why without clicking through, so it does not clearly summarize the main change. Please update the title to briefly describe the core change being made (for example, “salesforce_rest_api: add skipFirstRun option and bump component versions”) so it conveys the primary intent without needing to reference the issue.
Description Check ⚠️ Warning The pull request description only includes a “WHY” section linking to the issue but lacks any description of the actual changes made or why they are necessary. It does not follow the repository’s description template beyond a placeholder link and fails to inform reviewers of the scope and intent of the changes. Please expand the PR description to include a summary of the changes (such as version bumps and the new skipFirstRun feature), an explanation of why these changes are needed, and any relevant context or implementation details as outlined in the repository template.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 885e22a and f64f8d3.

📒 Files selected for processing (13)
  • components/salesforce_rest_api/package.json (1 hunks)
  • components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/common/common-updated-record.mjs (1 hunks)
  • components/salesforce_rest_api/sources/common/common.mjs (1 hunks)
  • components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.

Applied to files:

  • components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.

Applied to files:

  • components/salesforce_rest_api/sources/common/common-updated-record.mjs
📚 Learning: 2024-07-24T02:05:59.531Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common.mjs:97-98
Timestamp: 2024-07-24T02:05:59.531Z
Learning: The `processTimerEvent` method in the `components/salesforce_rest_api/sources/common.mjs` file is intentionally left unimplemented to enforce that subclasses must implement this method, similar to an abstract class in object-oriented programming.

Applied to files:

  • components/salesforce_rest_api/sources/common/common.mjs
🧬 Code graph analysis (2)
components/salesforce_rest_api/sources/common/common-updated-record.mjs (2)
components/salesforce_rest_api/sources/common/common-new-record.mjs (7)
  • objectType (10-10)
  • objectType (15-15)
  • objectType (32-32)
  • ids (16-16)
  • object (18-18)
  • event (19-24)
  • meta (138-138)
components/salesforce_rest_api/sources/common/common-webhook-methods.mjs (2)
  • event (40-40)
  • meta (41-41)
components/salesforce_rest_api/sources/common/common.mjs (1)
components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs (1)
  • startTimestamp (53-60)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (1)
components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs (1)

10-10: Version bump matches shared common behavior update.

The component is picking up the shared skip-first-run improvements via common, so the patch version bump looks correct. Thanks for keeping these sources in sync.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

vercel bot commented Sep 27, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 29, 2025 7:29am

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Sep 27, 2025
@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @choeqq , this looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
Development

Successfully merging this pull request may close these issues.

4 participants