Skip to content

fix(rum): read the previous release's remote settings until a release stores its own - #47

Closed
Fiona2016 wants to merge 1 commit into
publishfrom
fix/remote-config-reuse-sibling-release
Closed

Fiona2016 wants to merge 1 commit into
publishfrom
fix/remote-config-reuse-sibling-release

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

Problem

Stored remote settings are keyed by site | applicationId | env | version. The application version is part of the key so two releases live at the same time can be answered differently. Because of that, every deploy starts with no cache entry for the new release. Each visitor's first session on it is then drawn on the init settings and carries no _dd.configuration.rc_version. The fetch that session triggers only takes effect for the session after it.

For a site that deploys often, this is a constant stream of sessions that never apply the published settings, and that look unreached when counting adoption.

Change

  • readRemoteConfig: when this release has no entry of its own, read the entry most recently written (by its write time t) for the same site, application and environment under another release.
    • The version is the last part of the key, and | cannot occur inside an encoded part. So the prefix up to the last separator matches the identity exactly.
    • Entries without a write time are passed over.
    • Keys not built by buildStoreKey (no separator) never match anything.
  • store() keeps comparing against this release's own entry only, so a borrowed version:
    • does not refuse this release's answer, even one with a lower number;
    • does not make this release's answer look like a repeat, so REMOTE_CONFIGURATION_STORED still fires on the first own write and endSessionIfSettingsAreDecisive compares against the release's own settings.
  • While borrowing, the applied_version sent on the config request is the borrowed version, which is what the running session is actually on.

Trade-off: if the console targets releases with different settings, the first session of a new release uses the previous release's settings instead of the init ones until its own answer is stored. That is still the latest decision on record. Before this change, that session got the init values in every case.

Verification

  • Unit: 6 new tests in remoteConfiguration.spec.ts plus 1 in rumSessionManager.spec.ts. Full yarn test:unit passes (3194). Negative control: with the fallback line removed, exactly the 3 tests that exercise it fail. The other 3 guard against over-reach and pass either way.
  • Bundle check in Chromium: release 1.0.0 loads and stores config v7, then the session is cleared and release 2.0.0 loads.
bundle first 2.0.0 session rc_version applied_version on its config request
this branch 7 7
published 0.3.0 absent absent

🤖 Generated with Claude Code

… stores its own

Stored remote settings are keyed by application version, so that two
releases live at the same time can be answered differently. The cost was
that every deploy started with no entry of its own: each visitor's first
session on the new release was drawn on the init settings and reported no
remote configuration version, until the fetch it triggered was stored for
the next session.

When this release has no entry yet, readRemoteConfig now reads the entry
the same site, application and environment most recently stored under
another release. Those are the settings this release gets too unless the
console targets releases apart, and even then they are the latest decision
on record, which the init settings are not. The release's own answer
replaces them as soon as it is stored.

The version floor in store() still only looks at this release's own
entry, so a borrowed version neither refuses this release's answer nor
makes it look like a repeat, and REMOTE_CONFIGURATION_STORED still fires
on the first own write.
@Fiona2016

Copy link
Copy Markdown
Collaborator Author

Superseded by 48: the application version is dropped from the cache key instead of reading another release's entry.

@Fiona2016 Fiona2016 closed this Oct 15, 2026
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