Skip to content

Conversation

@GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Sep 24, 2025

Closes #18416

Follow-up to #18438

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of the “New Deal in Stage” source on first run by refining relevance checks, reducing the chance of missed or extra events.
    • Limited initial execution to the first page of results to avoid lengthy syncs and potential timeouts, improving setup experience.
  • Chores

    • Bumped component and source versions for release.

@vercel
Copy link

vercel bot commented Sep 24, 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 24, 2025 8:10pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 24, 2025 8:10pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Walkthrough

Bumps HubSpot component version to 1.7.10 and updates the new-deal-in-stage source to version 0.0.41, adjusting relevance checks to handle undefined initial timestamps and adding an early return to limit processing to the first page on initial runs.

Changes

Cohort / File(s) Summary
HubSpot package metadata
components/hubspot/package.json
Bump package version from 1.7.9 to 1.7.10.
New deal in stage source logic
components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs
Source version bump to 0.0.41; relax relevance check to handle undefined after using `(!after

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as Source (new-deal-in-stage v0.0.41)
    participant HS as HubSpot API

    Note over U: Initial run: after = undefined
    U->>HS: List deals in stage (page 1)
    HS-->>U: Deals page 1

    rect rgba(200,230,255,0.3)
    note right of U: Relevance check updated
    U->>U: For each deal: if (!after || isRelevant(ts, after)) emit
    end

    alt Initial run
      Note over U: Early return after page 1 (no pagination)
      U-->>U: Stop pagination
    else Subsequent runs
      loop Additional pages
        U->>HS: Fetch next page
        HS-->>U: Deals page N
        U->>U: Apply same relevance check
      end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nudge my nose at version’s glow,
A hop from nine to ten we go.
First-run winds no longer stall,
Deals now ping and swiftly call.
One page peek, then off I dash—
Triggers spring with bunny flash! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description does not follow the repository’s template because the required “## WHY” section is missing and no context is provided beyond issue references, leaving the rationale and summary of changes incomplete. Please complete the template by adding a “## WHY” section explaining the motivation for the change and summarizing how it addresses the linked issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly identifies the affected component (“new deal in stage”), highlights the platform (HubSpot), and clearly states the purpose of the change (fixing initial event emission), accurately reflecting the core update in the changeset.
Linked Issues Check ✅ Passed The updated logic in new-deal-in-stage now treats an undefined after timestamp as relevant and emits an initial event as intended, directly addressing the bug described in issue #18416.
Out of Scope Changes Check ✅ Passed All modifications are confined to version bumps and the targeted fix for initial event emission in the new-deal-in-stage trigger, with no unrelated or extraneous changes introduced.
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-new-deal-in-stage-fix

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
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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (2)

38-45: Potential crash: missing optional chaining on versions.

properties.dealstage?.versions[0] can throw if versions is undefined or empty. Use optional chaining on versions and the element access.

Apply this diff:

-      return properties.dealstage?.versions[0].timestamp;
+      return properties.dealstage?.versions?.[0]?.timestamp;

101-121: components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs: defer _setAfter until after loop and guard nullish ts

  • Change
    if (!after || this.isRelevant(ts, after))
    to
    if (!after || (ts != null && this.isRelevant(ts, after)))
  • Remove the inline this._setAfter(ts) in the loop and instead, after the for (but before if (!after) return;), add:
    const prev = this._getAfter() ?? 0;
    if (maxTs > prev) this._setAfter(maxTs);

This ensures after only ever increases and skips nullish timestamps.

🧹 Nitpick comments (1)
components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (1)

103-115: Optional: prevent emitting events with undefined/NaN timestamps.

On first run, !after makes the condition true even if ts is undefined, which can produce events with an undefined ts. If that’s undesirable, add a guard/coercion.

-        if (!after || this.isRelevant(ts, after)) {
+        const tsNum = (ts == null ? undefined : Number(ts));
+        if (!after || (Number.isFinite(tsNum) && this.isRelevant(tsNum, after))) {
           ...
-          this.emitEvent(deal, ts);
+          this.emitEvent(deal, tsNum);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5914a1b and 2735156.

📒 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 (1)
  • 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: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (2)
components/hubspot/package.json (1)

3-3: Version bump looks good.

No functional changes here. Please ensure a corresponding CHANGELOG entry and publish step.

components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs (1)

14-14: Source version bump OK.

Matches package bump; ready for release.

@GTFalcao GTFalcao merged commit b52da0e into master Sep 24, 2025
10 checks passed
@GTFalcao GTFalcao deleted the hubspot-new-deal-in-stage-fix branch September 24, 2025 22:29
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)

3 participants