Skip to content

refactor(admin): invitations and recoveries each say where they stand in one place - #686

Draft
PiquelChips wants to merge 2 commits into
refactor/544-decision-admin-viewsfrom
refactor/544-decision-standings
Draft

PiquelChips wants to merge 2 commits into
refactor/544-decision-admin-viewsfrom
refactor/544-decision-standings

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Part of #544 (NEW-1's follow-up). Stacked on #681, since the recovery standing goes on the admin::Recovery that #681 adds.

Two more states were worked out in several places:

  • Whether an invitation can still be used: the dashboard's invitations page (open, plus an expiry check for resending), the UI's badge (redeemed, revoked, expired, open), and the SQL that finds and redeems an invitation.
  • Why a recovery ended (undone, cancelled or expired): the CLI's recovery table and the dashboard's recovery list each matched RecoveryState::Ended against undone_at and cancelled_at themselves.

Now each has one rule in sourceorigin_common::admin:

  • Invitation::state(now) returns InvitationState (Redeemed, Revoked, Expired, Open).
    • The badge matches it exhaustively.
    • The page offers resending only while it is Open (and mailed, with email on), and revoking while it is Open or Expired, exactly as before.
    • The SQL stays: it is the database's atomic check, and the type's doc names it as the same rule.
  • Recovery::standing() returns RecoveryStanding (Unused, Probation, Settled, Undone, Cancelled, Expired). This replaces sourceorigin-ui's own RecoveryStanding. The CLI and the dashboard both match on it.

None of the copies disagreed, so there is no behaviour fix here.

Visible changes

  • sourceorigin-common public API: new admin::{InvitationState, RecoveryStanding}, admin::Invitation::state and admin::Recovery::standing. cargo semver-checks passes.
  • Pages and CLI output: no change.

Docs

docs/dev/security/account-recovery.md says, under its States table, that admin::Recovery::standing is the one place that splits an ended recovery into undone, cancelled and expired, for the CLI and the dashboard.

How I checked nothing else changed

Tests

  • New: an_invitation_state_takes_the_first_that_applies and an_ended_recovery_says_why. No test was removed.

No files outside this lane were edited.

Note

Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)

@PiquelChips PiquelChips added admin The admin dashboard at admin.sourceorigin.dev refactor No behviour changes labels Nov 22, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

… once

`admin::Invitation::state(now)` replaces the dashboard's and the UI's
copies of whether an invitation is redeemed, revoked, expired or open,
and `admin::Recovery::standing()` replaces the CLI's and the
dashboard's split of an ended recovery into undone, cancelled and
expired, and the UI's own `RecoveryStanding`.
@PiquelChips
PiquelChips force-pushed the refactor/544-decision-standings branch from 5cb0e22 to 0cca714 Compare November 22, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admin The admin dashboard at admin.sourceorigin.dev refactor No behviour changes

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant