Skip to content

fix(mosaic): preserve OTP preparation state during navigation - #10564

Open
austincalvelage wants to merge 5 commits into
mainfrom
austin/core-4063-preserve-otp-preparation-failure-after-opening-the-method
Open

austincalvelage wants to merge 5 commits into
mainfrom
austin/core-4063-preserve-otp-preparation-failure-after-opening-the-method

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Description

Opening the method picker while a verification code was being sent discarded the eventual send result. Returning with Back could hide a delivery failure and leave Resend disabled, or allow verification to submit before preparation finished.

Keep preparation active while navigating between code entry, the method picker, and help. Back preserves the send result and cooldown without sending another code. Failed delivery shows the error and allows immediate resend. Cancellation and selecting a different method discard stale results.

Clear test authentication cookies when browser test iframes unload, preventing stale cookies from causing HTTP 431 failures in subsequent test files.

Fixes CORE-4063. Reusing preparation after selecting another method is separate follow-up work in CORE-4065.

Checklist

  • pnpm test runs as expected for the affected flow. Feature and browser suites pass; live Chrome checks confirmed preserved failures, cooldowns, and no extra preparation requests during navigation.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot

changeset-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 470b146

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/mosaic Patch
@clerk/swingset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Oct 31, 2026 4:34pm UTC
swingset Ready Ready Preview Oct 31, 2026 4:34pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 470b146 and 470b146.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between b5803ea and 470b146.

Files selected for processing: 5
  • .changeset/fresh-otp-preparation.md
  • packages/mosaic/src/__tests__/feature/fake-fapi-isolation.feature.test.tsx
  • packages/mosaic/src/features/reverification/__tests__/reverification.feature.test.tsx
  • packages/mosaic/src/features/reverification/reverification.controller.ts
  • packages/mosaic/vitest.setup.browser.mts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Walkthrough

The reverification controller now uses an overlay stack for method-picker and help navigation. It gates submission and resend while overlays are open, and clears overlays after preparation completes or the challenge becomes inactive. New tests cover navigation during preparation and late results. Browser test setup also clears cookies on pagehide, with a test for cookie state around that event.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: ephem, alexcarpenter

Merge Risk: Minimal · up to 470b1

Preparation results remain isolated when a user changes methods. No issue identified here prevents merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preserving OTP preparation state during navigation.
Description check Passed The description directly explains the OTP preparation fix, its navigation behavior, test-cookie cleanup, linked issue, and validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10564

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10564

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10564

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10564

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10564

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10564

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10564

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10564

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10564

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10564

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10564

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10564

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10564

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10564

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10564

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10564

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10564

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10564

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10564

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10564

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10564

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10564

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10564

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10564

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10564

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10564

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10564

commit: 470b146

…stack

Replace the methodPicker and help states with an overlay stack in context,
so navigating away from a factor never leaves preparing or verifying. Move the
preparation navigation tests into the feature suite.
@austincalvelage austincalvelage changed the title fix(mosaic): preserve OTP preparation across method navigation fix(mosaic): preserve OTP preparation state during navigation Oct 31, 2026
@austincalvelage
austincalvelage marked this pull request as ready for review October 31, 2026 16:32

This branch was successfully deployed

2 active deployments
Preview – swingset — 470b1467 Deployed Oct 31, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 470b1467 Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant