Skip to content

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Nov 13, 2025

WHY

Fixes of this PR #18963

Summary by CodeRabbit

  • New Features

    • Added "New Purchase Created (Instant)" webhook source
    • Added "Purchase Canceled (Instant)" webhook source
    • Added "Purchase Updated (Instant)" webhook source
  • Chores

    • Deprecated "New Order Created (Instant)" source; use "New Purchase Created (Instant)" instead
    • Deprecated "Order Deleted (Instant)" source; use "Purchase Canceled (Instant)" instead
    • Deprecated "Order Updated (Instant)" source; use "Purchase Updated (Instant)" instead
    • Updated package version to 0.2.0

@vercel
Copy link

vercel bot commented Nov 13, 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 Nov 13, 2025 9:30pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 13, 2025 9:30pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

This PR refactors Xola webhook sources by introducing three new purchase-based sources (purchase created, canceled, and updated) with event handling methods and test event payloads, while deprecating three corresponding order-based sources. The package version is bumped to 0.2.0.

Changes

Cohort / File(s) Change Summary
Package Version Bump
components/xola/package.json
Version updated from 0.1.0 to 0.2.0
Deprecated Order Sources
components/xola/sources/new-order-created-instant/new-order-created-instant.mjs, components/xola/sources/order-deleted-instant/order-deleted-instant.mjs, components/xola/sources/order-updated-instant/order-updated-instant.mjs
Description field extended with deprecation notice and recommendation to use new purchase-based sources; version incremented from 0.0.1 to 0.0.2 for each
New Purchase Created Source
components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs, components/xola/sources/new-purchase-created-instant/test-event.mjs
Default export added with key, name, description, version, dedupe; methods extend common webhook logic with getEventName() returning "purchase.create" and generateMeta(body) extracting id and summary; new test event module exports synthetic purchase creation payload
New Purchase Canceled Source
components/xola/sources/purchase-canceled-instant/purchase-canceled-instant.mjs, components/xola/sources/purchase-canceled-instant/test-event.mjs
Default export added with similar structure as purchase-created; getEventName() returns "purchase.cancel", generateMeta() builds summary "Purchase Canceled {id}"; new test event module exports comprehensive canceled purchase payload with audit trail
New Purchase Updated Source
components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs, components/xola/sources/purchase-updated-instant/test-event.mjs
Default export added with same pattern; getEventName() returns "purchase.update", generateMeta() parses updatedAt timestamp and creates id; new test event module exports purchase update payload with audit delta tracking arrivalDate change

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • New source modules follow a consistent pattern (common webhook extension, getEventName, generateMeta methods), reducing cognitive load but requiring verification of event names and metadata extraction logic
  • Large test event payloads (particularly purchase-canceled-instant and purchase-updated-instant) contain deeply nested structures that should be spot-checked for data consistency and realism
  • Deprecation messaging across three files should be verified for accuracy and consistency
  • Verify that new source keys, names, and descriptions align with naming conventions and documentation

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is minimal and lacks required context. It only references a related PR without explaining the changes, rationale, or implementation details. Expand the description to explain why this deprecation is necessary, what the impact is, and how users should migrate from order.* to purchase.* sources.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: deprecating order.* sources and introducing purchase.* sources for the Xola integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch xola-purchase-events-by-anush

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d20d528 and 48a17b6.

📒 Files selected for processing (10)
  • components/xola/package.json (1 hunks)
  • components/xola/sources/new-order-created-instant/new-order-created-instant.mjs (1 hunks)
  • components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs (1 hunks)
  • components/xola/sources/new-purchase-created-instant/test-event.mjs (1 hunks)
  • components/xola/sources/order-deleted-instant/order-deleted-instant.mjs (1 hunks)
  • components/xola/sources/order-updated-instant/order-updated-instant.mjs (1 hunks)
  • components/xola/sources/purchase-canceled-instant/purchase-canceled-instant.mjs (1 hunks)
  • components/xola/sources/purchase-canceled-instant/test-event.mjs (1 hunks)
  • components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs (1 hunks)
  • components/xola/sources/purchase-updated-instant/test-event.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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/xola/sources/purchase-updated-instant/test-event.mjs
  • components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.

Applied to files:

  • components/xola/package.json
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs
  • components/xola/sources/purchase-canceled-instant/purchase-canceled-instant.mjs
  • components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs
🧬 Code graph analysis (3)
components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs (5)
components/xola/sources/new-order-created-instant/new-order-created-instant.mjs (1)
  • body (18-18)
