Skip to content

refactor(auth): settings share how they store a picture, find an event and record a verification - #563

Merged
PiquelChips merged 2 commits into
mainfrom
refactor/544-accounts-settings-steps
Nov 21, 2026
Merged

PiquelChips merged 2 commits into
mainfrom
refactor/544-accounts-settings-steps

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Part of #544

Three account settings each wrote one step twice, so a reader had to compare the copies to see that they do the same thing:

  • Pictures: set_picture and import_picture both stored the JPEG under a new ID and recorded PictureChanged. They now share AccountService::store.
  • History: HistoryItem::find (a notification's history entry) and AccountService::entry (a report) both built the same one-event filter and took its result. They now share HistoryItem::stored.
  • Emails: verify_email and Added::verified (a provider's or invitation's address) both recorded EmailVerified, then PrimaryEmailChanged with no previous address. They now share EmailApplication::record_verified, which records the second event only when the address became primary.

Unchanged: each operation runs the same statements in the same order, inside the same transaction and under the same locks, and records the same events in the same order. Errors keep their types and variants (DatabaseError reaches AccountError::Database or EmailError::Database as before), so HTTP responses don't change. The one reordering: set_picture now draws its random PictureId after taking the lock instead of before. Nothing reads the ID first.

Tests: none merged or removed. Files outside my area: none.

Checks: just fmt; cargo clippy -p auth-service --all-targets with and without --all-features (-D warnings); cargo doc -p auth-service --all-features (-D warnings); just rust unused; just db prepare-check. just db test --no-fail-fast: 495 of 497 passed. keys::tests::rewrapping_seals_every_key_under_the_current_key_encryption_key and keys::tests::rotation_takes_each_step_once_on_schedule hit a statement timeout on the signing-key lock while the machine's load average was about 70. All 9 keys:: tests pass when run alone (just db test -E 'test(/^keys::/)'), the whole suite passed on the same base in #554, and this diff doesn't touch keys.

Note

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

@PiquelChips
PiquelChips marked this pull request as draft November 20, 2026 07:06
@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b0e65adc-90f2-46af-b00d-3d4b7d3df990
Commits

Reviewing files that changed from the base of the PR and between 467e813 and 5abe037.

Files selected for processing: 3

  • apps/auth-service/src/emails/mod.rs
  • apps/auth-service/src/history/mod.rs
  • apps/auth-service/src/pictures/mod.rs
  • 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

@PiquelChips PiquelChips added refactor No behviour changes apps/auth-service Origin Auth at auth.sourceorigin.dev, its settings and developer console, and the operator CLI labels Nov 20, 2026
@PiquelChips
PiquelChips marked this pull request as ready for review November 20, 2026 08:06
@PiquelChips
PiquelChips marked this pull request as draft November 21, 2026 14:00
@PiquelChips
PiquelChips marked this pull request as ready for review November 21, 2026 14:44
@PiquelChips
PiquelChips added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 807f4cb Nov 21, 2026
14 checks passed
@PiquelChips
PiquelChips deleted the refactor/544-accounts-settings-steps branch November 21, 2026 16:39
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in sourceorigin.dev Nov 21, 2026
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: Done

Development

Successfully merging this pull request may close these issues.

1 participant