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
{{ message }}
Repository navigation
Commit 72091ac
Browse filesBrowse the repository at this point in the historyBrowse files
feat(auth): recovery and undo links open their pages (#196)
#180 mails recovery links to `/recover#token=…` and undo links to
`/recover/undo#recovery=…`, but no page served them: `user recover` even
warned that the link "opens a page that is not available yet". An owner
also had no way to see a recovery of their account, or to undo it,
without asking support.
This adds those pages to auth, and asks every session about a recovery
that can still be undone.
Stacked on #161 (connected apps in settings) in GitHub stack #200: both
merge together.
## How
- **`/recover`** takes the link's token from the fragment, the way email
verification does. It never reads the token on `GET`, since mail
scanners open links.
- The form's post reads the recovery in-process, then shows the account
and what the probation restricts before any passkey is made.
- A new `data-passkey-recover` hook runs the ceremony. The token rides
in the form's attribute, so the form's own post never sends it again,
and a reload is a `GET`.
- **`/recover/undo`** works signed out, from the recovery's ID.
- It explains what undoing takes back: the recovery's passkey, every
device, and every app's access. While the link is unused, undoing only
cancels it, and the page says the full undo applies if the link gets
used first.
- With no passkey from before the recovery, it says only Piquel support
can undo it, and offers no button.
- A new `data-passkey-undo` hook runs the ceremony with an older
passkey. The finish's `signed_in` picks the answer: the settings with a
notice, or a page saying the disabled account stays disabled.
- Signed in, the page also offers the session's own recovery, but a
link's fragment wins.
- **"Was this you?"** appears on every settings and developer console
page while a recovery can be undone.
- "Yes, it was me" hides it for that session and stage, so a "Yes" while
the link is unused still asks once it's used. The browser's
`localStorage` holds the answer. Without storage, the question shows on
every page.
- A notice that no answer hides explains the probation up front: until
`settles_at`, the recovery's passkey confirms nothing.
- A passkey sign-in that continues to an app asks the same question
first. Its "continue" link goes on through `/oauth/authorize/resume`,
which also returns #180's `unmet_authentication_requirements` to the
client.
- **The recovery's passkey is never named by its name**, since whoever
used the link can rename it. The passkey list marks it "The recovery's
passkey" with the time it was added and its ID, and offers no rename.
The history uses the same words. No other passkey can be removed until
the recovery settles.
- **The sign-in step** offers "Sign out" when the browser is signed in,
so #180's "Sign out first" answer can be acted on.
- **Pages get views, not internals.** The recovery service gains
`RecoveryNotice`, a projection that carries no passkey names, read by
session (`recovery_notice`) or by ID, signed out (`undoable_recovery`).
- **No probation length is written as a number:** the pages read it from
`PROBATION` or `settles_at`.
## Tests
- **Rust** (`web/recovery/tests.rs`):
- the recovery link page: bad token, good token, and the token never
re-sent;
- the undo page: by ID, open or in probation, with no older passkey,
unknown, signed in, and signed in to another account;
- the settings frame: the banner's keys per stage and session, the
notices, the passkey list's naming, its rename guard and its disabled
removals, and the history's hold-back;
- the after-sign-in prompt for apps.
- **Service:** the two reads (open, probation, settled, unknown,
disabled).
- **Browser:** `recovery.spec.ts`:
1. Starts a recovery through `E2E_RECOVER`.
2. Uses the link in a second browser.
3. Has the owner undo it from the first browser, after the banner.
It's skipped without `E2E_RECOVER`.
- **On this PR's preview,** all six browser specs pass,
`recovery.spec.ts` included.
## Review
- **Claude:** one multi-agent round, with six finders, two verifiers per
finding and a critic. All 16 confirmed findings are fixed. Of the 5
plausible ones, the 4 that held up are fixed too. The fifth, a "Yes" in
the link holder's session hiding the question from the owner, is
handled: the dismissal now also depends on whether a passkey confirmed
the session.
- **GPT 6.1 Sol:** one round, three findings, all fixed: the undo
outcome, a stale cancel page, and the banner without storage.
- **After the PR opened,** review-loop ran: two rounds, each with three
GPT 6.1 Sol reviewers and one Claude Opus 5.5 reviewer. In round 1 all
four approved. One nit is fixed: a hand-made `?remove=` link no longer
opens the removal of a passkey that can't be removed. Five nits are
declined:
- the service keeps its own recovery view, as the visibility audit
asked;
- the README states the policy's 15 days, and only page text avoids the
number;
- "a passkey sign-in" is accurate, since linking also needs a passkey;
- one extra read on `/login`;
- the banner needs scripts, as undoing does.
In round 2 all four approved the fix.
- **After stacking on #161,** review-loop ran again on both PRs: two
rounds, each with three GPT 6.1 Sol reviewers and one Claude Opus 5.5
reviewer, on xhigh. Three fixes:
- The banner reads the session through `Owner`: `session_id()` and
`was_passkey_confirmed()`, not the repository's `StoredSession`. Three
older callers use `Owner::session_id()` too.
- The undo's answer decides on `signed_in` alone: an undo that signed
the browser in always goes on to the settings.
- The probation note says no passkey can be removed when the recovery's
passkey is gone, or is the only one.
Four suggestions are declined:
- the "Added" date on every row;
- `lenient_or_default`: a plain bool can't decode the form's text;
- a rewrite of the CLI help;
- extra assertions on the verify page.
In round 2 all four approved.
Reviewed with review-loop: 2 rounds with 3× GPT 6.1 Sol and Claude Opus
5.5 on high. Verdict: approved
Reviewed again with review-loop after stacking on #161: 2 rounds with 3×
GPT 6.1 Sol and Claude Opus 5.5, on xhigh. Verdict: approved
> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus
5.5 subagents and GPT 6.1 Sol (via T3 Code)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Recovery pages and flows
- Added server-rendered `/recover` and `/recover/undo` pages. The
recovery page reads the token from the URL fragment and does not include
it in the form post.
- Added passkey enrollment through the recovery ceremony. The undo page
supports signed-out access and explains what undoing or cancelling a
recovery changes.
- The undo page offers a passkey ceremony only when the owner has an
older passkey available. It reports whether the ceremony signed in the
browser.
- Added recovery data for open and probation stages, including
expiration, settlement, and recovered-passkey details. Recovery lookup
now treats missing or no-longer-undoable recoveries as unavailable to
the undo flow.
## Recovery notices and sign-in
- Added recovery notices to account and settings pages, including the
developer console. Notices reflect the recovery stage and session
confirmation state, and support dismissal.
- Added prompts during qualifying passkey sign-ins to apps. The prompt
lets the owner continue authorization or open the undo page.
- Sign-in pages now identify an account already signed in to the browser
and offer a sign-out option.
- Added undo recovery links and stage-specific information to
recovery-related page views.
## Passkey settings and history
- Settings now identify the passkey added during recovery and show its
enrollment time.
- Removal is unavailable when it would remove the passkey that the
active recovery keeps. Recovery state also updates passkey history
descriptions and removal options.
- Passkey creation now shares form and ceremony logic across recovery
and settings flows. Android-specific passkey-kind selection remains
available through the shared form.
## Shared UI and browser behavior
- Added shared recovery page, banner, prompt, and form types in
`crates/ui`.
- Added fragment-based forms for emailed-link tokens and dismissible
elements backed by local storage when available.
- Updated recovery route registration, page titles, account layout, and
architecture documentation.
## Tests
- Added Rust integration tests for recovery pages, undo behavior,
settings, and app sign-in prompts. These tests require
`TEST_DATABASE_URL`.
- Added an opt-in browser recovery test. It runs only when `E2E_RECOVER`
is set.
- The supplied summary reports that the author ran six browser specs on
the PR preview. No test-run results are independently available here.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments