Repository navigation
refactor(tests): unit tests sit beside their module, and the largest test files split by flow - #335
Merged
Merged
Conversation
|
Warning Review limit reachedYou'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 8 minutes. View limit details
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. |
PiquelChips
force-pushed
the
refactor/split-rust-tests
branch
4 times, most recently
from
November 4, 2026 15:14
95b77a9 to
04c9c92
Compare
PiquelChips
force-pushed
the
refactor/split-rust-tests
branch
from
November 4, 2026 16:47
04c9c92 to
1078090
Compare
… module Inline test blocks over 30 lines move to foo/tests.rs, turning foo.rs into foo/mod.rs. Smaller blocks stay inline, as do config.rs and oidc/authorize.rs, which are being split elsewhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oidc, passkey, recovery, clients, federation, admin and security tests each become a tests/ directory: mod.rs holds the shared fixtures, and each flow gets its own file. Test bodies are unchanged; doc references follow the new paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tten down Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PiquelChips
force-pushed
the
refactor/split-rust-tests
branch
from
November 4, 2026 16:57
1078090 to
0b75a5a
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.
Unit tests lived in two places: 21 files kept an inline
mod tests { … }while 46 used a siblingtests.rs. Seven auth-service test files had also grown past 1,000 lines each (oidc's reached 2,500), so finding a flow's tests meant scrolling through everything else. This PR only moves tests. No test logic changes.One placement. Inline blocks move to
foo/tests.rs, sofoo.rsbecomesfoo/mod.rs. This covers 14 files, includingdeletion/export,jobs,crypto::signing,ui::recoveryandprotocol::challenge.The rule: inline blocks of 30 lines or fewer stay inline, since moving a test or two of a few asserts adds a file and a directory for nothing. Five stay under it:
protocol/oauth.rs,protocol/claims.rs,ui/src/asset.rs,auth-service/src/assets.rsandtelemetry/src/lib.rs.config.rsandoidc/authorize.rsare left alone because another thread is splitting them.Split by flow.
oidc,passkey,recovery,clients,federation,adminandsecurityeach get atests/directory. Shared fixtures go intests/mod.rsand each flow gets its own file, for exampleoidc/tests/{tokens,logout,pushed,step_up,sdk_routes,…}.rs.admin::tests::{Account, Harness, …}andsecurity::tests::assert_step_up_required.#[expect(clippy::too_many_lines)]became unfulfilled: each one sits on a single test whose body didn't change.Checks. For every split file, the old and new files contain the same lines once sorted, apart from imports and the new
mod///!lines.just lintpasses, andjust db testruns 326 tests, all passing, plus the query-cache check.The 30-line rule and the
tests/layout are now written down indocs/architecture/rust-conventions.md, and doc paths to the moved modules (jobs,ui::recovery) follow them.Proved by
just lint,just db test(326/326 pass) and a sorted-line comparison of every split file against the original.Reviewed with review-loop: 1 round with 2× GPT 6.1 Sol and Claude Opus 5.5. Verdict: approved
Note
Written by Claude Opus 5.5 in Claude Code, with Claude Opus 5.5 subagents splitting the seven files, and reviewed by GPT 6.1 Sol and Claude Opus 5.5 (via T3 Code)
🤖 Generated with Claude Code