Repository navigation
feat: [SDK-5383] enqueue a session create when a new session starts - #1779
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
abdulraqeeb33
approved these changes
Oct 19, 2026
abdulraqeeb33
left a comment
Contributor
There was a problem hiding this comment.
The wiring looks right. The create is the record just persisted, flag-off still skips it, and a normal resume still goes through the 30s gate.
One path now sends two creates, noted on the enqueue. The new tests never enter that gate.
nan-li
approved these changes
Oct 19, 2026
…ion create Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
abdulraqeeb33
previously requested changes
Oct 20, 2026
abdulraqeeb33
left a comment
Contributor
There was a problem hiding this comment.
The prewarm dedupe can stay. Init is not deduped, and the locked-storage return happens before the slot is claimed, so recovery and the foreground start collapse to one session.
The create body still needs integer device_type. See the inline.
fadi-george
dismissed
abdulraqeeb33’s stale review
October 20, 2026 20:24
Ignoring device_type comment.
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 through the session operation executor added in #1768. Replaces #1770, which closed when its base branch was deleted. Android counterpart: OneSignal/OneSignal-Android-SDK#2780.Scope
OneSignalUserManagerImpl.startNewSessionpasses the new session's record toenqueueSessionCreate, which queues the create (local session ID as idempotency key,start_time, pinned IDs) when the session's capturedusesSessionsApiis true.OSSessionService.startNewSessionnow returns the record it started.OneSignal.mshouldStartNewSession), so the 30 s threshold, cold-start behavior, and privacy-consent gates are unchanged. Resuming within the threshold sends no create.session_count. The 30 s check moves fromOneSignal.mintoOSSessionStartGate(same rule), and recovery and tracker starts are skipped when a session started within 30 s. Starts from init are never skipped.device_typeis renamed tosubscription_typeand sent asiOSPush, like outcomes. The idempotency key is already the bare session UUID.direct_attribution_id(SDK-5399), session end (SDK-5391).Testing
Unit testing
Added
SessionRecordUserTestscases throughstartNewSession: a create with the session's ID and start time, a separate create per session, and no create with the flag off. The executor test now checkssubscription_type. AddedOSSessionStartGateTestsfor the 30 s resume and init rules and for deduplicating the prewarm starts. TheOneSignal.mwiring has no test, since the Obj-CUnitTeststhat drive init and the lifecycle are commented out.UnitTestApp_TestPlan_Reduced,SessionRecordUserTests,OSSessionOperationExecutorTests, andOSSessionServiceTestspass locally. SwiftLint reports no new violations.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