fix(passkeys): build signin metricsContext from flowQueryParams#20818
Draft
vpomerleau wants to merge 1 commit into
Draft
fix(passkeys): build signin metricsContext from flowQueryParams#20818vpomerleau wants to merge 1 commit into
vpomerleau wants to merge 1 commit into
Conversation
Because: - The passkey sign-in ceremony built its metricsContext from a live location.search read, which can drop flow params the SPA strips after page load. The server login.complete (reason=passkey) then carried a flow_id that no longer matched the client passkey metrics, so the events failed to join and passkey sign-in conversion was unmeasurable. This commit: - Sources the passkey metricsContext from the flowQueryParams snapshot App froze at load and feeds to Glean, mirroring SigninPasskeyFallback, so the server flow_id matches the client passkey metrics. - Threads flowQueryParams through usePasskeySignIn and its four callers. - Adds a regression test asserting metricsContext is built from flowQueryParams, not the live location.search. Closes #FXA-14093
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.
Because
location.searchread, which the SPA can strip of flow params after page load. The resulting serverlogin.complete(reason=passkey) then carried aflow_idthat no longer matched the clientpasskey.auth_success, so the two events failed to join in analytics.This pull request
metricsContextfrom the frozenflowQueryParamssnapshot the app captures at load and feeds to Glean, inpackages/fxa-settings/src/lib/passkeys/signin-flow.ts, so the serverlogin.completeflow_id matches the client passkey metrics. This mirrors the existingSigninPasskeyFallbackpattern.flowQueryParamsthroughusePasskeySignInand its four callers (Index,Signin,SigninAlternativeAuthOptions,SigninPasswordlessCode), keeping the livelocation.searchqueryParamsfor post-signin navigation.metricsContextis built fromflowQueryParams, not the livelocation.search.Issue that this pull request solves
Closes: FXA-14093
Checklist
Put an
xin the boxes that applyHow to review (Optional)
Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
Any other information that is important to this pull request.