Repository navigation
refactor!: the dashboard's forms live in ui, not in common's published API - #703
Draft
PiquelChips wants to merge 3 commits into
Draft
PiquelChips wants to merge 3 commits into
PiquelChips wants to merge 3 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
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
force-pushed
the
refactor/544-dashboard-forms-in-ui
branch
from
November 22, 2026 14:44
aa6ad6a to
643c9b3
Compare
PiquelChips
force-pushed
the
refactor/544-services-independent-of-ui
branch
from
November 22, 2026 14:44
e8e4d6c to
0386cdd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,AnnouncementAudiencemove tocrates/ui/src/admin/announcements.rs, next to the component that renders them.AnnouncementAudienceis only the form's choice, so it moves with them.MessageUser,MessageIntentmove tocrates/ui/src/admin/users.rs, next to the message form.ApproveOriginbecomes a private struct inweb/admin/origins.rs, because that page's own markup writes itsorigininput.Reservation,ReasonFormand the keyRotationalready follow this rule.CreateInvitationbecomes a private struct inweb/admin/invitations.rs, for the same reason.GrantAdministratoris deleted, because nothing used it.TryFromconversions move to the dashboard pages that call them (web/admin/users.rs,web/admin/announcements.rs). The service keeps onlyLetter::newandAnnouncementDraft::new.common::admin's module doc now says it holds views and the searches the service takes, never forms.rust-conventions.mdandextending/admin-operation.mdsay where a dashboard form is declared.Breaking API change to
sourceorigin-common: removesadmin::{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_casemoves fromcrates/common/src/tests.rsto ui'sadmin/announcements.rs.the_form_names_one_account_per_linemoves fromadmin/types/tests.rstoweb/admin/tests/announcements.rs. It now compares againstAnnouncementDraft::new(..), withexpecton both sides, because the draft's fields are private to the service. It checks the same recipients.Not moved, left for a follow-up:
UserSearchandSendAnnouncementare page queries withimpl Queryin ui'sadmin/mod.rs. They stay incommon::adminfor now, and its module doc andadmin-operation.mdname 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/dropSerializeand itsskip_serializing_ifattributes, which nothing used. They deserialize as before.Checks:
cargo clippy --all-targets -D warningsfor common, ui and auth-service, with and without--all-featuresjust test -pfor common and uijust db testcargo docand the doc tests for common and uicargo semver-checks -p sourceorigin-common, which reports the removals above as breakingjust rust unusedjust docsNote
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)