Skip to content

fix(settings): show "Passkey limit reached" alert (FXA-13680)#20532

Open
dschom wants to merge 1 commit intomainfrom
worktree-FXA-13680
Open

fix(settings): show "Passkey limit reached" alert (FXA-13680)#20532
dschom wants to merge 1 commit intomainfrom
worktree-FXA-13680

Conversation

@dschom
Copy link
Copy Markdown
Contributor

@dschom dschom commented May 6, 2026

Because

  • When a user already at the max passkey limit attempted to register another passkey from a stale Settings session (e.g., a tab on a second device that hadn't refreshed), the auth-server correctly returned a 400 with errno 226 ("Maximum number of passkeys reached"), but PagePasskeyAdd ignored error.errno and rendered the generic "System not available. Try again later." alert — misleading users into thinking the service was down.

This pull request

  • Inspects error.errno in the PagePasskeyAdd server-error catch branch. Recognized errnos now render their existing localized AuthUiErrors message via getLocalizedErrorMessage (errno 226 → "Passkey limit reached"); unknown errors keep the previous generic-fallback + Sentry capture path.
  • Widens the Glean error reason to auth_error_<errno> for known auth-server errors so dashboards can distinguish them from true server_error.
  • Adds unit tests covering errno 226 from both beginPasskeyRegistration and completePasskeyRegistration; existing unknown-error tests continue to pass.
  • No new FTL strings or backend changes — auth-error-226 = Passkey limit reached and the PASSKEY_LIMIT_REACHED AuthUiErrors entry already existed.

Issue that this pull request solves

Closes: FXA-13680

Checklist

  • 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: packages/fxa-settings/src/components/Settings/PagePasskeyAdd/index.tsx (server-error branch).
  • Suggested review order: source change, then the two new tests in index.test.tsx.
  • Risky or complex parts: low risk — the fix is a guarded errno check that delegates to the existing getLocalizedErrorMessage helper used elsewhere in fxa-settings; all unknown errors retain the original behavior.

How to manually verify

  1. Locally set PASSKEYS__MAX_PASSKEYS_PER_USER=1 in auth-server config (or hit the real prod limit of 10).
  2. On Device A, register a passkey to reach the limit.
  3. On Device B with a stale Settings tab, click Create in the Passkeys row.
  4. Expect the alert to read "Passkey limit reached" instead of "System not available. Try again later."

🤖 Generated with Claude Code

Because:

- When a user already at the max passkey limit attempted to register
  another passkey from a stale Settings session (e.g., a tab on a
  second device), the auth-server correctly returned a 400 with
  errno 226 ("Maximum number of passkeys reached"), but the UI
  ignored the errno and rendered the generic "System not available.
  Try again later." alert, misleading users into thinking the
  service was down.

This commit:

- Inspects error.errno in the PagePasskeyAdd server-error catch
  branch. Recognized errnos now render their existing localized
  AuthUiErrors message via getLocalizedErrorMessage (errno 226 ->
  "Passkey limit reached"); unknown errors keep the previous
  generic-fallback + Sentry capture path.
- Widens the Glean error reason to auth_error_<errno> for known
  auth-server errors so dashboards can distinguish them from
  true server_error.
- Adds unit tests covering errno 226 from both
  beginPasskeyRegistration and completePasskeyRegistration; the
  existing unknown-error tests continue to pass.

Closes FXA-13680

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dschom dschom marked this pull request as ready for review May 7, 2026 21:27
@dschom dschom requested a review from a team as a code owner May 7, 2026 21:27
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