Repository navigation
test(intercom): add live integration test suite - #5732
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
🟡 Changes recommended
The group scenario replays suppressed writes, and its retry strategy cannot recover a successful company-only result after a contact-search miss.
2 open issues
What changed in this PR
Adds live Intercom API v2 coverage, including the rETL external_id regression addressed by #5730, and updates the shared live harness to route CDK v2 destinations correctly.
Changes:
- Adds six scenarios covering identify create/update, rETL identifiers, track, and company association.
- Adds Intercom setup, read-back, and cleanup helpers.
- Includes
DestinationDefinition.Namein router requests, with matching types and unit coverage.
| File | Description |
|---|---|
test/integrations/live/types.ts |
Requires destination definition metadata in router inputs. |
test/integrations/live/runPipelineStep.test.ts |
Checks the destination name in generated requests. |
test/integrations/live/routerTransformRequest.ts |
Supplies the uppercase destination name for routing. |
test/integrations/destinations/intercom/live/spec.ts |
Defines six live scenarios and verification checks. |
test/integrations/destinations/intercom/live/api.ts |
Provides Intercom API helpers and resource cleanup. |
test/integrations/destinations/intercom/live.ts |
Exposes the suite for registry discovery. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5732 +/- ##
========================================
Coverage 92.42% 92.42%
========================================
Files 741 741
Lines 41048 41048
Branches 9636 9553 -83
========================================
Hits 37938 37938
- Misses 2848 2926 +78
+ Partials 262 184 -78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
823d872 to
303c735
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The live harness incorrectly proxies suppressed group outputs, duplicating attachments and masking transform regressions, while missed contact lookups can leave companies permanently unattached without triggering retries.
2 open issues
Review effort: Balanced
Enroll Intercom (API v2) in the live integration suite with six scenarios: identify create, identify update, rETL identify mapped by user_id, rETL identify mapped by external_id without email (INT-7442), track, and group. Create/update/rETL/group scenarios read the contact or company back from Intercom, and every scenario deletes what it created. Also fix the live harness for CDK v2 destinations: the router transform body now sends destination.DestinationDefinition.Name, which the service selector uses to route to CDK v2. Without it, CDK v2 destinations fell back to the native path and failed with "Cannot find module .../transform". Co-Authored-By: Claude Opus 5.5 <[email protected]>
Make Intercom processor test descriptions match what each case covers: - describe the rETL identify/track cases by identifier and email presence instead of "Identify rEtl test" / "Track rEtl test" - label the external_id lookup-field case as V2 (it runs on the v2 destination) - distinguish the v1 identify and group cases by the traits they exercise rather than repeating "create user" / "update user" - fix the "indentifier" typo and the unsupported-message-type success criteria (the case sends a page event, not alias) No test inputs or expectations change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fix the Intercom live suite against a real workspace: - setup waits until the contact is found by the same email OR external_id search the transform sends; Intercom indexes a new contact by external_id within seconds but the OR query can take ~30-50s, so the transform routed the update to a create and got a 409 - steps right after setup wait longer and retry more - read the contact's attached companies from either `companies` or `data` Add two scenarios: - event-stream identify with email and anonymousId (no userId) and sendAnonymousId on: the contact gets anonymousId as external_id - rETL identify with identifierType email: the contact is created by email without external_id Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ddress review comments Live harness: only proxy router outputs with statusCode 200, matching rudder-server's router (router/worker.go). A 298 (filtered) or 299 (handled by the transformer) output is its jobs' final status and is no longer delivered; previously the harness replayed it, duplicating writes such as Intercom's group attach and masking whether the transform-side write happened. Intercom live spec: - group expects no proxy request; the read-back proves the transform attached the company, and its delivery retries are removed (a search miss succeeds on the company-only branch, so they never fired) - setup waits only until the contact is searchable by external_id, the search the following steps send; the update event carries no email, so the transform avoids the email OR external_id search that can take over a minute and pushed setup past the 120s step timeout Co-Authored-By: Claude Opus 5.5 <[email protected]>
- drop SEARCH_RACE: track does not search, and identify update searches by external_id, which setup already waits for; keep a small retries: 2 on identify update for replica lag - let setup's pollUntil fail on exhaustion instead of soft polling plus a hand-built throw - read attached companies from `companies` only, the shape Intercom 2.10 returns - import the API hosts from the destination config instead of copying them - drop unused IntercomContact.phone and IntercomCompany.plan Co-Authored-By: Claude Opus 5.5 <[email protected]>
…p group scenario The transform's searchContact always sends a compound query, even for a single external_id lookup. Intercom returns a new contact to a simple single-field query within seconds but to the compound form only after ~30-100s, so setup that polled the simple form handed over too early and identify update was routed to a create (409). - identify update setup now polls the transform's exact query shape (compound AND on external_id) until two consecutive hits, with a 240s step timeout - live harness: steps can set their own timeoutMs (default stays 120s) - track setup only creates the contact; its transform does not search - remove the intercom-v2-group scenario and its company helpers; it stayed flaky against the real workspace Co-Authored-By: Claude Opus 5.5 <[email protected]>
The shared agent uses keepAlive: false with unlimited maxSockets, so Node already sends `Connection: close` on every request; the explicit header added nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
665b1c0 to
496e4d1
Compare
|




