Skip to content

fix(hs_audience): make live membership suite resilient to mid-run failures - #5764

Merged
ASaiAnudeep merged 2 commits into
developfrom
fix.hs-audience-clear-leftover-list-membership
Nov 3, 2026
Merged

ASaiAnudeep merged 2 commits into
developfrom
fix.hs-audience-clear-leftover-list-membership

Conversation

@ASaiAnudeep

@ASaiAnudeep ASaiAnudeep commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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 removeMembership so 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. removeMembership is 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

  • GitHub Actions: live (hs_audience) passed.
  • GitHub Actions: formatting and lint checks passed.

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.

…lures

🔒 Scanned for secrets using gitleaks 8.30.1
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 352303f6-cb5c-4ae1-8e35-3fa6458b8418

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.42%. Comparing base (a74c408) to head (64da4e1).

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

@ASaiAnudeep
ASaiAnudeep marked this pull request as ready for review November 3, 2026 04:13
Copilot AI balanced review requested due to automatic review settings November 3, 2026 04:13
@ASaiAnudeep
ASaiAnudeep requested review from a team as code owners November 3, 2026 04:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 removeMembership helper 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 lvrach left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@ASaiAnudeep
ASaiAnudeep merged commit 867fca0 into develop Nov 3, 2026
39 checks passed
@ASaiAnudeep
ASaiAnudeep deleted the fix.hs-audience-clear-leftover-list-membership branch November 3, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants