Skip to content

refactor(admin): dashboard change forms share one change-plus-reason wrapper - #688

Draft
PiquelChips wants to merge 1 commit into
fix/544-decision-reason-defaultfrom
refactor/544-decision-administered-form
Draft

PiquelChips wants to merge 1 commit into
fix/544-decision-reason-defaultfrom
refactor/544-decision-administered-form

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Part of #544 (NEW-7, second half). Stacked on #683: review and merge that first; this PR's base is its branch.

Each dashboard form declared its own reason: String, so each had its own chance to forget #[serde(default)], which #683 fixes. The settings pages already had an Administered<C> wrapper (a change plus its reason), and #593 gave changes that ask only why one shared ReasonForm page. Now there is one wrapper for both:

  • Administered<C> moves from settings.rs to the dashboard's mod.rs. Its reason defaults to empty there, once.
  • ReasonForm is Administered<()>. Its pages (ReasonPage, App::reason_change) are unchanged.
  • App::submit_reason takes any Administered<C>, parses the reason, then hands on the change and its Reason. The settings tabs, the display name page and the signing key rotation use it, since they already checked the reason first. App::subject now takes a parsed Reason.
  • Refused::reason works for every Administered<C>, so pages stop reaching into refused.form.reason.
  • These forms keep only their own fields: the handle reservation, the account's new handle and display name, the signing key rotation, and the client secret rotation, which is now Administered<SecretsChange>, so its Rotation struct goes.
  • Administered's doc comment says that C's fields must decode from text. Serde's flatten buffers them as strings, past topcoat's own parsing of numbers and of empty values as None. Every wrapped field is a string, an ID, a Checkbox or a text enum. SecretsChange was already flattened on main.

No behavior changes. Each form checks its fields in the same order as before: the reservation and the new handle still check the handle before the reason. The rendered pages get the same values. No test was merged or removed.

Left as they are:

  • The administrator grant's GrantForm has a numeric page and an optional user_id. Flattened, ?q=…&page=2 (the pager's own link) would answer 400, and so would an empty user_id, which today gets the page's "no account" refusal. It keeps its own defaulted reason, with a comment saying why. rights_are_granted_from_a_search now also visits ?q=…&page=2.
  • CreateInvitation and ApproveOrigin (common::admin) and OperatorDraft (ui/admin/clients.rs) keep their own defaulted reason. Another cleanup lane is editing those files, so folding them in is a follow-up once it lands.
  • The alert update's form posts its reason as note, so it stays as it is.

Outside the area: apps/auth-service/src/web/admin/clients.rs loses its Rotation struct for Administered<SecretsChange>.

Docs: docs/dev/extending/admin-operation.md describes Administered<C>, the text-only rule for its fields and the forms that keep their own reason, submit_reason and ReasonForm. Its example page now checks App::confirmed, as the real pages do, instead of App::admin then App::confirm.

Note

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

@PiquelChips PiquelChips added apps/auth-service Origin Auth at auth.sourceorigin.dev, its settings and developer console, and the operator CLI 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

Administered<C> moves from the settings pages to the dashboard's module,
and every form there with a reason takes it: ReasonForm is Administered<()>,
and submit_reason hands the change and its parsed Reason on.
@PiquelChips
PiquelChips force-pushed the refactor/544-decision-administered-form branch from 042b98e to f6f6adc Compare November 22, 2026 13:57
@PiquelChips PiquelChips changed the title refactor(admin): every dashboard form is one change plus its reason refactor(admin): dashboard change forms share one change-plus-reason wrapper Nov 22, 2026
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 apps/auth-service Origin Auth at auth.sourceorigin.dev, its settings and developer console, and the operator CLI refactor No behviour changes

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant