Skip to content

♻️ [Core] Allow passing a session store factory to startSessionManager - #5130

Draft
BeltranBulbarellaDD wants to merge 1 commit into
mainfrom
beltran.bulbarella/shopify-session-store-core
Draft

BeltranBulbarellaDD wants to merge 1 commit into
mainfrom
beltran.bulbarella/shopify-session-store-core

Conversation

@BeltranBulbarellaDD

Copy link
Copy Markdown
Contributor

Motivation

Following the question about whether the custom / Shopify store could call register: yes, the idea is for the Shopify SDK to own the registration and pass its store to browser-core.

This PR contains the browser-core changes needed for that. The Shopify side lives in #5108.

Changes

Browser-core receives a third parameter in startSessionManager:

mockable(startSessionManager)(configuration, trackingConsentState, createSessionStore)

The Shopify SDK would call register(startRegisteredWebPixel) and create the factory inside that callback:

mockable(startWebPixelRum)(configuration, api, createShopifySessionStoreFactory(api.browser))

The important part is that createShopifySessionStoreFactory(api.browser) lives in the Shopify SDK. Browser-core only receives the factory, so we don't need to put browser.cookie in the public initialization configuration.

Existing callers keep the default store selection, and sessionPersistence stays as it is. If the supplied factory cannot provide a store, the session manager doesn't start.

This also exposes the cookie string builder and shared cookie session store so the Shopify adapter can reuse them. Legacy document.cookie lookup can be disabled for environments without a DOM, and the cookie availability check handles a factory that throws.

Test instructions

Passed locally: yarn lint, yarn typecheck, yarn format, yarn build, and 145 targeted unit tests covering cookie access, session storage, and the session manager.

The added tests cover the injected store, unavailable storage without fallback, a throwing cookie-access factory, and disabling legacy cookie reads.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@BeltranBulbarellaDD
BeltranBulbarellaDD requested a review from a team as a code owner October 13, 2026 11:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T11:31:09.206940Z 9b3faa3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum Salesforce N/A 185.58 KiB N/A N/A N/A
Rum 185.41 KiB 185.55 KiB +144 B +0.08% ✅
Rum-salesforce Profiler N/A 8.38 KiB N/A N/A N/A
Rum Profiler 8.38 KiB 8.38 KiB 0 B 0.00% ✅
Rum-salesforce Recorder N/A 31.94 KiB N/A N/A N/A
Rum Recorder 31.94 KiB 31.94 KiB 0 B 0.00% ✅
Logs 59.34 KiB 59.48 KiB +144 B +0.24% ✅
Rum Slim 143.42 KiB 143.56 KiB +144 B +0.10% ✅
Worker 22.96 KiB 22.96 KiB 0 B 0.00% ✅
Rum Shopify N/A 215.97 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.38 KiB N/A N/A N/A
Rum-shopify Recorder N/A 4.77 KiB N/A N/A N/A

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

Existing callers retain default storage selection, while an unavailable injected store stops session startup without falling back to browser storage. The shared cookie store can disable legacy document.cookie reads for DOM-free adapters.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 9b3faa3

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 71.43%
• Overall Coverage: 77.20% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9b3faa3 | Docs | View more details | Give us feedback!

@BeltranBulbarellaDD
BeltranBulbarellaDD marked this pull request as draft October 14, 2026 13:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant