Skip to content

✨ enable partial view updates by default for CDN users without a proxy - #5000

Open
mormubis wants to merge 11 commits into
mainfrom
adlrb/pvu-enable-by-default
Open

✨ enable partial view updates by default for CDN users without a proxy#5000
mormubis wants to merge 11 commits into
mainfrom
adlrb/pvu-enable-by-default

Conversation

@mormubis

@mormubis mormubis commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Motivation

Partial view updates have been behind betaEnableViewUpdates since #4833. This is the Sept 7 step of the Road to GA: enable it by default where we know it's safe.

CDN users always run the latest bundle, so we can roll back by shipping a new version. npm users pin a version, so they opt in explicitly. proxy users stay off too, a proxy may not forward the view_update event type yet.

Changes

betaEnableViewUpdates defaults to true on CDN builds without proxy, and false everywhere else. An explicit value from the user always wins.

The schema default only takes static values, so I removed it from the field and resolve it in validateAndBuildRumConfiguration instead, next to the other post-processed options. That's the part worth a look: with default: false you can't tell "passed false" from "passed nothing", both come out as false. Without the default an unset option is undefined, so isViewUpdatesEnabled can fill it in and an explicit false survives.

Telemetry now reports the resolved value instead of the raw one. Otherwise every defaulted user shows up as undefined and we can't follow the rollout.

CDN vs npm comes from __BUILD_ENV__SDK_SETUP__, declared locally in configuration.ts like the other build-env consumers do. Unit tests and the e2e bundles are both webpack builds, so both run as cdn. Nothing covers the npm branch automatically.

Test instructions

  1. yarn dev and open the sandbox. It sets proxy: '/proxy', so the RUM configuration telemetry should report beta_enable_view_updates: false.
  2. Comment out proxy in sandbox/index.html and reload. It should now be true. Requests fail auth without the proxy, that's expected, the configuration event still goes out.
  3. yarn test:unit --spec packages/browser-rum-core/src/domain/configuration/configuration.spec.ts for the proxy/no-proxy and explicit-value cases.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change. The PVU e2e tests already set the flag explicitly, and every e2e page injects proxy, so they cover the disabled path.
  • Updated documentation and/or relevant AGENTS.md file. The option's JSDoc is updated here, public docs live in the docs repo.

@mormubis
mormubis requested a review from a team as a code owner August 31, 2026 10:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 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-09-01T15:15:09.361374Z 4d8fb3c New commits
ℹ️ 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.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 31, 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: 33.33%
Overall Coverage: 77.03% (-0.00%)

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

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 31, 2026

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 181.63 KiB 181.72 KiB +100 B +0.05%
Rum Profiler 8.43 KiB 8.43 KiB 0 B 0.00%
Rum Recorder 25.32 KiB 25.32 KiB 0 B 0.00%
Logs 57.93 KiB 57.93 KiB 0 B 0.00%
Rum Salesforce N/A 139.78 KiB N/A N/A N/A
Rum Slim 139.68 KiB 139.78 KiB +97 B +0.07%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%
Rum Shopify N/A 206.09 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.43 KiB N/A N/A N/A
Rum-shopify Recorder N/A 3.74 KiB N/A N/A N/A

@mormubis
mormubis marked this pull request as draft August 31, 2026 10:40
Reverts the getSdkSetup accessor and its browser-core export. rum-core now declares
__BUILD_ENV__SDK_SETUP__ locally, like the eight existing __BUILD_ENV__SDK_VERSION__
consumers. Drops the four npm-branch tests, which are unreachable under Karma because
webpack.base.ts pins setup: 'cdn'.

Also fixes prettier on the beta_enable_view_updates line.
Both declares of __BUILD_ENV__SDK_SETUP__ now read 'npm' | 'cdn', matching the
setup argument of getBuildEnvDefines. With the previous 'string' type a typo like
=== 'CDN' would compile and silently disable the feature.
trackLongTasks: { type: 'boolean', default: true, strict: false },
trackViewsManually: { type: 'boolean', default: false, strict: false },
betaEnableViewUpdates: { type: 'boolean', default: false },
betaEnableViewUpdates: { type: 'boolean' },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the default. With default: false you can't tell if the user passed false or didn't pass anything, both end up as false after validation. So the default is resolved in validateAndBuildRumConfiguration instead.

The intersection already resolves it: (boolean | undefined) & boolean is boolean, and
the required member wins over the optional one. Only allowedTracingUrls needs the Omit,
because its schema type and resolved type are incompatible.
sdk_setup is merged in via combine() and cast to TelemetryEvent['telemetry'], so the
type is never checked there. The narrow only pays off in rum-core where the value is
compared against 'cdn'. Leaving telemetry.ts untouched avoids a declare that can go
stale if a third setup is ever added.
…global

The narrow only guarded a typo in === 'cdn', which the tests already catch. string
matches the telemetry declare and the eight __BUILD_ENV__SDK_VERSION__ ones.
Both call sites now just call the helper, matching getRemoteConfigurationId which keeps
its own ?? internally. Before this, the two call sites were the only 'field ?? helper()'
pattern in the file.
@mormubis
mormubis marked this pull request as ready for review September 1, 2026 08:55

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92afd29757

ℹ️ 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".

Comment thread packages/browser-rum-core/src/domain/configuration/configuration.ts
* TODO next major: remove the option.
*/
function isViewUpdatesEnabled(explicit: boolean | undefined, proxy: InitConfiguration['proxy']): boolean {
return explicit ?? (__BUILD_ENV__SDK_SETUP__ === 'cdn' && !proxy)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fix page-state diffs before enabling updates by default

issue: For CDN sessions that experience a visibility/page-state transition after the initial full view has flushed, this default activates a corrupt diff path: processPageStates emits _dd.page_states newest-first, while computeAssembledViewDiff treats that array as append-only and takes current.slice(last.length). For example, a base [active] followed by [hidden, active] sends [active] instead of the new hidden entry, so the backend loses the transition until a full checkpoint; keep the default off until this array is diffed according to its ordering or sent with replace semantics.

Useful? React with 👍 / 👎.

* TODO next major: remove the option.
*/
function isViewUpdatesEnabled(explicit: boolean | undefined, proxy: InitConfiguration['proxy']): boolean {
return explicit ?? (__BUILD_ENV__SDK_SETUP__ === 'cdn' && !proxy)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the pinned Salesforce bundle opted out

issue: The Salesforce bundle is built through the same webpack path marked as setup: 'cdn', but the supported installation flow downloads it and registers or commits it as a Salesforce static resource. With no proxy, this condition therefore opts those pinned deployments into view updates even though publishing a corrected CDN bundle cannot roll them back—the exact safety distinction used to keep npm users disabled. Treat the Salesforce build as pinned for this rollout or override its default explicitly.

Useful? React with 👍 / 👎.

The bridge replaces the batch transport, and view_update events are only created by
createBatchDispatcher, so a WebView can never send a partial update. Reporting the option
as enabled there inflated the rollout telemetry. The explicit value is ignored too, since
it cannot take effect either.
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