Skip to content

fix(settings): add fallback text to webauthn error mapping and clarify field names#20417

Open
vpomerleau wants to merge 1 commit intomainfrom
FXA-12912-add-fallback-text
Open

fix(settings): add fallback text to webauthn error mapping and clarify field names#20417
vpomerleau wants to merge 1 commit intomainfrom
FXA-12912-add-fallback-text

Conversation

@vpomerleau
Copy link
Copy Markdown
Contributor

Because

  • The error map only stored FTL keys, leaving callers without a single source of truth for fallbacks
  • Field names (messageKeys, userMessageKey) were ambiguous

This pull request

  • Renames messageKeys → ftlId and userMessageKey → ftlId on ErrorEntry and CategorizedWebAuthnError
  • Adds fallbackText field with English strings matching the FTL file exactly
  • Extracts UNEXPECTED_FALLBACK and UNEXPECTED_FTL_ID constants to eliminate duplication
  • Updates tests with fallbackText assertions across all error categories

Issue that this pull request solves

Issue: FXA-12912

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.

Copilot AI review requested due to automatic review settings April 21, 2026 06:25
@vpomerleau vpomerleau requested a review from a team as a code owner April 21, 2026 06:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the passkeys WebAuthn error mapping in fxa-settings to make localization usage clearer and to provide a single source of truth for both Fluent IDs and English fallback strings.

Changes:

  • Renames the error message identifier fields to ftlId (from messageKeys / userMessageKey) for clearer semantics.
  • Adds fallbackText (English) alongside each FTL ID in the WebAuthn error map.
  • Refactors unexpected-error defaults into shared constants and updates tests to include fallback-related assertions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/fxa-settings/src/lib/passkeys/webauthn-errors.ts Renames message key fields, adds per-operation fallbackText, and introduces shared unexpected-error constants.
packages/fxa-settings/src/lib/passkeys/webauthn-errors.test.ts Updates assertions to use ftlId and adds coverage for fallbackText.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +165 to +166
ftlId: UNEXPECTED_FTL_ID,
fallbackText: UNEXPECTED_FALLBACK,
Comment on lines +33 to +35
expect(result.ftlId).toContain(operation);
expect(result.ftlId).toMatch(/passkey-.+-error-.+/);
expect(result.fallbackText).toMatch(/passkey/i);
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.

2 participants