feat: send a per-occurrence event_id on IAM engagement [NOTP-1520] - #1696
Closed
cconstantine-onesignal wants to merge 1 commit into
Closed
feat: send a per-occurrence event_id on IAM engagement [NOTP-1520]#1696cconstantine-onesignal wants to merge 1 commit into
cconstantine-onesignal wants to merge 1 commit into
Conversation
Turbine deduplicates IAM engagement (click/impression/pageImpression) on an SDK-supplied event_id. Mint a fresh UUID per engagement occurrence and send it as event_id so at-least-once deliveries collapse to one event downstream. iOS's OneSignalClient reattempts failed requests (5xx / network error) by re-executing the *same* request object, whose parameters are set once at construction -- so minting the id when the request is built keeps it stable across those retries, which is exactly the duplicate turbine needs to fold. Distinct engagements (including a later redisplay) build a new request and get a new id. - OSInAppMessagingRequests: new withEventId: param on the Viewed / PageViewed / Clicked requests, added to the body as event_id. - OSMessagingController: mint [NSUUID UUID] at each engagement call site. - IAMRequestTests updated to pass and assert event_id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Mint a per-occurrence
event_idand send it on IAM engagement requests (click,impression, pageImpression). Turbine deduplicates these on the SDK-supplied
event_id(see OneSignal/turbine#1768), so at-least-once deliveries collapse toa single event downstream instead of becoming duplicate Kafka records /
double-counted engagement (NOTP-1520).
What changed
OSInAppMessagingRequests: newwithEventId:param on the Viewed / PageViewed/ Clicked requests, added to the body as
event_id.OSMessagingController: mint[NSUUID UUID]at each engagement call site.IAMRequestTestsupdated to pass and assertevent_id(the body check is anexact match).
Why mint at request-construction
OneSignalClientreattempts a failed request (statusCode >= 500 || == 0, i.e.5xx or a network error, up to
MAX_ATTEMPT_COUNT) by re-executing the sameOneSignalRequestobject, whoseparametersare set once at construction. Sominting the id when the request is built keeps it stable across those retries,
which is exactly the response-lost duplicate turbine needs to fold. After the
reattempts are exhausted, the controller's
onFailureclears its guard, so alater send is a redisplay = a new occurrence = a new id.
This client retry makes iOS the primary retry-driven duplicate source for IAM
engagement.
Validation
Code-only change (no local build in this environment); relies on CI. Body
assertions added to
IAMRequestTestsfor all three requests.Task / Ticket
https://linear.app/onesignal/issue/NOTP-1520