fix(remote-config): don't sync a cold read for the previous user on identity change#3722
Draft
tonidero wants to merge 1 commit into
Draft
fix(remote-config): don't sync a cold read for the previous user on identity change#3722tonidero wants to merge 1 commit into
tonidero wants to merge 1 commit into
Conversation
…yncs for the previous user On an identity change IdentityManager wiped remote config before caching the new app user ID, so a cold topic()/blobData() read racing the change could trigger an on-demand sync for the previous user and repopulate the freshly wiped cache with the wrong user's config. clearCache() now binds the new user atomically with the epoch bump, and on-demand reads sync for that bound identity rather than the potentially-stale cached ID. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3722 +/- ##
=======================================
Coverage 80.48% 80.48%
=======================================
Files 403 403
Lines 16717 16718 +1
Branches 2386 2386
=======================================
+ Hits 13455 13456 +1
Misses 2322 2322
Partials 940 940 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On an identity change,
IdentityManagerwiped remote config before caching the new app user ID. A coldtopic()/blobData()read racing that change could trigger an on-demand sync for the previous user and, because that request starts after the cache is wiped, persist the wrong user's config into the new user's freshly-wiped cache and return it. This violates the offerings-parity invariantclearCache()exists to protect (config must never bleed across users).The path is currently latent (the
topic()/blobData()facade has no production callers yet), but it's a landmine for the first consumer.Fix
clearCache()now binds the incoming app user to the drop-epoch atomically, and cold on-demand reads sync for that bound identity rather than the potentially-stale cached ID.