Skip to content

fix(passkeys): build signin metricsContext from flowQueryParams#20818

Draft
vpomerleau wants to merge 1 commit into
mainfrom
FXA-14093
Draft

fix(passkeys): build signin metricsContext from flowQueryParams#20818
vpomerleau wants to merge 1 commit into
mainfrom
FXA-14093

Conversation

@vpomerleau

Copy link
Copy Markdown
Contributor

Because

  • Passkey sign-in conversion cannot be measured reliably: the ceremony built its metrics context from a live location.search read, which the SPA can strip of flow params after page load. The resulting server login.complete (reason=passkey) then carried a flow_id that no longer matched the client passkey.auth_success, so the two events failed to join in analytics.

This pull request

  • Sources the passkey metricsContext from the frozen flowQueryParams snapshot the app captures at load and feeds to Glean, in packages/fxa-settings/src/lib/passkeys/signin-flow.ts, so the server login.complete flow_id matches the client passkey metrics. This mirrors the existing SigninPasskeyFallback pattern.
  • Threads flowQueryParams through usePasskeySignIn and its four callers (Index, Signin, SigninAlternativeAuthOptions, SigninPasswordlessCode), keeping the live location.search queryParams for post-signin navigation.
  • Adds a regression test asserting metricsContext is built from flowQueryParams, not the live location.search.

Issue that this pull request solves

Closes: FXA-14093

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

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.

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
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