Skip to content

fix(mfa): keep email enrollment errors on the email screen - #38061

Merged
roz0n merged 1 commit into
mainfrom
fix/TRAM-4180_email-enrollment-error
Oct 22, 2026
Merged

roz0n merged 1 commit into
mainfrom
fix/TRAM-4180_email-enrollment-error

Conversation

@roz0n

@roz0n roz0n commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

Continue on the email verification screen was opening the code screen before POST /api/v2/mfa/enroll finished. When that call failed, the code screen said a code had been sent and offered "Resend code".

The email screen now stays up until a code is actually sent. A failed enrollment shows "Something went wrong. Try again." under the email field, the same error treatment the code screen uses. The address the user typed stays in the field.

Changelog

CHANGELOG entry: Fixed a failed email enrollment opening the code screen before a code was sent

Related issues

Refs: TRAM-4180

Manual testing steps

Feature: email enrollment failure

  Scenario: enrollment fails
    Given the user is on the email verification screen
    When they enter a valid email and press Continue
    And POST /api/v2/mfa/enroll fails
    Then they stay on the email verification screen
    And they see "Something went wrong. Try again." under the email field
    And they do not see "We sent a 6-digit code"

  Scenario: enrollment succeeds
    Given the user is on the email verification screen
    When they enter a valid email and press Continue
    And POST /api/v2/mfa/enroll succeeds
    Then they see the verification code screen
    And the description says a 6-digit code was sent

Screenshots/Recordings

Before

A valid email is entered and Continue is pressed. The app opens the code screen while POST /api/v2/mfa/enroll is still in flight. When that request fails, the code screen still says a 6-digit code was sent and offers "Resend code", even though no code was ever sent.

tram-4180-before.mp4

After

A valid email is entered and Continue is pressed. POST /api/v2/mfa/enroll fails, and the email screen stays up. The address remains in the field, which turns red, and "Something went wrong. Try again." appears under it. The code screen opens only after that request succeeds.

Screen.Recording.iPhone.17.Pro.10-22-2026.at.12.45.26.PM.mp4

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Made with Cursor


Note

Medium Risk
Changes MFA enrollment step ordering and error surfacing in a user-facing auth flow; scope is narrow but incorrect handling could block or mislead users during email setup.

Reviewed by Cursor Bugbot for commit f1c21c9. Bugbot is set up for automated code reviews on this repo. Configure here.

A failed enroll was opening the code screen and saying a code had been sent.

Co-authored-by: Cursor <cursoragent@cursor.com>
@roz0n roz0n self-assigned this Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions Bot added size-S pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels Oct 22, 2026
@metamask-ci metamask-ci Bot added the team-money-movement issues related to Money Movement features label Oct 22, 2026
@roz0n
roz0n marked this pull request as ready for review October 22, 2026 16:47
@roz0n
roz0n requested a review from a team as a code owner October 22, 2026 16:47
@roz0n
roz0n enabled auto-merge October 22, 2026 16:52
@roz0n roz0n removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Oct 22, 2026
@roz0n
roz0n requested a review from georgeweiler October 22, 2026 16:59
@github-actions

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

AI Confidence: 90

E2E reasoning

Expand to read

This PR contains:

  1. A bug fix in app/util/identity/mfa/engine/flow.ts — changes the order of operations in submitEmailAddress so the OTP screen is only shown after beginCodeChallenge() succeeds. If enrollment fails, the user stays on the email entry screen with an error state. This is a targeted fix with a very limited blast radius.
  2. Two new unit/component tests covering the bug fix behavior.

The MFA flow is part of the identity/seedless onboarding system, but:

  • No E2E smoke specs exist specifically for MFA credential enrollment flows
  • The SmokeSeedlessOnboarding tag covers OAuth onboarding, QR sync, lock/unlock — not MFA email enrollment error handling
  • The changes are purely additive (new tests) plus a targeted bug fix in a non-shared utility
  • No Redux state, navigation, shared components, or critical infrastructure is modified
  • The fix only affects the error path (when beginCredentialEnrollment rejects), not the happy path
  • No performance-sensitive code is touched

Given the narrow scope of the fix (MFA email enrollment error handling) and the fact that no existing E2E smoke tests cover this specific flow, running zero E2E tags is appropriate. The changes are validated by the new unit and component tests added in this PR.

Performance reasoning

Expand to read

No performance-sensitive code paths are modified. The changes are limited to MFA flow error handling logic and test additions. No rendering, state management, asset loading, or app launch paths are affected.

View run

@sonarqubecloud

Copy link
Copy Markdown

@roz0n
roz0n added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 425ed4c Oct 22, 2026
248 of 250 checks passed
@roz0n
roz0n deleted the fix/TRAM-4180_email-enrollment-error branch October 22, 2026 22:42
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2026
@metamask-ci metamask-ci Bot added the release-8.19.0 Issue or pull request that will be included in release 8.19.0 label Oct 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.19.0 Issue or pull request that will be included in release 8.19.0 size-S team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants