Skip to content

Conversation

harsh-joshi99
Copy link
Contributor

@harsh-joshi99 harsh-joshi99 commented Oct 6, 2025

This update prevents duplicate associations from being included in a single batch request. The HubSpot API does not allow multiple references to the same association within the same batch, which was previously causing errors.

A new helper function has been added to de-duplicate associations before sending the payload to HubSpot.

There are some unrelated Prettier changes.

JIRA -> https://twilio-engineering.atlassian.net/browse/STRATCONN-6106

Testing

Testing Doc.

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.98%. Comparing base (41a9de1) to head (2fbe70d).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
...pot/upsertObject/functions/validation-functions.ts 84.21% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3336      +/-   ##
==========================================
- Coverage   80.32%   79.98%   -0.34%     
==========================================
  Files        1257     1204      -53     
  Lines       25159    22323    -2836     
  Branches     5217     4416     -801     
==========================================
- Hits        20208    17855    -2353     
+ Misses       4163     3685     -478     
+ Partials      788      783       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@harsh-joshi99 harsh-joshi99 changed the title Add de duplication for assosiations [Hubspot] Add de duplication for assosiations Oct 6, 2025
@harsh-joshi99 harsh-joshi99 marked this pull request as ready for review October 7, 2025 06:03
@harsh-joshi99 harsh-joshi99 requested a review from a team as a code owner October 7, 2025 06:03
@harsh-joshi99 harsh-joshi99 requested a review from Copilot October 9, 2025 08:41
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds deduplication functionality for HubSpot associations to prevent API errors when the same association appears multiple times in a single batch request. The HubSpot API rejects batches containing duplicate association references, so this change filters out duplicates before sending payloads.

Key changes:

  • Added a new deDuplicateAssociations helper function that removes duplicate associations based on a composite key
  • Integrated the deduplication logic into the main send function in the upsertObject action
  • Added comprehensive unit tests for the new deduplication functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/destination-actions/src/destinations/hubspot/upsertObject/index.ts Imports and applies the new deduplication function to association payloads before sending to HubSpot
packages/destination-actions/src/destinations/hubspot/upsertObject/functions/validation-functions.ts Implements the deDuplicateAssociations function and includes some formatting changes from Prettier
packages/destination-actions/src/destinations/hubspot/upsertObject/__tests__/validate.test.ts Adds comprehensive test coverage for the new deduplication functionality

@abhandage
Copy link
Contributor

LGTM, please address co-pilot comments

@joe-ayoub-segment
Copy link
Contributor

Hi @harsh-joshi99 - do you have any proof of testing you can attach?

@joe-ayoub-segment joe-ayoub-segment merged commit cd44f9e into main Oct 14, 2025
14 checks passed
@joe-ayoub-segment joe-ayoub-segment deleted the STRATCONN-6106 branch October 14, 2025 12:09
@joe-ayoub-segment
Copy link
Contributor

PR deployed - however Integrations Worker not yet deployed due to deployment issue.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants