Repository navigation
feat: [SDK-5383] enqueue a session create when a new session starts - #1770
Closed
fadi-george wants to merge 9 commits into
Closed
fadi-george wants to merge 9 commits into
fadi-george wants to merge 9 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…length Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the standalone session request queue with OSRequestCreateSession / OSRequestUpdateSession and an OSSessionOperationExecutor registered with OSOperationRepo, persisted like the other executors. Session requests are retried in the same run on a later flush once their backoff passes, honoring Retry-After, up to 5 answered failures. The post-create delay uses OSNewRecordsState. The OSCore sessions backend service is folded into the executor and request classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sessions API takes no user JWT, so session Deltas are no longer dropped as anonymous by the operation repo, and the session executor keeps its requests through the anonymous purge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…turn Add OSOperationRepo.retryNow, which ends executors' failure backoff early but still waits out a backend Retry-After, then flushes. OSOperationRetryTrigger calls it when the app comes to the foreground and when a network becomes available while foregrounded, driven by OneSignalTracker's focus events. Executors opt in through OSOperationExecutor.retryNow; only the session executor does so far. Mirrors Android's OperationRetryTrigger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ated Under required Identity Verification an anonymous user is never created, so a session create still waiting for its onesignal_id can never be sent. The anonymous purge now drops those creates and their updates, matching Android. Anonymous users that already have a onesignal_id keep their requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OSSessionService.startNewSession enqueues the create through the session user provider when the session uses the sessions API. The User module turns it into a session Delta for the operation repo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fadi-george
force-pushed
the
fadi/sdk-5383
branch
from
October 10, 2026 00:44
d81f5ae to
5132a8f
Compare
abdulraqeeb33
approved these changes
Oct 12, 2026
abdulraqeeb33
left a comment
Contributor
There was a problem hiding this comment.
Approving.
One create per new session, nothing on resume, nothing when the flag is off. directAttributionId is always nil. Android #2783 is the notification-attribution piece, and this stack has no iOS counterpart yet.
| persist() | ||
| } | ||
| if newRecord.usesSessionsApi { | ||
| userProvider.enqueueSessionCreate(newRecord, directAttributionId: nil) |
Contributor
There was a problem hiding this comment.
directAttributionId is always nil. Fine for this PR. Android #2783 attaches a notification open, and there is no iOS PR for that yet.
Collaborator
Author
An error occurred while trying to automatically change base from
fadi/sdk-5379
to
new-session-events
October 19, 2026 17:58
9 of 18 tasks
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.
Description
One Line Summary
When the sessions API flag is on, enqueue a session create when a new session starts.
Details
Motivation
Part of the iOS SDK Sessions stack (SDK-5383). New sessions need a
POST /apps/{app_id}/sessions, sent by the session executor added in #1768 (base of this one). Android counterpart: OneSignal/OneSignal-Android-SDK#2780.Scope
OSSessionService.startNewSessionenqueues one create when the session's capturedusesSessionsApiis true, through newenqueueSessionCreate/enqueueSessionUpdaterequirements onOSSessionUserProvider. The User module turns it into a session Delta for the operation repo. It carries the session's local ID (also the idempotency key),start_time, and the pinned OneSignal and push subscription IDs.OneSignal.mshouldStartNewSession), so the 30 s threshold, cold-start behavior, and privacy-consent gates are unchanged. Resuming within the threshold sends no create.direct_attribution_id(SDK-5399), session end (SDK-5391).Testing
Unit testing
Added
OSSessionServiceTestscases: the create is enqueued with the session's start time and pinned IDs, a separate create per session, no create on resume, and none when the flag is off. Enqueueing a session Delta is covered inOSSessionOperationExecutorTestsfrom #1768.The full
UnitTestAppscheme passes locally, apart from theUserConcurrencyTests.testSubscriptionExecutorConcurrencyflake. SwiftLint reports no new violation types.Manual testing
Not tested on device yet; end-to-end verification is planned in the iOS rollout and QA ticket.
Affected code checklist
Checklist
Overview
Testing
Final pass
🤖 Generated with Claude Code