Skip to content

fix(settings): show blocked error on the passwordless email form - #21260

Merged
toufali merged 1 commit into
mainfrom
fxa-13688
Sep 23, 2026
Merged

toufali merged 1 commit into
mainfrom
fxa-13688

Conversation

@vbudhram

@vbudhram vbudhram commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Because

  • The email form sent the user to the code page before it asked for a code. The code page then sent the first code on mount.
  • An admin blocklist hit (REQUEST_BLOCKED, errno 125) left the user on the code page with no code and no way forward.
  • Every passwordless test used an existing account, so the new account branch had no coverage.

This pull request

  • Sends the first passwordless code from the Index container before it navigates, and passes codeSent: true so the code page skips its mount send.
  • Rethrows REQUEST_BLOCKED into the existing handleEmailSubmissionError path, so the banner shows on the email form and the flow stays there.
  • Returns false for any other send failure, so the flow navigates and the code page sends again and reports the error.
  • Moves GleanMetrics.emailFirst.submitSuccess after handleSuccessNavigation, so a blocked send records submitFail only.
  • Adds two container tests for the new account branch. One test covers a good send, the other covers a blocked send.

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13688

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: src/pages/Index/container.tsx and src/pages/Index/container.test.tsx.
  • Suggested review order: read sendPasswordlessCode and goToPasswordlessCode first, then the new tests.
  • Risky or complex parts: the codeSent flag that SigninPasswordlessCode reads, and the order of the Glean events.

Screenshots (Optional)

Other information (Optional)

  • node scripts/test.js --testPathPattern "src/pages/Index": 54 passed, 0 failed.
  • npx nx lint fxa-settings: exit 0.

Copilot AI balanced review requested due to automatic review settings September 18, 2026 20:48
@vbudhram vbudhram added the auto label Sep 18, 2026
@vbudhram
vbudhram requested a review from a team as a code owner September 18, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The blocked-send test does not verify the intended success/failure telemetry behavior.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Pre-sends passwordless OTPs so blocked requests remain on the email form.

Changes:

  • Sends OTP before passwordless navigation and passes codeSent.
  • Handles blocked sends through the existing error banner.
  • Updates related navigation and error tests.
File summaries
File Description
pages/Index/container.tsx Adds pre-navigation OTP sending and telemetry ordering.
pages/Index/container.test.tsx Tests successful, failed, and blocked sends.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/fxa-settings/src/pages/Index/container.test.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new-account passwordless success and blocked-error paths lack focused unit coverage.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

isSignup: true,
},
});
await goToPasswordlessCode({ isSignup: true });
## Because

- The email form sent the user to the code page before it asked for a code. The code page then sent the first code on mount.
- An admin blocklist hit (`REQUEST_BLOCKED`, errno 125) left the user on the code page with no code and no way forward.
- Every passwordless test used an existing account, so the new account branch had no coverage.

## This pull request

- Sends the first passwordless code from the Index container before it navigates, and passes `codeSent: true` so the code page skips its mount send.
- Rethrows `REQUEST_BLOCKED` into the existing `handleEmailSubmissionError` path, so the banner shows on the email form and the flow stays there.
- Returns false for any other send failure, so the flow navigates and the code page sends again and reports the error.
- Moves `GleanMetrics.emailFirst.submitSuccess` after `handleSuccessNavigation`, so a blocked send records `submitFail` only.
- Adds two container tests for the new account branch. One test covers a good send, the other covers a blocked send.

## Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13688

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Retrying every non-blocked send failure can invalidate an already-emailed OTP and duplicate rate-limit usage.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)

Comment on lines +175 to +179
} catch (error: any) {
if (error.errno === AuthUiErrors.REQUEST_BLOCKED.errno) {
throw error;
}
return false;

@vbudhram vbudhram left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Low risk change with good coverage, 👍🏽

@toufali
toufali merged commit e79192e into main Sep 23, 2026
22 checks passed
@toufali
toufali deleted the fxa-13688 branch September 23, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants