Repository navigation
refactor(ui): split settings search and theme tests into focused modules - #2033
Merged
Merged
Conversation
CodeScene's two remaining prioritized targets are src/ui/settings/search.rs (6.77) and src/ui/theme/tests.rs (6.14), the only files below the health threshold that change often. The settings search keeps its field and page switching in search.rs and moves the target table, scoring and the widget filter into submodules, with the bumpy matcher, filter and install paths broken into named steps. The theme tests split by topic into catalog, custom, omarchy and live modules; the contrast check and large assertion blocks are table-driven and the watch test drives a small WatchCalls fixture. No test or assertion is dropped.
This was referenced Nov 2, 2026
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.
Description
CodeScene's analysis after #2022 lists two remaining refactoring targets: the only files still below the code health threshold that also change often. This PR brings both to a healthy score without changing behaviour.
src/ui/settings/search.rs(6.77) had the matcher, the widget filter and the search field in one file, with the bumpyfilter_tree,find_matchesandSearch::installand three complex conditionals. It is now a hub for the search field and page switching, with:search/targets.rs: the static target table.search/matching.rs: query normalisation and scoring.word_scorereads as named predicates,score_textscores aCandidateinstead of four strings, andfind_matchesrecords settings and keyboard rows throughMatches::record.search/filter.rs: the widget-tree filter, with the heading and empty-placeholder rules as their own functions.src/ui/theme/tests.rs(6.14) held 28 unrelated tests. They now live intests/catalog.rs,tests/custom.rs,tests/omarchy.rsandtests/live.rs, with the shared helpers left intests.rs. The contrast check iterates one table of role and background pairs, the watch test drives aWatchCallsfixture, and the large assertion blocks became table-driven loops or a single comparison against expected tokens. Every test and assertion is kept.CodeScene CLI scores:
src/ui/settings/search.rsmatching.rs9.68,filter.rs10.0)src/ui/theme/tests.rsVisual evidence
N/A: a refactor with no user-visible change.
How to test
./scripts/test-headless.py ui::theme::runs the 37 theme tests, including the 19 GTK child runs under their new module paths../scripts/test-headless.py ui::settings::runs the 80 settings tests, which cover search scoring, filtering, the compact search button and page switching.Expected result: every test passes and settings search behaves exactly as on
main.Related issue
Refs #1686