Skip to content

refactor!: the dashboard's forms live in ui, not in common's published API - #703

Draft
PiquelChips wants to merge 3 commits into
refactor/544-services-independent-of-uifrom
refactor/544-dashboard-forms-in-ui
Draft

PiquelChips wants to merge 3 commits into
refactor/544-services-independent-of-uifrom
refactor/544-dashboard-forms-in-ui

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Part of #544. Stacked on #702 (refactor/544-services-independent-of-ui). Its base is that branch.

Several dashboard forms, and one unused form, lived in sourceorigin_common::admin, a published crate whose module otherwise holds views. The conventions put a page's forms and queries with the UI instead. The admin service also took two of them as input (TryFrom<&MessageUser> for Letter, TryFrom<&DraftAnnouncement> for AnnouncementDraft), so moving them to ui alone would have made the service depend on ui.

Where each form went:

  • DraftAnnouncement, DraftIntent, AnnouncementAudience move to crates/ui/src/admin/announcements.rs, next to the component that renders them. AnnouncementAudience is only the form's choice, so it moves with them.
  • MessageUser, MessageIntent move to crates/ui/src/admin/users.rs, next to the message form.
  • ApproveOrigin becomes a private struct in web/admin/origins.rs, because that page's own markup writes its origin input. Reservation, ReasonForm and the key Rotation already follow this rule.
  • CreateInvitation becomes a private struct in web/admin/invitations.rs, for the same reason.
  • GrantAdministrator is deleted, because nothing used it.
  • The two TryFrom conversions move to the dashboard pages that call them (web/admin/users.rs, web/admin/announcements.rs). The service keeps only Letter::new and AnnouncementDraft::new.

common::admin's module doc now says it holds views and the searches the service takes, never forms. rust-conventions.md and extending/admin-operation.md say where a dashboard form is declared.

Breaking API change to sourceorigin-common: removes admin::{ApproveOrigin, CreateInvitation, GrantAdministrator, MessageUser, MessageIntent, AnnouncementAudience, DraftAnnouncement, DraftIntent}. No SDK or published crate uses them. The next release needs 0.2.0.

Tests moved:

  • announcements_list_an_account_once_whatever_its_case moves from crates/common/src/tests.rs to ui's admin/announcements.rs.
  • the_form_names_one_account_per_line moves from admin/types/tests.rs to web/admin/tests/announcements.rs. It now compares against AnnouncementDraft::new(..), with expect on both sides, because the draft's fields are private to the service. It checks the same recipients.

Not moved, left for a follow-up: UserSearch and SendAnnouncement are page queries with impl Query in ui's admin/mod.rs. They stay in common::admin for now, and its module doc and admin-operation.md name them as the remaining exceptions.

Unchanged: fields, serde attributes and methods move as they were, so the forms post and decode the same names. The two private form structs in web/ drop Serialize and its skip_serializing_if attributes, which nothing used. They deserialize as before.

Checks:

  • cargo clippy --all-targets -D warnings for common, ui and auth-service, with and without --all-features
  • just test -p for common and ui
  • just db test
  • cargo doc and the doc tests for common and ui
  • cargo semver-checks -p sourceorigin-common, which reports the removals above as breaking
  • just rust unused
  • just docs

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
@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

DraftAnnouncement, DraftIntent, AnnouncementAudience, MessageUser and
MessageIntent move from sourceorigin_common::admin to sourceorigin-ui,
beside the components that render them, and the dashboard's pages convert
them into the service's Letter and AnnouncementDraft. ApproveOrigin, whose
fields the page's own markup writes, is declared beside that page, as
Reservation and ReasonForm are.
CreateInvitation, whose fields the invitation page writes, is declared
beside that page, and the unused GrantAdministrator goes. The announcement
form's test expects a draft on both sides.
@PiquelChips
PiquelChips force-pushed the refactor/544-dashboard-forms-in-ui branch from aa6ad6a to 643c9b3 Compare November 22, 2026 14:44
@PiquelChips
PiquelChips force-pushed the refactor/544-services-independent-of-ui branch from e8e4d6c to 0386cdd Compare November 22, 2026 14:44
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