Skip to content

fix(platform): show a failed passkey list read with a retry - #4300

Merged
yannickmonney merged 3 commits into
mainfrom
fix/passkey-list-read-failure
Oct 4, 2026
Merged

yannickmonney merged 3 commits into
mainfrom
fix/passkey-list-read-failure

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What changed

When the passkey list read failed, Account → Passkeys looked exactly like a successful empty list: no rows, no notice, and Add a passkey right beside it (#3845). The cause was in passkey-section.tsx. It only read { data, isLoading }, and it drew rows only for passkeys.length > 0.

  • passkey-section.tsx now reads the list through readStateOf (app/lib/backend/read-state.ts) and reuses CatalogLoadError. This is the pattern the knowledge-entry history uses (Bug: failed knowledge-entry reads look like an empty library or missing history #3777).
    • List never answered: shows Couldn't load your passkeys. with Try again. No empty copy is shown and no rows are drawn. Add a passkey stays, because adding a passkey doesn't depend on the list.
    • Refresh failed: the passkeys already on screen stay, under Couldn't refresh your passkeys. The list shown may be out of date.
    • List answered empty: only then does the section say You haven't added a passkey yet. Nothing is claimed while the first read is still running.
    • Focus-safe retry: Try again stays mounted, busy and focusable (aria-busy/aria-disabled, not natively disabled) while its retry runs. This also holds for the app's errored-read refetch when the window regains focus. When the list comes back, the alert's focus handoff moves focus to the Passkeys section, which gets tabIndex={-1} as its target, never to the page body. If the read fails again, Try again keeps its node and its focus, and the failure is announced again.
  • Copy: twoFactor.passkeys.empty, errors.listFailed and errors.refreshFailed in EN/DE/FR. There's no ß, so no de-CH override is needed.
  • Manual layer: new AUTH-B16 box (block the list request in devtools), plus its reference/automation.md row.

How I verified it

  • New suite: passkey-section.read-failure.test.tsx uses the real react-query query and its four-attempt retry policy, a mocked Better Auth client, and the 2FA status over the synthetic transport. It has 14 tests, all passing on this branch.
  • Fails on main: I swapped in main's passkey-section.tsx and catalogs and ran the suite. 12 of 14 failed on their assertions (Unable to find role="alert" ×11, missing empty copy ×1). The 2 controls passed: listing a returned passkey, and claiming nothing while the first read runs.
  • Catches the B1 regression: I gated the alert on isError with no busy state. That fails exactly the 3 focus tests: busy and focused through a pressed retry, keeping focus when the retry fails again, and keeping focus when a background refresh fails again.
  • Existing tests: passkey-section.test.tsx passes 4/4. account-form.{name,password}.test.tsx pass, though the password file timed out once at 5 s when run alongside the other files on 2 workers. It passed 7/7 alone, and it mocks PasskeySection.
  • Account settings folder: all of app/features/settings/account on one worker: 9 files, 46/46 pass.
  • Commitlint: bunx commitlint --from origin/main --to HEAD passes all three commits.
  • Gates: lib/i18n/messages.test.ts (parity/usage) passes 24/24, and so do bun run lint:manual and check-guide.ts suites/auth.md. Type-aware oxlint on the changed files is clean, oxfmt reports no issues, and a tsc --noEmit scoped to the changed files and their imports exits 0.
  • Not run locally: a real-browser pass (there's no stack in this sandbox; the jsdom suite owns the behaviour, and AUTH-B16 is the manual half), the whole platform suite, and a whole-workspace tsc. CI runs those.

Closes #3845

Account settings rendered a passkey list read that failed exactly like a
successful empty one: no rows, no notice, and "Add a passkey" beside it,
so a user could conclude no passkey was registered (#3845).

The section now reads the list through `readStateOf`: a list that never
answered shows `CatalogLoadError` with Try again, a failed refresh keeps
the listed passkeys under a refresh notice, and only a list that
answered empty says there are none yet. Try again stays mounted, busy
and focusable through its retry; when the list comes back the focus
moves to the Passkeys section instead of the page body.

Adds the EN/DE/FR copy, the AUTH-B16 manual box with its automation
row, and a component suite on the real query and retry policy.

Closes #3845
The background re-failure case now waits for the re-keyed message, so it
checks Try again after the refresh settled rather than while it runs, and
the failed-refresh case checks that healing hands the focus to the
Passkeys section.
A request blocked in devtools rejects before Better Auth's own retries,
which only follow a non-OK answer, so the notice shows after react-query's
three retries: a few seconds, not the 40 s a 5xx answer takes.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent review — ACCEPT at exact head 882d3c13e99a6d8f5da27d68e4cc77373622c1ac

  • passkey-section.tsx uses readStateOf: an initial failed list is unavailable and renders CatalogLoadError with the localized Try again action, without empty copy or rows; a successful empty array alone renders the empty copy; a failed refresh retains cached rows and uses the refresh-failed message.
  • The retry remains mounted, focusable, and marked busy/aria-disabled while refetching. CatalogLoadError/useFocusHandoff preserves focus on repeated failure and hands focus to the focusable Passkeys section after recovery, rather than the body.
  • The added regression suite covers server-error and rejected-request failures, true empty, loading, cached refresh, retry/background focus behavior, re-announcement, accessibility, and EN/DE/FR. The author’s recorded differential evidence is 14/14 on this head, 12/14 assertions failing on main, and three focus tests failing with the isError-only mutant.
  • I independently inspected the exact-head diff, readStateOf, CatalogLoadError, useFocusHandoff, SettingsSection, locale keys, and manual AUTH-B16 documentation. The implementation matches TALE-277 / Bug: Account Passkeys hides a failed credential-list read as an empty list #3845; no blocking finding.

Unrun / observed limits: the focused Vitest command was attempted once at this exact head with one worker but test collection stopped before running tests because the standing checkout’s installed Zod runtime exposes z without number (packages/shared/src/schemas/epoch-ms.ts:19). I did not reinstall dependencies or rerun it. I did not run a real browser/visual pass, the full platform suite, or whole-workspace typecheck. CI was already queued at this head; I did not rerun or cancel it.

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.

Bug: Account Passkeys hides a failed credential-list read as an empty list

1 participant