Audience membership core amplitude#3670
Conversation
New required fields detectedWarning Your PR adds new required fields to an existing destination. Adding new required settings/mappings for a destination already in production requires updating existing customer destination configuration. Ignore this warning if this PR is for a new destination with no active customers in production. The following required fields were added in this PR:
Add these new fields as optional instead and assume default values in |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3670 +/- ##
==========================================
+ Coverage 80.49% 80.93% +0.44%
==========================================
Files 1320 1373 +53
Lines 24433 27397 +2964
Branches 4987 5805 +818
==========================================
+ Hits 19667 22175 +2508
- Misses 3859 4311 +452
- Partials 907 911 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Not an issue. Amplitude Cohorts is a new destination. |
Summary
This PR introduces a centralized audienceMembership resolution mechanism in actions-core and migrates 1 audience destinations to consume it.
Instead of each destination independently parsing Engage traits/properties or RETL sync-mode event names to determine add vs. remove, the Core framework now computes a typed boolean | undefined value and injects it into every action's ExecuteInput. All destination changes are gated behind per-destination feature flags with full legacy fallback.
Core Changes (packages/core)
New: audience-membership.ts
Centralizes the logic for resolving audience membership from raw event data:
New: flags.ts
Adds the following flags to Core. Will be removed once the associated destinations are migrated.
FLAGS.ACTIONS_GOOGLE_EC_AUDIENCE_MEMBERSHIP
FLAGS.ACTIONS_BRAZE_COHORTS_AUDIENCE_MEMBERSHIP
FLAGS.ACTIONS_LINKEDIN_AUDIENCES_AUDIENCE_MEMBERSHIP
Updated: destination-kit/types.ts
Updated: destination-kit/action.ts
Updated: index.ts
Exports AudienceMembership, resolveAudienceMembership, and FLAGS for use by destinations.
Destination Changes
Amplitude Cohorts
Flag: ACTIONS_CORE_AUDIENCE_MEMBERSHIP (master flag only — amplitude has no per-destination flag; membership comes from Core unconditionally once the master flag is on)
top-level segment_external_audience_id field. This simplifies the mapping and removes the need for each payload to carry audience key / traits data.
PAYLOAD_VALIDATION_FAILED.
Unit Test Coverage
legacy.test.ts (295 lines), functions.test.ts (342 lines), audience-creation.test.ts (135 lines), canary.test.ts (175 lines)
Tested in Staging with Facebook Custom Audiences.
