Skip to content

refactor(auth): the owner's client operations share one transaction helper - #554

Merged
PiquelChips merged 1 commit into
mainfrom
refactor/544-accounts-owned-clients
Nov 21, 2026
Merged

PiquelChips merged 1 commit into
mainfrom
refactor/544-accounts-owned-clients

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Part of #544

The owner's five client operations in clients/owned.rs (create, update, enable or disable, rotate a secret, delete) each spelled out the same transaction: begin, Owner::lock_confirmed, ClientRegistry::new, the change, commit, with a .map_err(OwnedClientError::from) on every registry call. The steps that matter, what each operation changes, were hard to find among them.

They now share AccountService::change_clients, which mirrors AdminService::change_clients: it runs a closure on the registry in one transaction, once the owner confirmed under the account lock, and commits. A new From<ClientRegistryError> for AccountError goes through OwnedClientError::Registry, exactly the path the removed map_err calls took, so the closures return the registry's result directly.

Unchanged: the order of the steps (begin, lock and confirmation check, registry change, read-back, commit), so the same error wins when a request has several faults; every error keeps its AccountError::Client(OwnedClientError::…) variant, so the HTTP responses and the console's field messages are the same; the registry still records the same events.

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 db test (497 passed, including the owned-client tests in clients/tests); just rust unused.

Note

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

@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 20, 2026
@PiquelChips
PiquelChips marked this pull request as draft November 20, 2026 06:53
@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 25 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: b1023bca-6aa5-4365-8ecb-5a72b76303bf
Commits

Reviewing files that changed from the base of the PR and between 467e813 and 3c5c36b.

Files selected for processing: 1

  • apps/auth-service/src/clients/owned.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 07:22
@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:42
@PiquelChips
PiquelChips added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit ef67200 Nov 21, 2026
13 checks passed
@PiquelChips
PiquelChips deleted the refactor/544-accounts-owned-clients branch November 21, 2026 16:36
@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