Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 4, 2025

The editContactInfo and editDeviceMobileIds functions in the first-party-dv360 destination were not properly handling batch requests, causing data loss for all but the first payload in each batch.

Problem

When batching was enabled, the functions only processed the first payload in the array:

// Before: Only processed first payload
const payload = payloads[0]
const contactInfoList = {
  contactInfos: [processPayload(payload)], // Only one contact info
  // ...
}

This meant that in a batch of 10 events, only the first event would be sent to DV360, and the remaining 9 events would be silently dropped.

Solution

Updated both functions to process all payloads in the batch:

// After: Process all payloads
const contactInfos = payloads.map(payload => processPayload(payload))
const contactInfoList = {
  contactInfos: contactInfos, // Multiple contact infos
  // ...
}

Changes Made

  • editContactInfo: Now processes all payloads in the batch
  • editDeviceMobileIds: Now processes all payloads in the batch
  • Simplified logic: Removed unnecessary payload filtering since the actions framework already validates payloads before calling these functions
  • Backward compatibility: Single payload processing (non-batch mode) continues to work exactly as before

Test Coverage

Added comprehensive batch tests covering:

  • Multiple payloads in a single batch request
  • Single payload batches
  • Verification of correct API request structure with multiple entries

The fix ensures that when customers enable batching for DV360 audience management, all events in the batch are properly processed instead of losing data.

Fixes #3231.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Fix batching for editCustomerMatchMembers action in first party DV360 Fix batching for editCustomerMatchMembers action in first party DV360 Sep 4, 2025
@Copilot Copilot AI requested a review from abhandage September 4, 2025 06:55
Copilot finished work on behalf of abhandage September 4, 2025 06:55
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.86%. Comparing base (0ab8828) to head (3b44b63).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ns/src/destinations/first-party-dv360/functions.ts 64.70% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (64.70%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3232      +/-   ##
==========================================
+ Coverage   79.84%   79.86%   +0.01%     
==========================================
  Files        1184     1184              
  Lines       21808    21818      +10     
  Branches     4248     4250       +2     
==========================================
+ Hits        17413    17424      +11     
  Misses       3646     3646              
+ Partials      749      748       -1     

☔ 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.

Comment on lines 90 to 91
// Filter out payloads that don't have mobile device ids
const validPayloads = payloads.filter(payload => payload.mobileDeviceIds !== undefined)
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot this is not required, you can assume that the payloads are already filtered

Copy link
Author

Choose a reason for hiding this comment

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

You're absolutely right. I've removed the unnecessary filtering from both editDeviceMobileIds and editContactInfo functions since the actions framework already validates payloads before calling these functions. The code is now cleaner and more efficient. Changes committed in 7425747.

Comment on lines 152 to 158
// Filter out payloads that don't have any required identifiers
const validPayloads = payloads.filter(payload =>
payload.emails !== undefined ||
payload.phoneNumbers !== undefined ||
payload.firstName !== undefined ||
payload.lastName !== undefined
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot this is not required, you can assume that all payloads are valid

Copy link
Author

Choose a reason for hiding this comment

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

You're absolutely right. I've already removed the unnecessary payload filtering logic in commit 7425747. The functions now process all payloads without validation since the actions framework already ensures payload validity.

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.

Fix batching for editCustomerMatchMembers action in first party DV360
3 participants