Skip to content

refactor(auth): tests share one way to send requests and read replies - #574

Merged
PiquelChips merged 5 commits into
mainfrom
refactor/544-tests-requests
Nov 21, 2026
Merged

PiquelChips merged 5 commits into
mainfrom
refactor/544-tests-requests

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Part of #544. Builds on #571 and #573 (merged).

Test modules kept their own copies of request code that crate::tests already has, or should have:

  • Requests. The emails harness had its own Account type, request builder and body reader, copies of Browser's. It now uses Browser. The new Browser::send_from sends from a request context of the test's own, and Browser::send calls it.
  • Body readers. html, json and reply share one private body reader. The OIDC Flow::json/Flow::text and passkey Fixture::json are gone, and the clients registry tests read the token endpoint's error with json too.
  • Event history. The OIDC, passkey, admin and federation tests use a new EventRepository::known_history fixture (added to crates/database/src/fixtures.rs here, with its first callers) instead of writing out "this account's known events, newest first".
  • Reasons. deletion/tests.rs drops its copy of crate::tests::reason.

Differences

No test reads any of these:

  • The shared readers read up to MAX_RESPONSE_BYTES (256 KiB), as Browser::call and the page tests already did. OIDC's Flow::json and Flow::text read up to 1 MiB. Passkey's Fixture::json and the registry reader read up to 64 KiB. No response comes near any of these limits, and none is an assertion. The readers' panic messages change with them.
  • The emails tests send their signed-out requests as Browser::signed_out(), with an empty Cookie header instead of none, as every other signed-out test does. The service reads an empty header as no cookie.

Unchanged

  • No test was merged or removed. Every file keeps the same test names as origin/main.
  • Every assertion checks what it did.
  • Outside auth-service's test modules, only crates/database/src/fixtures.rs (for known_history) and docs/dev/testing.md (naming the shared readers) change.

Checks

  • cargo clippy -p auth-service and -p sourceorigin-repository, --all-targets, pass with and without --all-features, -D warnings. just docs passes.
  • just db test on the latest main: all 499 tests pass, and the query cache check passes.
  • Each commit builds on its own: known_history comes before its first callers.

Council review

Rounds: 2

Delegate Round 1 Round 2
GPT 6.1 Sol 9/10 9/10
Claude Opus 5.5 8/10 8.5/10
Claude Fable 5.2 8.5/10 9/10

Round 2 found no code defects. Its should-fixes were these descriptions, and its nits are applied.

Note

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

@PiquelChips PiquelChips added refactor No behviour changes tests Tests labels Nov 20, 2026
@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 43 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: db95df28-3da1-4e87-b7a3-9973f399121c
Commits

Reviewing files that changed from the base of the PR and between 319b802 and 0ce3e09.

Files selected for processing: 25

  • apps/auth-service/src/admin/tests/mod.rs
  • apps/auth-service/src/clients/tests/registry.rs
  • apps/auth-service/src/deletion/tests.rs
  • apps/auth-service/src/emails/tests.rs
  • apps/auth-service/src/federation/tests/signup.rs
  • apps/auth-service/src/oidc/tests/app_removal.rs
  • apps/auth-service/src/oidc/tests/authorization.rs
  • apps/auth-service/src/oidc/tests/errors.rs
  • apps/auth-service/src/oidc/tests/logout.rs
  • apps/auth-service/src/oidc/tests/mod.rs
  • apps/auth-service/src/oidc/tests/policy.rs
  • apps/auth-service/src/oidc/tests/protocol.rs
  • apps/auth-service/src/oidc/tests/pushed.rs
  • apps/auth-service/src/oidc/tests/sdk_routes.rs
  • apps/auth-service/src/oidc/tests/tokens.rs
  • apps/auth-service/src/passkey/tests/mod.rs
  • apps/auth-service/src/passkey/tests/registration.rs
  • apps/auth-service/src/passkey/tests/related_pages.rs
  • apps/auth-service/src/passkey/tests/sign_in.rs
  • apps/auth-service/src/passkey/tests/telemetry.rs
  • apps/auth-service/src/recovery/tests/mod.rs
  • apps/auth-service/src/recovery/tests/probation.rs
  • apps/auth-service/src/tests.rs
  • crates/database/src/fixtures.rs
  • docs/dev/testing.md
  • 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 force-pushed the refactor/544-tests-requests branch 2 times, most recently from edbbd5d to 4b7ce55 Compare November 20, 2026 09:00
@PiquelChips
PiquelChips marked this pull request as ready for review November 20, 2026 10:13
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-sign-in branch from 51fe7d1 to 5c9a78d Compare November 20, 2026 13:56
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-requests branch from 4b7ce55 to 2f7acba Compare November 20, 2026 13:56
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-sign-in branch from 5c9a78d to d47cd4b Compare November 20, 2026 14:12
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-requests branch from 2f7acba to 444c8c7 Compare November 20, 2026 14:12
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-sign-in branch from d47cd4b to 93f2765 Compare November 20, 2026 15:02
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-requests branch from 444c8c7 to 1dd02c8 Compare November 20, 2026 15:16
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-sign-in branch from 93f2765 to f1517e4 Compare November 21, 2026 13:06
Base automatically changed from refactor/544-tests-sign-in to main November 21, 2026 13:20
@PiquelChips
PiquelChips force-pushed the refactor/544-tests-requests branch from 1dd02c8 to 0ce3e09 Compare November 21, 2026 13:23
@PiquelChips
PiquelChips added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit f675d8d Nov 21, 2026
14 checks passed
@PiquelChips
PiquelChips deleted the refactor/544-tests-requests branch November 21, 2026 13:41
@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

refactor No behviour changes tests Tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant