STRATCONN-6127 - [Pendo Audiences] - handle 409 as 429 retries#3845
Open
joe-ayoub-segment wants to merge 1 commit into
Open
STRATCONN-6127 - [Pendo Audiences] - handle 409 as 429 retries#3845joe-ayoub-segment wants to merge 1 commit into
joe-ayoub-segment wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Pendo Audiences syncAudience action to better handle Pendo’s transient write conflicts by retrying on HTTP 409s (via a RetryableError surfaced as 429), and refactors membership resolution to use the core-provided audienceMembership signal instead of deriving it from traits/properties.
Changes:
- Treats HTTP 409 responses from Pendo’s segment PATCH as retryable by throwing
RetryableError(..., 429). - Switches add/remove decisioning to use
audienceMembership(and removes the internal-only mapping fields previously used to infer membership). - Reworks/expands unit tests for single-event and batched Engage flows, including 409 retry behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/index.ts | Wires audienceMembership into send() for single and batch execution. |
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/generated-types.ts | Removes now-unneeded payload fields used for membership inference. |
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/functions.ts | Implements 409→retry behavior and uses audienceMemberships to decide add/remove operations. |
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/fields.ts | Removes internal/hidden fields previously required to infer membership. |
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/tests/perform.test.ts | Deletes older tests superseded by newer Engage single/batch coverage. |
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/tests/engage-single.test.ts | Adds single-event tests including invalid membership and 409 retry. |
| packages/destination-actions/src/destinations/pendo-audiences/syncAudience/tests/engage-batch.test.ts | Updates/extends batch tests, including track membership resolution and 409 retry. |
| packages/destination-actions/src/destinations/pendo-audiences/metadata.json | Removed in this PR (should be regenerated/committed rather than deleted). |
Comment on lines
119
to
124
| if (isSuccess) { | ||
| msResponse.setSuccessResponseAtIndex(index, { | ||
| status: item.status, | ||
| body: p as unknown as JSONLikeObject, | ||
| sent: buildSent(item.operation, visitorId) | ||
| sent: p as unknown as JSONLikeObject, | ||
| body: buildPendoRequest(item.operation, [visitorId]) | ||
| }) |
Comment on lines
10
to
15
| '@path': '$.userId' | ||
| } | ||
| }, | ||
| traitsOrProperties: { | ||
| label: 'Traits or Properties', | ||
| description: 'Traits or Properties object from the identify() or track() call emitted by Engage.', | ||
| type: 'object', | ||
| required: true, | ||
| unsafe_hidden: true, | ||
| default: { | ||
| '@if': { | ||
| exists: { '@path': '$.traits' }, | ||
| then: { '@path': '$.traits' }, | ||
| else: { '@path': '$.properties' } | ||
| } | ||
| } | ||
| }, | ||
| segmentAudienceKey: { | ||
| label: 'Segment Audience Key', | ||
| description: 'Segment Audience Key. Used to determine whether the user is being added to or removed from the Pendo Segment.', | ||
| type: 'string', | ||
| required: true, | ||
| unsafe_hidden: true, | ||
| default: { | ||
| '@path': '$.context.personas.computation_key' | ||
| } | ||
| }, | ||
| segmentAudienceId: { | ||
| label: 'Segment External Audience ID', | ||
| description: 'The External Audience ID from Segment, which maps to the Pendo Segment ID.', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pendo's segment-visitor PATCH endpoint returns 409 "Operation in progress" when a write to a segment is already underway — a transient condition. Previously the destination surfaced this as a hard failure, so events were dropped instead of retried.
This PR maps a Pendo 409 to a RetryableError (429), so Segment's pipeline retries the request later (with backoff) once Pendo is no longer busy. The whole request is retried rather than failing individual items, since the single PATCH covering all visitors is what Pendo rejected.
Also in this change:
Testing
Unit tests updated.
e2e tests created which test the following:
These e2e tests are not yet in main as there core e2e code is not merged yet. The e2e tests are currently in this PR - #3829 - as well as a mirror copy of the pendo-audiences destination in this branch.
Stage testing required.
Security Review
Please ensure sensitive data is properly protected in your integration.
type: 'password'New Destination Checklist
verioning-info.tsfile. example