What are the changes introduced in this PR?
Enrolls Intercom (API v2) in the live integration test suite, and fixes live-harness gaps that apply to every destination.
Live harness fixes (
test/integrations/live/):runPipelineStep.ts). rudder-server's router only proxies an output whosestatusCodeis 200 (router/worker.go); any other 2xx is the job's final status with no delivery: 298 (event filtered) and 299 (event already handled by the transformer). The harness used to proxy every 2xx output, so it replayed writes production never sends: when a transform has already performed the write itself and returns 299, the replay sent it a second time and hid whether the transform's own write happened. Now only 200 outputs are proxied, and 298/299 are recorded as the jobs' final status. Covered by new cases inrunPipelineStep.test.ts. Destinations that return 299 (Intercom, Klaviyo, Zendesk, Intercom v2) get the same treatment.routerTransformRequest.ts,types.ts). The/routerTransformbody now sendsdestination.DestinationDefinition.Name. The service selector routes on that field, so without it every CDK v2 destination fell back to the native path and failed withCannot find module '../v0/destinations/<dest>/transform'. Destinations already enrolled are v0/v1 and ignore the field.component.live.test.ts,types.ts). A step may declaretimeoutMs(default stays 120s), for a setup that legitimately waits on a slow, eventually consistent index.Intercom live suite (
test/integrations/destinations/intercom/live/):intercom-v2-identify-createPOST /contactsexternal_idintercom-v2-identify-anonymous-idanonymousId, nouserId,sendAnonymousId: trueexternal_id=anonymousIdintercom-v2-retl-emailidentifierType: emailexternal_idemptyintercom-v2-identify-updatePUT /contacts/<id>intercom-v2-retl-user-iduser_id, no emailexternal_idintercom-v2-retl-external-idexternal_id, no email (INT-7442)external_idintercom-v2-trackPOST /eventssearchContactalways sends a compound query, even for a singleexternal_idlookup. Intercom returns a new contact to a simple single-field query within seconds, but to the compound form only after ~30–100s. Identify update's setup therefore polls the transform's exact query shape until two consecutive hits (with a 240s step timeout), and its event carries no email, so the transform's search is that singleexternal_idlookup. Otherwise the update is routed to a create and Intercom answers 409.What is the related Linear task?
Related to INT-7442
Please explain the objectives of your changes below
Live coverage of the Intercom v2 delivery paths against a real workspace, including the rETL
external_idcase fixed in INT-7442.Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
Live harness only, no production code changes:
DestinationDefinition.Name(uppercase destination name, as rudder-server sends it).statusCode200 are proxied; 298/299 outputs are recorded as completed without delivery, matching rudder-server.timeoutMs; steps without it keep the 120s default.Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
buildRouterTransformBody(live harness) now setsDestinationDefinition; covered by the existingrunPipelineStep.test.ts.Any technical or performance related pointers to consider with the change?
LIVE_SECRET_INTERCOMin Vault, single-line:{"authType":"apiKey","config":{"apiKey":"<intercom-access-token>"}}(add"apiServer":"eu"|"au"for non-US workspaces). The token's app needs read + write on users (contacts) and write on data events.Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.
Testing
tsconfig.test.json) clean.🤖 Generated with Claude Code