Skip to content

refactor: services name no ui type; the pages convert between them - #702

Draft
PiquelChips wants to merge 5 commits into
refactor/544-decision-standingsfrom
refactor/544-services-independent-of-ui
Draft

PiquelChips wants to merge 5 commits into
refactor/544-decision-standingsfrom
refactor/544-services-independent-of-ui

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Part of #544. Stacked on #686 (refactor/544-decision-standings, the tip of the #677 → #681 → #686 stack). Its base is that branch.

The owner's chosen direction is that sourceorigin-ui uses the services' and common's types, never the other way round. Some service code named ui types anyway:

  • GracePeriod: From<Grace> sat in admin/types. Now GracePeriod has named periods (NONE, HOUR, DAY, WEEK, MONTH), built by a const fn that fails to compile when a period is outside 0 to 30 days. The conversion from the rotation form's choice lives in web/developers, next to From<ClientDraft> for ClientSettings. The console and the dashboard both call it.
  • AdminError::Link, FederationError::PageAddress and OAuthError::PageAddress held ui's QueryError, which only re-exports serde_urlencoded::ser::Error. They now name that type directly. Same type, same messages.
  • FederationError::callback_error mapped the domain error to the sign-in page's CallbackError. That mapping now sits in FederationApplication::refused, the handler that redirects to the page. It has the same arms, and error.rs names no ui type.
  • PICTURE_TYPES moves from ui to sourceorigin_common, next to PictureId. The picture service fetches with it, and the profile form's accept uses it. handle::MAX_LENGTH already works this way.

The conventions and the architecture overview now state the direction. They also say which code outside src/web may still name ui: code that redirects to a page or renders one. A redirect to a page writes that page's query. Federation's callback and the OIDC flows write LoginQuery, and the dashboard handoff writes HandoffQuery. The security layer renders its error page and keeps the preference and notice cookies, assets serves ui's files and the email deliverer renders emails. Configuration reads Policies::PATHS, which sourceorigin.dev also serves.

Why CallbackError and LoginQuery stay in ui: they are the sign-in page's query, and the conventions put a page's query in ui. Federation's callback writes that query because it redirects to the page. Taking ui out of federation entirely would mean moving the callback route into src/web, which is a large move of the sign-in flow for little gain.

API change to sourceorigin-common: adds pub const PICTURE_TYPES. Nothing is removed.

Tests moved: rotation_choices_are_the_periods_they_name moves from admin/types/tests.rs to web/developers/tests.rs with the conversion it tests. It is unchanged.

Unchanged: every string, serde attribute and error message is moved as it was. The grace periods are the same minutes (the moved test checks each choice against its parsed text). The callback's match has the same arms as before. PICTURE_TYPES is the same string.

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

The admin service converted ui's Grace into its GracePeriod. GracePeriod
now names its periods, and the console's web module converts the form's
choice, so the service names no ui type.
The picture service fetched with ui's PICTURE_TYPES. The constant moves to
sourceorigin-common, beside PictureId, and the profile form uses it from there.
AdminError, FederationError and OAuthError held ui's QueryError, which is
serde_urlencoded's error; they name it directly. FederationError no longer
maps itself to the sign-in page's CallbackError: the callback that
redirects there does.
…compile

Also say which code outside the pages may still name sourceorigin-ui:
what redirects to a page or renders one, and the security layer's
preference and notice cookies.
@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

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