Repository navigation
refactor: restore CodeScene code health in the worst files - #2022
Merged
Merged
Conversation
…nd custom color modules
…dates, and dismissal into modules
…device checks into submodules
…flict and decoder tests into focused modules
…, and page modules
…s into submodules
…hared paste helpers
…rag and bind stages
…the remote listing
wmfeht
approved these changes
Nov 2, 2026
wmfeht
approved these changes
Nov 2, 2026
This was referenced Nov 2, 2026
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 scored the tree at a LoC-weighted average of 6.67 (production 6.56, tests 6.79), with the five hotspot files between 1.4 and 4.1. This pull request restores code health in the worst 75 files and their test modules without changing behaviour, so the work lands as one change rather than a series of partial clean-ups.
What changed, file by file, follows the same shapes everywhere:
matchdispatchers delegate to per-domain handlers.DeviceActionContext,PastePlan,DirectoryLoad,ReleaseRequest,PreviewLoad,RefreshTargetandWalkinservices::search).let … else.src/ui/window.rs4,919 lines,src/app/browser.rs5,424 lines,src/adapters/local_operations.rs4,276 lines, …) are split into submodules by responsibility. Moved items are re-exported from their original path, so callers did not change.#[test]count: 3,756 on main, 3,757 here (one case split in two); ignored tests unchanged at 11.gtk_testchild runs pointed at a stale test path and so silently ran zero tests; they now run (one of them was already stale on main).Measured with the CodeScene CLI on every file in the tree (
scripts/code-health.sh):The worst files before and after:
Every file touched by this pull request, and every new module, scores 8.0 or higher. The diff is large (715 files) because the splits move code; reviewing by package is easiest: each merge commit on the branch is one file-disjoint package (window, browser modes, local operations, app, preview, chooser, settings, browser view, browser features, services, and four test groups).
Also added:
scripts/code-health.sh(reviews files or--changedfiles with the CodeScene CLI and can gate on--min N) and a short "Code health" section inAGENTS.mdso future changes do not regress the score.Follow-ups, out of scope here: the 119 untouched files still below 8 (largest debt:
src/ui/browser/location/tests.rs,src/ui/window/composition/tabs/tests.rs,src/adapters/local_operations/copy_engine/manifest.rs,src/ui/theme/tests.rs,src/ui/settings/keyboard.rs), and a CI delta gate using the script, which needs aCS_ACCESS_TOKENrepository secret.Visual evidence
N/A. The change is a behaviour-preserving refactor; no user-visible text, layout, ordering or timing changed.
How to test
./scripts/quality.sh fmt,./scripts/quality.sh clippyand./scripts/quality.sh testin the pinned container../scripts/qa.sh --test-threads 6to run every QA scenario.CS_ACCESS_TOKENset,./scripts/code-health.sh --min 8 --changedto re-score every changed file.Expected result: every suite passes with the same test count as main (3,770 passing in the container run, 656 ignored); the code-health script lists every changed file at 8.0 or above and exits 0; the app behaves exactly as before.
Related issue
Closes #1686