components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs (1)
  • body (18-18)
components/xola/sources/order-deleted-instant/order-deleted-instant.mjs (2)
  • body (18-18)
  • ts (19-19)
components/xola/sources/order-updated-instant/order-updated-instant.mjs (2)
  • body (18-18)
  • ts (19-19)
components/xola/sources/purchase-canceled-instant/purchase-canceled-instant.mjs (1)
  • body (18-18)
components/xola/sources/purchase-canceled-instant/purchase-canceled-instant.mjs (5)
components/xola/sources/new-order-created-instant/new-order-created-instant.mjs (1)
  • body (18-18)
components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs (1)
  • body (18-18)
components/xola/sources/order-deleted-instant/order-deleted-instant.mjs (1)
  • body (18-18)
components/xola/sources/order-updated-instant/order-updated-instant.mjs (1)
  • body (18-18)
components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs (1)
  • body (18-18)
components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs (5)
components/xola/sources/new-order-created-instant/new-order-created-instant.mjs (1)
  • body (18-18)
components/xola/sources/order-deleted-instant/order-deleted-instant.mjs (1)
  • body (18-18)
components/xola/sources/order-updated-instant/order-updated-instant.mjs (1)
  • body (18-18)
components/xola/sources/purchase-canceled-instant/purchase-canceled-instant.mjs (1)
  • body (18-18)
components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs (1)
  • body (18-18)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (8)
components/xola/package.json (1)

3-3: Version bump is consistent with the Xola source changes

Moving to 0.2.0 for the package aligns with adding new purchase.* sources and deprecating order.* ones. No issues from this change.

components/xola/sources/order-updated-instant/order-updated-instant.mjs (1)

8-9: Deprecation messaging and version bump look good

Description clearly directs users to the new “Purchase Updated (Instant)” source, and the minor source version bump to 0.0.2 is appropriate for this metadata change.

components/xola/sources/new-order-created-instant/new-order-created-instant.mjs (1)

8-9: Clear deprecation notice and appropriate version increment

The description unambiguously deprecates this source and points to “New Purchase Created (Instant)”, and bumping to 0.0.2 matches the metadata-only change pattern.

components/xola/sources/order-deleted-instant/order-deleted-instant.mjs (1)

8-9: Deprecation text and source version are consistent

The updated description correctly routes users to “Purchase Canceled (Instant)”, and the version bump to 0.0.2 matches the deprecation-only change.

components/xola/sources/purchase-updated-instant/test-event.mjs (1)

1-542: LGTM! Comprehensive test fixture.

The test event provides a complete purchase object with nested line items, travelers, and audit information that accurately represents a purchase update scenario.

components/xola/sources/new-purchase-created-instant/test-event.mjs (1)

1-533: LGTM! Comprehensive test fixture.

The test event provides a complete purchase object suitable for testing purchase creation scenarios. The empty audit object (line 532) is appropriate since this is a creation event with no prior state.

components/xola/sources/new-purchase-created-instant/new-purchase-created-instant.mjs (1)

1-27: LGTM! Clean and consistent implementation.

The webhook source follows the established pattern and correctly implements purchase creation event handling.

components/xola/sources/purchase-updated-instant/purchase-updated-instant.mjs (1)

21-21: The review comment identifies a valid inconsistency, but resolution depends on business logic clarification.

The verification confirms the concern: Purchase Updated uses a compound ID (${data.id}-${ts}) while Purchase Canceled uses a simple ID (data.id). However, there's a broader pattern in the codebase to consider:

  • Create events: simple ID (Purchase Created, Experience Created, Order Created)
  • Update/Delete events: compound ID (Purchase Updated, Experience Updated/Deleted, Order Updated/Deleted)
  • Cancel event: simple ID (inconsistent with update/delete pattern)

Additionally, Purchase Updated uses Date.parse(data.updatedAt) (stable across webhook retries), while Experience/Order Deletions use Date.now() (creates new IDs on retries). This affects deduplication behavior.

The question hinges on: Can a purchase be canceled multiple times? If cancellations can be retried/repeated, a compound ID is warranted for uniqueness. If a purchase can only be canceled once, the simple ID is appropriate but should align with the chosen pattern across all entity types.

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!

@michelle0927 michelle0927 moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog Nov 13, 2025
@vunguyenhung
Copy link
Collaborator

@vunguyenhung vunguyenhung moved this from Ready for QA to Changes Required in Component (Source and Action) Backlog Nov 14, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check test reports below for more information:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants