You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(auth-service): hide Resend on OTP screen when sign-in cannot recover
Previously the OTP screen always offered "Resend code", even when the
upstream PAR row had silently lapsed (suspended tab, mobile background,
heartbeat throttling). The user could click Resend, receive a fresh
email, type the new code, and only then see "Sign in failed" — wasting
their time on a code that could not have worked.
The screen now never surfaces actions that cannot complete the flow:
- Track lastSuccessfulHeartbeatAt; treat the PAR as dead once we cross
upstream's 5 min AUTHORIZATION_INACTIVITY_TIMEOUT without a fresh ok
ping (the upstream death point is exact — no margin needed).
- Hide #btn-resend and surface a #btn-start-over (→ /auth/abort) the
moment parLikelyDead() flips. Reconciled on every heartbeat tick
(including transient ticks, so a stale-by-time case still hides the
button) and on the visibilitychange event (so a backgrounded tab
returning to focus reflects reality immediately).
- Inline "Send a new code" action on the OTP-expired error now branches:
parLikelyDead() → "Start over"; otherwise existing "Send a new code".
This is the proactive UI complement to the existing reactive abort gate.
Server-side enforcement of the same invariant on /email-otp/send-
verification-otp and /sign-in/email-otp is a separate follow-up.
Test: new @resend-hidden-when-par-dead scenario; full
@otp-and-par-expiry / @par-heartbeat / @resend-after-par-dead /
@otp-expiry suite still passes (7 scenarios, 78 steps).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hide the "Resend code" button on the OTP screen when the sign-in can no longer be recovered, and offer "Start over" instead. Previously, a user who left the OTP screen open long enough for the underlying sign-in window to lapse could click "Resend code", receive a fresh email, type the new code, and only then see "Sign in failed" — wasting their time on a code that could not have worked. The screen now only ever offers actions that can actually complete the sign-in.
0 commit comments