Repository navigation
feat: [SDK-5370] web session model and sessions v2 flag - #1568
Merged
Merged
Conversation
Adds the sdk_sessions_v2_api_cutover flag and extends the Sessions record with a session UUID, the flag value, pinned onesignal/subscription IDs, and a slot for the server session ID. Captured once when the worker starts a session. No network calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
13 of 16 tasks
fadi-george
requested review from
abdulraqeeb33 and
sherwinski
and removed request for
sherwinski
November 12, 2026 19:54
sherwinski
reviewed
Nov 13, 2026
| await sendOnSessionCall(options, session); | ||
| } | ||
|
|
||
| async function startNewSession({ |
Contributor
There was a problem hiding this comment.
Nit, for awareness: startNewSession could send a local ID. Would depend on how it gets called
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
1 Line Summary
Capture the
sdk_sessions_v2_api_cutoverflag and pinned user/subscription IDs on the web session record at session start.Details
First Web PR in the SDK Sessions stack. Later PRs need a persisted per-session record that knows which path the session is on and which user/subscription it belongs to. Mirrors Android (OneSignal/OneSignal-Android-SDK#2774) and iOS (OneSignal/OneSignal-iOS-SDK#1762).
FeatureFlag._SessionsV2ApiCutover(sdk_sessions_v2_api_cutover).Sessionsrecord withsessionId(UUID),usesSessionsApi,onesignalId,subscriptionId, andserverSessionId.accumulatedDurationalready holds the cumulative duration.Differences from Android:
performance.now()resets when the worker restarts, so it can't be persisted. Duration stays on the wall clock._getOneSignalAndSubscriptionIdsreturns a OneSignal ID and a complete push subscription, so the IDs are pinned as the page sends them.Open question from the ticket (sessions require a push subscription today) is not addressed here.
Systems Affected
Validation
Tests
Info
New
session modeltests inServiceWorker.test.ts: flag off/on capture, IDs pinned on start, flag and IDs fixed mid-session, new ID and fresh flag read after the session threshold, and an old record without the new fields staying on the legacy path. Each reads the record back from IndexedDB. Full suite (1037 tests),vp check, andbuild:prodpass.Checklist
Not tested in a browser. No user-facing behavior changes with the flag off.
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
No UI changes.
Checklist
Related Tickets
SDK-5370
🤖 Generated with Claude Code