Skip to content

fix(settings): skip redundant set-password account-status check#20719

Merged
vpomerleau merged 1 commit into
mainfrom
FXA-13937-skip-setpassword-check
Jun 11, 2026
Merged

fix(settings): skip redundant set-password account-status check#20719
vpomerleau merged 1 commit into
mainfrom
FXA-13937-skip-setpassword-check

Conversation

@vpomerleau

@vpomerleau vpomerleau commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Because

  • The post-verify set-password page blocked first paint on a blocking accountStatus round-trip, which intermittently exceeded the stage smoke test's 10s assertion and flaked passkeySetPassword.spec.ts.
  • Every in-app flow that routes to this page (passkey, OTP, third-party) does so only for passwordless accounts, so re-deriving the password state with a network call is redundant.

This pull request

  • Gates the accountStatus check on router state in packages/fxa-settings/src/pages/PostVerify/SetPassword/container.tsx: when the page is reached via a forward flow (location.state.passwordCreationReason is set), it paints immediately without the round-trip.
  • Keeps the check for stateless arrivals (refresh / direct URL / back), where a password may already exist and a redirect to /signin is still wanted.
  • Simplifies the check effect to a flat then/catch, resolves the stale retry TODO, and corrects the inaccurate "third-party may have a password" comment.
  • Adds container tests covering the gating: skip when state-routed, run on stateless arrival, and fail open when the check errors.

Issue that this pull request solves

Closes: FXA-13937

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)

Known pre-existing limitation (out of scope): on a stateless arrival where the accountStatus check itself fails and the account already has a password, the page falls through to the form and /password/create rejects server-side with a "password already set" banner instead of redirecting to /signin. This requires a rare triple-coincidence and is a candidate for a follow-up.

@vpomerleau vpomerleau marked this pull request as ready for review June 9, 2026 23:36
@vpomerleau vpomerleau requested a review from a team as a code owner June 9, 2026 23:36
Copilot AI review requested due to automatic review settings June 9, 2026 23:36

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.

Pull request overview

This PR reduces first-paint latency (and stage smoke-test flakes) on the PostVerify Set Password page by skipping a redundant accountStatus round-trip when the page is reached via known forward flows that already imply a passwordless account.

Changes:

  • Gate the blocking accountStatus check based on presence of router state to allow immediate render for forward flows.
  • Simplify the accountStatus effect logic (flat then/catch) and update the related inline comment.
  • Add tests to validate when the accountStatus check is skipped vs executed, including fail-open behavior on errors.

Reviewed changes

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

File Description
packages/fxa-settings/src/pages/PostVerify/SetPassword/container.tsx Skips blocking accountStatus check for state-routed forward flows to improve first paint; keeps redirect behavior for password-present cases.
packages/fxa-settings/src/pages/PostVerify/SetPassword/container.test.tsx Adds unit tests covering the new gating behavior for accountStatus, including skip/run/error paths.

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

Comment thread packages/fxa-settings/src/pages/PostVerify/SetPassword/container.tsx Outdated

@vbudhram vbudhram 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.

@vpomerleau I didn't manually test this but code seems low risk and resonable.

@vpomerleau vpomerleau force-pushed the FXA-13937-skip-setpassword-check branch 2 times, most recently from 8dde7c5 to 876f8e0 Compare June 10, 2026 19:15
…rward flows

Because:
- The post-verify set-password page blocked first paint on an accountStatus
  round-trip, intermittently exceeding the stage smoke test's 10s assertion
  and flaking passkeySetPassword.spec.ts.
- The page only ever serves passwordless accounts, and the forward flows
  already know that, so the round-trip is redundant for them.

This commit:
- Trusts the account's stored password state instead of the blocking round-trip:
  renders for a passwordless account, redirects to /signin when one exists, and
  falls back to a one-time accountStatus check only when it is unknown
  (third-party sign-in, or a stale/direct arrival).
- Records hasPassword in the flows that establish it as fact: passwordless OTP
  with or without TOTP (passkey already did). Third-party defers to the check.
- Replaces the set-password history entry on completion so Back cannot return
  to it; flattens the check effect and drops the stale retry TODO and comment.
- Adds container, handleNavigation, and SigninTotpCode tests.

Closes #FXA-13937
@vpomerleau vpomerleau force-pushed the FXA-13937-skip-setpassword-check branch from 876f8e0 to 246f258 Compare June 10, 2026 19:25
@vpomerleau vpomerleau requested a review from vbudhram June 10, 2026 19:28
@vpomerleau

Copy link
Copy Markdown
Contributor Author

@vbudhram I made some changes based on the copilot comments - would you mind having another that this still looks good?

@vpomerleau vpomerleau merged commit 65a63c6 into main Jun 11, 2026
21 checks passed
@vpomerleau vpomerleau deleted the FXA-13937-skip-setpassword-check branch June 11, 2026 21:02
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.

3 participants