Skip to content

refactor(admin)!: client show prints the listed client's shape, and recoveries are admin views - #681

Draft
PiquelChips wants to merge 2 commits into
refactor/544-decision-typed-statusfrom
refactor/544-decision-admin-views
Draft

PiquelChips wants to merge 2 commits into
refactor/544-decision-typed-statusfrom
refactor/544-decision-admin-views

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Part of #544 (NEW-2). Stacked on #677: it changes the same client CLI and dashboard files, so its base is refactor/544-decision-typed-status.

The conventions say the dashboard and the CLI show views from sourceorigin_common::admin, which the database decodes into. Two reads didn't:

  • ClientDetails flattened the database's StoredOidcClient and StoredClientSecret. So client show --json printed database rows, while client list --json printed admin::Client: one client had two JSON shapes.
  • RecentRecovery, RecoveryState and RecoveryPasskey lived in the database crate. The CLI, the dashboard and the service imported admin views from sourceorigin_repository.

This PR adds the views to common::admin and has the database produce them:

  • admin::ClientDetail is the listed admin::Client (flattened), plus kind, created_at, updated_at and secrets (admin::SecretLifetime). OidcRepository::client_detail builds it from the existing queries; From<StoredClientSecret> converts each secret, since the console reads secrets too. AdminService::client_details becomes client_detail, and ClientDetails is gone.
  • admin::Recovery, admin::RecoveryState and admin::RecoveryPasskey move unchanged from crates/database/src/repositories/recoveries.rs. The database decodes recent into them, and StoredRecovery::state() returns admin::RecoveryState.
  • Shared row conversions: sourceorigin-ui gets From<&ClientDetail> for ClientRow and From<&SecretLifetime> for SecretRow. These replace AdminApplication::client_row and the three hand-written SecretRow maps: the dashboard's client and secret pages, and the developer console's secrets page, whose AccountService::client_secrets now returns SecretLifetimes.

Visible changes

auth-service client show --json changes shape (approved). It is now a client list entry plus four keys.

Before, the flattened database row:

{"id":"notes","display_name":"Notes","kind":"confidential","redirect_uris":[…],"post_logout_uris":[],"allowed_scopes":[…],"allowed_audiences":[…],"allow_refresh":true,"enabled":true,"trusted":false,"require_pushed_authorization_requests":false,"backchannel_logout_uri":null,"created_at":"…","updated_at":"…","owner_id":null,"last_used_at":null,"deleted_at":null,"suspended_at":null,"secrets":[{"id":"…","created_at":"…","expires_at":null}]}

After, admin::ClientDetail:

{"id":"notes","display_name":"Notes","redirect_uris":[…],"post_logout_uris":[],"allowed_scopes":[…],"allowed_audiences":[…],"allow_refresh":true,"enabled":true,"trusted":false,"require_pushed_authorization_requests":false,"token_endpoint_auth_method":"client_secret_basic","kind":"confidential","created_at":"…","updated_at":"…","secrets":[{"id":"…","created_at":"…","expires_at":null}]}

The differences:

  • token_endpoint_auth_method is added, as client list has it.
  • backchannel_logout_uri, owner_id, last_used_at, suspended_at and deleted_at are left out when empty instead of printed as null, as in client list.
  • The keys come in a different order. Secrets keep their shape.

sourceorigin-common public API: these items are new: admin::{ClientDetail, SecretLifetime, Recovery, RecoveryState, RecoveryPasskey}. cargo semver-checks reports them as additions.

Nothing else changes:

  • client show without --json prints the same fields from the same values.
  • The dashboard's client pages and recovery lists render the same rows. ClientRow::from(&ClientDetail) reads the same fields client_row read from the stored row, because admin::Client copies them.
  • The recovery list that user recover and user undo-recovery print to standard error keeps its JSON: the types moved with their serde attributes unchanged.
  • The account export test, which serializes a recovery, still passes unchanged.

Docs

docs/dev/operations/administration.md now lists client show (ClientDetail) among the commands whose --json prints an admin view.

Tests

  • New: a_client_detail_extends_the_listed_client checks that the detail's JSON is the listed client's plus its four keys, and that it round-trips. No test was removed.

Files outside this lane

  • apps/auth-service/src/lib.rs: drops ClientDetails from the re-exports.
  • apps/auth-service/src/recovery/mod.rs: imports RecoveryState from sourceorigin_common::admin. This is the only change to that file.

Note

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

…rows

`admin::ClientDetail` (the listed client with its kind, dates and
secrets) replaces `ClientDetails`, which flattened `StoredOidcClient`,
so `client show --json` and `client list --json` share one client shape.
`admin::Recovery`, `RecoveryState` and `RecoveryPasskey` move out of the
database crate, which decodes into them. The UI converts a
`ClientDetail` and its secrets into rows once.
@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

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