Repository navigation
fix(hs_audience): make live membership suite resilient to mid-run failures - #5764
Conversation
…lures 🔒 Scanned for secrets using gitleaks 8.30.1
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5764 +/- ##
========================================
Coverage 92.42% 92.42%
========================================
Files 741 741
Lines 41059 41059
Branches 9641 9560 -81
========================================
Hits 37949 37949
Misses 2926 2926
Partials 184 184 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Automatic removal can delete contact membership used by another active HS_AUDIENCE run because jobs share a sandbox without cross-PR/branch serialization or per-run contact isolation, causing membership read-back failures.
1 open issue
What changed in this PR
This PR makes the HS_AUDIENCE live integration suite recover from membership left behind by interrupted runs. Production destination behavior is unchanged.
Changes:
- Setup removes existing test-contact membership and verifies its absence after validating sandbox resources.
- A shared
removeMembershiphelper handles removal and verification for setup and cleanup. - Cleanup remains conditional on resource registration.
| File | Description |
|---|---|
test/integrations/destinations/hs_audience/live.ts |
Adds setup recovery and shares membership removal logic with guarded cleanup. |
Review effort: Balanced
lvrach
left a comment
There was a problem hiding this comment.
Approved. The change is test-only, CI is green, and the cleanup ordering holds: ctx.register runs after the removal, and a throw before it leaves cleanup a no-op.
[should-fix] This is the point from the Copilot thread on line 201. Workflow concurrency is keyed on the PR number or ref (.github/workflows/live-integration-tests.yml:24-26), and every HS_AUDIENCE run loads the same sandbox list and contact. A push to develop runs all destinations (live-test-matrix.js), so it can overlap a PR run. Failing sequence: run A adds the contact and polls for presence. Run B's setup sees the membership and removes it. A's verifyMembership(ctx, true) then fails after 8 polls. The old throw failed B and left A alone.
Cheapest fix: a job-level concurrency group keyed on the destination (for example live-hs_audience, cancel-in-progress: false), or a per-run contact. At least, the new comment should say that setup assumes no concurrent run.
|




What are the changes introduced in this PR?
Make the HS_AUDIENCE live membership suite recover from leftover list membership after a previous run crashes. Setup now removes any existing membership for the configured test contact and verifies that it is absent before registering cleanup, instead of failing immediately.
Extract
removeMembershipso setup and cleanup share the membership-removal request and verification. Cleanup still runs only when the cleanup resource has been registered.What is the related Linear task?
N/A — no Linear task linked.
Please explain the objectives of your changes below
Allow the live suite to start from a clean state when an interrupted run leaves the test contact in the sandbox list. The suite continues to validate the configured list and contact before removing leftover membership.
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
Previously, setup failed if the test contact was already a list member. It now removes that membership and verifies its absence before continuing. This change is limited to the live integration test; production destination behavior is unchanged.
Any new dependencies introduced with this change?
None.
Any new generic utility introduced or modified. Please explain the changes.
None.
removeMembershipis a helper local to the HS_AUDIENCE live suite.Any technical or performance related pointers to consider with the change?
Setup makes an additional removal request and verifies the result only when leftover membership exists.
Validation
live (hs_audience)passed.Developer checklist
Reviewer checklist