fix(sdk): migrate host-scoped visitor cookie when domain is set#358
Draft
nicklasl wants to merge 3 commits into
Draft
fix(sdk): migrate host-scoped visitor cookie when domain is set#358nicklasl wants to merge 3 commits into
nicklasl wants to merge 3 commits into
Conversation
Uses CookieStore API to detect and preserve existing domain cookies during subdomain migration, preventing visitor ID flip-flop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Host-only cookies have domain=null in the CookieStore API. Delete them by name only, not by domain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
cnfdVisitorIdcookies whendomainis configuredContext
Follow-up to #356. When a user has host-scoped cookies on multiple subdomains (e.g.
visitorId=xona.acme.comandvisitorId=yonb.acme.com), the legacydocument.cookieAPI can't distinguish host vs domain cookies — whichever subdomain is visited last overwrites the domain cookie. CookieStore'sgetAll()returns domain info, letting us preserve the first-set domain value.Test plan
yarn buildpassesyarn test— 168 tests pass (8 new for visitorId)yarn format:checkcleanyarn bundle— API report unchanged🤖 Generated with Claude Code