eidCache: make mergeCache take and return cache format - #344
Merged
Merged
Conversation
mosherBT
force-pushed
the
refs-source-keyed
branch
from
September 16, 2026 20:07
f4dceb4 to
3513233
Compare
mosherBT
marked this pull request as ready for review
September 16, 2026 20:36
etiennelatendresse-optable
approved these changes
Sep 16, 2026
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
The cache and the wire disagree on how
refsis keyed, andmergeCacheonly understood the wire. Handed a cache which is what a wrapper has aftersetTargetingoverwrote its key it found noext.optable.refpointer, dropped every ref, and returned an emptystaleUid2s. UID2 then never refreshes, with no error.Related to #333 WIP PR
What Changed
The wire format is unchanged everywhere. Conversion happens at the cache.
mergeCachetakes and returns cache format on both arguments, readingrefs[source]instead of following a pointer. A cache read back from storage merges as-is; a wire response goes throughreplaceCachefirst.replaceCacheis idempotent. It wasn't: given a value with no pointers left it resolved against pointers that were gone and returned{}, wiping the refs. That made it unsafe to apply defensively.resolveRefslets the last EID for a source win, matching which EIDmergeCachekeeps, so a source listed twice cannot end up holding the other EID's refresh material.Example flow:
Response from targeting1
Stored in local storage this format:
Then on another page load with cache as above and targeting like this:
before we relied on the pointer returning the cache back so end up with this in cache
Now using
getRefDatawe getHow to Test
Unit tests cover the cache-read-back round trip that previously lost refs,
replaceCacheidempotency, and the existing duplicate-source pairing rule.Notes