Repository navigation
♻️ Guard RUM collection when browser globals are unavailable - #5140
Conversation
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: edf91da | Docs | View more details | Give us feedback! |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
More details
The guards preserve browser collection paths while skipping DOM-dependent work when globals are absent. Full RUM initialization in workers remains outside this change’s scope.
🤖 Bits Code Review · Commit 51655f6
There was a problem hiding this comment.
More details
The completed static review found no actionable regression in the missing-global guards. End-to-end RUM initialization in workers remains outside the validated scope.
🤖 Bits Code Review · Commit 7a57829
There was a problem hiding this comment.
More details
Worker startup requires automatic interaction tracking to be disabled. PR discussion explicitly assigns this to Web Pixels configuration, and the new worker scenario follows that constraint.
🤖 Bits Code Review · Commit 3ab1605
…opify-regular-sdk # Conflicts: # packages/browser-core/src/browser/cookie.ts
There was a problem hiding this comment.
More details
Worker support relies on disabling page-only collection, including automatic interaction tracking. This matches the Shopify configuration and the explicit scope agreed in the PR discussion.
🤖 Bits Code Review · Commit 3ab1605
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a182e9801
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Firefox reports the `event` entry type as supported in workers, so the check reached `window.PerformanceEventTiming` and threw, preventing any view from being created. Use `globalObject` instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Skip the sandboxed iframe patches (they access `document`) and use memory persistence (no cookies) when running in a worker. Also reword the worker guard comment to say Shopify is expected to run in a worker in the future. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add the internal `betaTrackViewMetrics` option (default true) and gate initial, route change and common view metrics (scroll, CLS, INP) on it, instead of checking for `globalObject.document`. Loading time and manual `setViewLoadingTime()` are always kept. The Shopify plugin disables it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a85bbb4eef
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…opify-regular-sdk # Conflicts: # packages/browser-rum-core/src/domain/view/trackViews.ts # packages/browser-rum-core/src/domain/view/viewMetrics/trackCommonViewMetrics.ts
a85bbb4 to
7bed9d8
Compare
The load event is only reported by trackInitialViewMetrics, which is skipped when `betaTrackViewMetrics` is false, so the activity-based loading time of initial views was never reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Manually INP support is only checked by trackInteractionToNextPaint, which is skipped when `betaTrackViewMetrics` is false, and onBFCacheRestore only runs when views are tracked automatically. Both files match main again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5c0b019 to
130c052
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 130c052662
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Skip the navigation resource in startResourceCollection when there is no document, and restore getNavigationEntry to always return an entry. Its other callers (LCP, navigation timings) only run with view metrics, so they no longer need to handle a missing entry.
Add shopifyAppPixelPlugin, which forces the configuration RUM needs in the Shopify app Web Pixel worker (manual views, memory persistence, no view metrics, no DOM-based features), and only allow RUM to start in a worker when this plugin is used. Restore shopifyPlugin to its main version, so existing consumers are not affected. The dedicated worker e2e now initializes RUM with the new plugin, through a worker `withRumInit()` mirroring the page one.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddde5c4e44
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
refs: RUM-18788 Resolve conflicts with the view metrics opt-out by keeping main's trackViewMetricsManually option, dropping trackAutomaticViewMetrics, and switching the Shopify plugin to the new option.
Motivation
Shared helpers and RUM collectors assume
windowanddocumentare available. In a Web Worker (e.g. the Shopify App Pixels sandbox), those globals are missing and these accesses throw, even when the underlying API exists on the global object. Read available APIs throughglobalObject, and skip page-only features where they start, so RUM keeps running and those features report nothing.Changes
globalObjectwhen they also exist in workers: performance,PerformanceObserver, location,requestIdleCallback,ReportingObserver,EventTarget, and the synthetics / Cypress test context.addEventListener(s)andinstrumentMethodstill require a target. Callers check for a missing window themselves, once at the top of each page-only feature: window open, location change, page state history and display context.startResourceCollectiondoesn't report the navigation resource.getCookie()readsdocument.cookie.runOnReadyState) run immediately.shopifyAppPixelPluginon therum-shopifybundle (DD_RUM.shopifyAppPixelPlugin()). It sets the configuration that works without a page: manual views, no user interactions, resources, long tasks, Session Replay or profiling, in-memory session persistence, andtrackViewMetricsManuallyso no automatic view metrics (loading, navigation timings, web vitals) are collected.preStartRumno longer rejects a worker environment when theshopify-app-pixelplugin is configured. Other worker setups still get the "not supported" warning.createWorker({ dedicated: true })runs the worker withnew Worker(),withRum(config, { sdk })picks the bundle, andwithRumInit()customizes theinitcall. The worker setup turns on SDK debug mode so errors caught by the SDK monitor fail the test.Test instructions
Web workers Rum › dedicated web worker with worker rum: starts therum-shopifybundle in a dedicated worker withshopifyAppPixelPlugin(), starts a view manually and expects a view event. The title avoids "shopify" because PR e2e jobs skip those tests (they only run on a schedule, against a live store).Checklist