Skip to content

Conversation

GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Sep 25, 2025

Closes #18416

This limits the events emitted when ts is falsy, i.e. on initial event emission.

Summary by CodeRabbit

  • Bug Fixes

    • Prevents excessive event bursts on first run by capping initial emissions, improving stability.
    • More reliable detection of new deals across multiple stages with consistent sorting by last modified date.
  • Chores

    • Bumped component versions to the latest patch/minor releases.

Copy link

vercel bot commented Sep 25, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Sep 29, 2025 5:40am
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 29, 2025 5:40am

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Updates HubSpot component version and refactors the “New Deal in Stage” source to query all selected stages in one request using an IN filter, adds a cap on initial event emissions, adjusts pagination/control flow for first-run behavior, and bumps the source version.

Changes

Cohort / File(s) Summary
HubSpot source logic refactor
components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs
Added MAX_INITIAL_EVENTS cap; consolidated per-stage queries into a single IN-filter query via getAllStagesParams(after); updated filterGroups and sorting; revised first-run control flow and pagination; removed getStageParams; bumped version to 0.1.0.
Package version bump
components/hubspot/package.json
Version updated from 1.7.11 to 1.7.12; no other fields changed.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as User Setup
  participant Src as HubSpot Source
  participant HS as HubSpot API

  User->>Src: Create "New Deal in Stage" source
  Note over Src: First run (after = undefined)
  Src->>Src: getAllStagesParams(undefined)<br/>dealstage IN selected stages<br/>sort by hs_lastmodifieddate DESC
  Src->>HS: Search deals (IN filter)
  HS-->>Src: Results (paged)
  loop Process results
    Src->>Src: Emit up to MAX_INITIAL_EVENTS
    alt Cap reached
      Src-->>Src: Stop initial run early
    else Not reached
      Src->>HS: Next page (if any)
      HS-->>Src: More results
    end
  end

  Note over Src: Subsequent runs (after set)
  Src->>Src: getAllStagesParams(after)<br/>dealstage IN + hs_lastmodifieddate > after
  Src->>HS: Search deals (filtered by after)
  HS-->>Src: Results
  Src->>Src: Evaluate relevance and emit events
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • michelle0927
  • dannyroosevelt

Poem

A hop, a bump, a version bright,
Deals now gather in a single bite.
First-run carrots capped with care,
Stages chorus “IN” the snare.
I twitch my nose, emit with glee—
Next run’s crisp as celery. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository template because it lacks the required “## WHY” section and only contains a closing note and a brief summary instead of the rationale for the change. Please update the description to include the “## WHY” section and provide a detailed explanation of why limiting initial events is necessary, following the repository’s template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the main change by specifying the HubSpot “New Deal in Stage” trigger and highlighting the introduction of a limit on initial event emissions, clearly reflecting the pull request’s primary objective.
Linked Issues Check ✅ Passed The code changes directly address issue #18416 by emitting initial events when ts is falsy and capping them with MAX_INITIAL_EVENTS, and refactor the stage parameter logic to use getAllStagesParams(after), thereby resolving the bug and closing the linked issue.
Out of Scope Changes Check ✅ Passed All changes in the pull request, including the introduction of MAX_INITIAL_EVENTS, refactored stage parameter logic, and the version bump, are directly related to limiting initial events for the new-deal-in-stage trigger and do not introduce any unrelated or out-of-scope modifications.
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
  • Commit unit tests in branch hubspot-limit-initial-deal-events

📜 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 be68450 and 4fa5d8b.

📒 Files selected for processing (1)
  • components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (2)
components/hubspot/sources/common/common.mjs (2)
  • after (189-189)
  • params (190-190)
components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs (1)
  • params (87-102)
⏰ 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: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components

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
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 214e592 and dfb21bb.

📒 Files selected for processing (2)
  • components/hubspot/package.json (1 hunks)
  • components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (1)
components/hubspot/sources/common/common.mjs (2)
  • params (190-190)
  • after (189-189)
⏰ 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/hubspot/package.json (1)

3-3: Patch version bump LGTM

Incrementing to 1.7.11 matches the scoped change set and keeps semantic versioning intact.

michelle0927
michelle0927 previously approved these changes Sep 25, 2025
Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

[BUG] New HubSpot triggers not firing on set up (ex: new-deal-in-stage)
2 participants