Skip to content

fix(rum): keep remote settings across releases of the application - #48

Merged
Fiona2016 merged 1 commit into
publishfrom
fix/remote-config-key-without-app-version
Oct 15, 2026
Merged

Fiona2016 merged 1 commit into
publishfrom
fix/remote-config-key-without-app-version

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

Problem

The remote settings cache in localStorage was keyed by site | applicationId | env | version, with version being the application's own version. Every deploy therefore started with no entry. Each visitor's first session on the new release was drawn on the init settings and carried no _dd.configuration.rc_version. The fetch that session triggered only applied to the session after it.

Change

  • buildStoreKey no longer includes the application version, so the settings stored by one release are read by the next. This matches the iOS SDK, whose cache key leaves the application version out for the same reason.
  • Releases of one site live at the same time share the entry. That is right as long as they are given the same settings. If they ever are not, the shared entry is still the latest decision on record, and the fetch every page makes stores its own release's answer for its next draw.
  • app_version is still sent on the config request.
  • Entries written by earlier builds keep the version in their key, so they are no longer read. The existing age-based sweep removes them after two days. The first session after upgrading the SDK uses the init settings once.
  • Comments on the key, the draw-record key and the sweep are updated to match.

Verification

  • yarn test:unit: 3189 passed.
  • New tests:
    • the key is the same across application versions;
    • a value fetched under one release is read by the next.
  • Negative control: with the version put back into the key, exactly those 2 tests fail.

Supersedes #47.

🤖 Generated with Claude Code

The stored remote settings were keyed by application version as well as
site, application and environment. Every deploy therefore started with
no entry: each visitor's first session on the new release was drawn on
the init settings and reported no remote configuration version, and the
fetch it triggered only applied to the session after it.

The key no longer includes the application version, so the settings the
previous release stored are read by the next one. Releases of one site
live at the same time share the entry, which is right as long as they
are given the same settings, and is still the latest decision on record
if they ever are not: the fetch every page makes stores its own release's
answer for its next draw. The SDK keeps sending app_version on the
request.

Entries written by earlier builds carry the version in their key and are
no longer read; the existing age-based sweep removes them after two days.
The first session after upgrading the SDK uses the init settings once.
@Fiona2016
Fiona2016 merged commit 734fb9e into publish Oct 15, 2026
5 checks passed
@flashduty

flashduty Bot commented Oct 19, 2026

Copy link
Copy Markdown

Reviewed as part of this week's SDK/component-library review.

The mechanism checks out against the merged code:

  • Old entries are exactly newKey + '|' + version — the updated spec pins that (const otherReleaseKey = ${buildRemoteConfigSetup(INIT_CONFIGURATION)!.storeKey}|0.9.0``), so the age-based sweep still finds everything the previous builds wrote.
  • The 3-part and 4-part shapes cannot collide: buildKey runs every part through encodeURIComponent, and | is escaped to %7C, so a 4-part old key can never be spelled by a 3-part identity.
  • sweepAbandonedEntries(keepKey) still exempts this page's own entry, and a live old-build entry keeps its t fresh, so a long-lived tab on the previous release does not have its entry taken away.
  • app_version still rides on the request, so server-side targeting by release remains possible.

One documentation gap in the released changelog, not a code change request:

The v0.3.1 entry covers "entries left by earlier builds are no longer read and are swept after two days", but not the consequence you spell out in the PR body — releases of one site live at the same time now share one entry. For a site on a rolling deploy or a canary where two releases are served at once and the settings are targeted per app_version, the first draw on the new release can be handed the other release's stored rates. That is bounded (the page fetches its own answer and overwrites), but it is the one behaviour an integrator might notice, and it is invisible from the CHANGELOG.

Worth one clause in the v0.3.1 entry ("releases served at the same time share one entry, so settings targeted per application version can apply to the first session of the other release"), so a site running canary rollouts can decide whether it is affected.

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