Skip to content

refactor(ui): the devices page's test moves out of line, as the conventions ask - #607

Merged
PiquelChips merged 1 commit into
mainfrom
refactor/544-pages-sessions-tests
Nov 21, 2026
Merged

PiquelChips merged 1 commit into
mainfrom
refactor/544-pages-sessions-tests

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Part of #544

crates/ui/src/settings/sessions.rs ended in a 38-line inline test block. docs/dev/rust-conventions.md lets a test block stay inline only up to 30 lines, so this one belongs in a sibling tests.rs.

The module is now settings/sessions/mod.rs, and its test is in settings/sessions/tests.rs, unchanged apart from indentation. git diff -M shows the rename.

  • Tests merged or removed: none. The same test still runs as settings::sessions::tests::devices_of_one_name_are_signed_out_by_different_names.
  • Files outside the Pages area: none.
  • Proof nothing changed: the component code didn't change, so no page's markup did either.
  • Checks: just fmt, cargo clippy -p sourceorigin-ui --all-targets with and without --all-features, cargo doc -p sourceorigin-ui with -D warnings, cargo test --doc -p sourceorigin-ui and just test -p sourceorigin-ui --all-features (9 passed).

Note

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

This pull request moves the inline test module out of crates/ui/src/settings/sessions.rs into its own file. The module file is now crates/ui/src/settings/sessions/mod.rs.

Scope: settings sessions module (crates/ui/src/settings/sessions/)

  • sessions/mod.rs (renamed from sessions.rs, 86% similarity): removes the inline mod tests block (39 lines) and declares mod tests;.
  • sessions/tests.rs (new file): contains the moved test devices_of_one_name_are_signed_out_by_different_names. The body matches the removed block. Only the indentation changed.

Net change: 38 lines added, 39 removed. No production logic changed. The test name and assertions are unchanged.

Not verified: the reported checks (just fmt, clippy, cargo doc, doc tests, and just test). Their results were not available from the inspected diff.

@PiquelChips PiquelChips added refactor No behviour changes tests Tests labels Nov 20, 2026
@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

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The sign-out label test moved from an inline module to an external test module. It checks the expected label prefix, absence of a middle dot, and distinct labels for two device rows with different IP addresses and authentication times.

Changes: Session sign-out label test

Layer / File(s) Summary
Externalize sign-out label test
crates/ui/src/settings/sessions/mod.rs, crates/ui/src/settings/sessions/tests.rs
The test is declared as an external module. It checks the expected Firefox/Linux, Passkey, and IP prefix, confirms that the label contains no middle dot, and compares labels for rows with different IP addresses and authentication times.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Refactor

Merge Risk: Minimal · up to d95cf

This change only moves a test into its own file to follow the repository's test-size convention. It does not change runtime behavior, so merging carries no meaningful risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title uses the conventional commit form and names the change: the devices page test moves out of the module into its own file. It matches the summary, which shows sessions.rs became sessions/mod.r…
Description check Passed The description follows the template's main sections in substance. 'What and why' explains the 38-line inline test block, the 30-line limit in docs/dev/rust-conventions.md, and the move to tests.rs. I…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title uses the conventional commit form and names the change: the devices page test moves out of the module into its own file. It matches the summary, which shows sessions.rs became sessions/mod.rs and the inline test block moved to tests.rs. The 'refactor' type fits a move with no behavior change. It does not name the crate, but that is optional.

Full details: Description check

Explanation

The description follows the template's main sections in substance. 'What and why' explains the 38-line inline test block, the 30-line limit in docs/dev/rust-conventions.md, and the move to tests.rs. It links the work to #544 with 'Part of #544', but it does not use the template's 'Closes #' form, which is acceptable for a partial change. 'Testing' lists the commands run, the test name, and the 9 passing tests, and it states what was not tested only in part (no device or live-provider testing applies here). The checklist is absent. The description does not tick any checklist items, and it does not confirm that 'just validate' passed or that generated files were regenerated, although the change likely needs neither. The description also says 'Files outside the Pages area: none', which covers scope. The gaps are minor and non-critical, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

A rabbit checks each label in the row
Two different addresses make them show
The middle dot is nowhere in sight
Firefox and Linux read just right
The tests hop out to a file of their own

Recent review info

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: 9600bf7f-fe63-4704-9796-2e6738bb2edf
Commits

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

Files selected for processing: 2

  • crates/ui/src/settings/sessions/mod.rs
  • crates/ui/src/settings/sessions/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@PiquelChips
PiquelChips marked this pull request as ready for review November 20, 2026 09:54
@github-project-automation github-project-automation Bot moved this from Needs Triage to Ready in sourceorigin.dev Nov 20, 2026
@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:37
@PiquelChips
PiquelChips added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 94d7505 Nov 21, 2026
13 checks passed
@PiquelChips
PiquelChips deleted the refactor/544-pages-sessions-tests branch November 21, 2026 17:11
@github-project-automation github-project-automation Bot moved this from Ready 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