Public report of farion1231/cc-switch, published 14 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 14 November 2026, 04:34 UTC · Survey ID cd_02c59ca923314e75bab18b6c33bde228
farion1231/cc-switch
Measured 14 November 2026, 04:32 UTC, at code version 8c76bfe
Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureNoCollector).
Test reliability is not measured: The rust executor ran against the .rs half and never executed.
CAI scoreAt riskNo change since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 480,087 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 4.0 person-years · Weakest lens: Code Health, 52
Findings by how serious they are
157 critical2382 serious231 minor
13 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 04:32 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
69of 69 dimensions measured by tools.
2706of 2770 findings point to an exact file and line, so you can open each one in the code. The other 64 concern the repository as a whole, such as missing documentation.
69dimensions across 7 lenses, read from 480,087 lines of product code in 2 projects.
farion1231/cc-switch is rated At risk because critical security findings are open. It scores 58 out of 100, which the At risk rating leaves unchanged.
Code Health, at 52, is the weakest lens and counts most in the score. The best first step is replacing the four exposed passwords or keys and switching the old ones off, worth about 3 points. Splitting the oversized files would lift Code Health itself, also worth about 3. Raising Code Health to 70 would lift the score to about 62.
Forty-two weaknesses in the code could be used by an attacker. Thirty-one pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Fixing the weaknesses the scanner points to and pinning each tool to an exact version would close both risks. Updating the vulnerable packages would fix the 22 packages with a known security hole, and the four passwords or keys in the code and the password or key in the code's history need replacing, with the old ones switched off. The 13 labels or groups of fields with no name need connecting to their fields or naming.
The product code is 480,087 lines, about €590,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 52 to 70, the lowest score rated Strong, the score would rise from 58 to about 62.
Code composition: what the lines of code are
Product code 85%Tests 15%
New since the last survey: 745 findings
These 745 critical or serious findings weren't in the previous survey, on 25 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 629 findings
These 629 critical or serious findings were in the previous survey, on 25 October 2026, and are gone from this one. The first 100 are listed here.
€190,000 to €980,000, for 3,238 to 10,273 hours of work, about 4.0 person-years for 2 to 8 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 58. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 480,087 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 3 points · Medium effort · Large Files
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €590,000 to build again, about 4.0 person-years of work. Its weakest lens is Code Health, at 52 (Adequate). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for low effort, because it clears the 4 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 555,151 lines over the last 90 days, which is about 2,251,446 lines a year. At that pace, the extra work comes to an estimated 293.4 to 1760.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
738 modules, with 1059 dependencies between them. 5 loops run through 12 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 698 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
cc_switch.error uses cc_switch.live.patch, so a change to cc_switch.live.patch can break cc_switch.error, while a change to cc_switch.error can't break cc_switch.live.patch.
Position
Below the diagonal: cc_switch.error uses a module listed above it, which is the healthy direction.
cc_switch.live.patch.json uses cc_switch.live.patch, so a change to cc_switch.live.patch can break cc_switch.live.patch.json, while a change to cc_switch.live.patch.json can't break cc_switch.live.patch.
Position
Below the diagonal: cc_switch.live.patch.json uses a module listed above it, which is the healthy direction.
cc_switch.mode.state uses cc_switch.live.engine, so a change to cc_switch.live.engine can break cc_switch.mode.state, while a change to cc_switch.mode.state can't break cc_switch.live.engine.
Position
Below the diagonal: cc_switch.mode.state uses a module listed above it, which is the healthy direction.
13→17 cc_switch.provider uses cc_switch.app_configpart of a loop✕
Connections
1 pair of types, where a type in cc_switch.provider uses a type in cc_switch.app_config.
cc_switch.provider uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.provider, while a change to cc_switch.provider can't break cc_switch.app_config.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
cc_switch.session_manager.providers.utils uses cc_switch.session_manager, so a change to cc_switch.session_manager can break cc_switch.session_manager.providers.utils, while a change to cc_switch.session_manager.providers.utils can't break cc_switch.session_manager.
Position
Below the diagonal: cc_switch.session_manager.providers.utils uses a module listed above it, which is the healthy direction.
cc_switch.session_manager.providers.utils uses cc_switch.session_manager.model, so a change to cc_switch.session_manager.model can break cc_switch.session_manager.providers.utils, while a change to cc_switch.session_manager.providers.utils can't break cc_switch.session_manager.model.
Position
Below the diagonal: cc_switch.session_manager.providers.utils uses a module listed above it, which is the healthy direction.
src.components.usage uses src.types.usage, so a change to src.types.usage can break src.components.usage, while a change to src.components.usage can't break src.types.usage.
Position
Below the diagonal: src.components.usage uses a module listed above it, which is the healthy direction.
cc_switch.app_config uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.app_config, while a change to cc_switch.app_config can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.app_config uses a module listed above it, which is the healthy direction.
cc_switch.services.claude_account uses cc_switch.error, so a change to cc_switch.error can break cc_switch.services.claude_account, while a change to cc_switch.services.claude_account can't break cc_switch.error.
Position
Below the diagonal: cc_switch.services.claude_account uses a module listed above it, which is the healthy direction.
src.components uses src.lib.api.types, so a change to src.lib.api.types can break src.components, while a change to src.components can't break src.lib.api.types.
Position
Below the diagonal: src.components uses a module listed above it, which is the healthy direction.
src.components.providers uses src.lib.api.types, so a change to src.lib.api.types can break src.components.providers, while a change to src.components.providers can't break src.lib.api.types.
Position
Below the diagonal: src.components.providers uses a module listed above it, which is the healthy direction.
src.components.providers uses src.types, so a change to src.types can break src.components.providers, while a change to src.components.providers can't break src.types.
Position
Below the diagonal: src.components.providers uses a module listed above it, which is the healthy direction.
src.components.providers.forms uses src.types, so a change to src.types can break src.components.providers.forms, while a change to src.components.providers.forms can't break src.types.
Position
Below the diagonal: src.components.providers.forms uses a module listed above it, which is the healthy direction.
src.components.providers.forms.hooks uses src.lib.api.types, so a change to src.lib.api.types can break src.components.providers.forms.hooks, while a change to src.components.providers.forms.hooks can't break src.lib.api.types.
Position
Below the diagonal: src.components.providers.forms.hooks uses a module listed above it, which is the healthy direction.
src.components.providers.forms.hooks uses src.types, so a change to src.types can break src.components.providers.forms.hooks, while a change to src.components.providers.forms.hooks can't break src.types.
Position
Below the diagonal: src.components.providers.forms.hooks uses a module listed above it, which is the healthy direction.
src.components.sessions.reader.turns uses src.types, so a change to src.types can break src.components.sessions.reader.turns, while a change to src.components.sessions.reader.turns can't break src.types.
Position
Below the diagonal: src.components.sessions.reader.turns uses a module listed above it, which is the healthy direction.
cc_switch.database uses cc_switch.proxy.types, so a change to cc_switch.proxy.types can break cc_switch.database, while a change to cc_switch.database can't break cc_switch.proxy.types.
Position
Below the diagonal: cc_switch.database uses a module listed above it, which is the healthy direction.
cc_switch.database uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.database, while a change to cc_switch.database can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.database uses a module listed above it, which is the healthy direction.
cc_switch.database uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.database, while a change to cc_switch.database can't break cc_switch.app_config.
Position
Below the diagonal: cc_switch.database uses a module listed above it, which is the healthy direction.
cc_switch.proxy.forwarder uses cc_switch.proxy.types, so a change to cc_switch.proxy.types can break cc_switch.proxy.forwarder, while a change to cc_switch.proxy.forwarder can't break cc_switch.proxy.types.
Position
Below the diagonal: cc_switch.proxy.forwarder uses a module listed above it, which is the healthy direction.
cc_switch.proxy.forwarder uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.proxy.forwarder, while a change to cc_switch.proxy.forwarder can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.proxy.forwarder uses a module listed above it, which is the healthy direction.
cc_switch.proxy.forwarder uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.proxy.forwarder, while a change to cc_switch.proxy.forwarder can't break cc_switch.app_config.
Position
Below the diagonal: cc_switch.proxy.forwarder uses a module listed above it, which is the healthy direction.
cc_switch.services.subscription uses cc_switch.services.claude_account, so a change to cc_switch.services.claude_account can break cc_switch.services.subscription, while a change to cc_switch.services.subscription can't break cc_switch.services.claude_account.
Position
Below the diagonal: cc_switch.services.subscription uses a module listed above it, which is the healthy direction.
src.components.sessions.reader uses src.types, so a change to src.types can break src.components.sessions.reader, while a change to src.components.sessions.reader can't break src.types.
Position
Below the diagonal: src.components.sessions.reader uses a module listed above it, which is the healthy direction.
src.components.sessions.reader uses src.components.sessions.reader.turns, so a change to src.components.sessions.reader.turns can break src.components.sessions.reader, while a change to src.components.sessions.reader can't break src.components.sessions.reader.turns.
Position
Below the diagonal: src.components.sessions.reader uses a module listed above it, which is the healthy direction.
cc_switch.proxy.server uses cc_switch.proxy.types, so a change to cc_switch.proxy.types can break cc_switch.proxy.server, while a change to cc_switch.proxy.server can't break cc_switch.proxy.types.
Position
Below the diagonal: cc_switch.proxy.server uses a module listed above it, which is the healthy direction.
cc_switch.proxy.server uses cc_switch.database, so a change to cc_switch.database can break cc_switch.proxy.server, while a change to cc_switch.proxy.server can't break cc_switch.database.
Position
Below the diagonal: cc_switch.proxy.server uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_direct uses cc_switch.live.engine, so a change to cc_switch.live.engine can break cc_switch.services.provider.codex_direct, while a change to cc_switch.services.provider.codex_direct can't break cc_switch.live.engine.
Position
Below the diagonal: cc_switch.services.provider.codex_direct uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_direct uses cc_switch.live.patch, so a change to cc_switch.live.patch can break cc_switch.services.provider.codex_direct, while a change to cc_switch.services.provider.codex_direct can't break cc_switch.live.patch.
Position
Below the diagonal: cc_switch.services.provider.codex_direct uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_direct uses cc_switch.mode.state, so a change to cc_switch.mode.state can break cc_switch.services.provider.codex_direct, while a change to cc_switch.services.provider.codex_direct can't break cc_switch.mode.state.
Position
Below the diagonal: cc_switch.services.provider.codex_direct uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_direct uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.services.provider.codex_direct, while a change to cc_switch.services.provider.codex_direct can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.services.provider.codex_direct uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_direct uses cc_switch.database, so a change to cc_switch.database can break cc_switch.services.provider.codex_direct, while a change to cc_switch.services.provider.codex_direct can't break cc_switch.database.
Position
Below the diagonal: cc_switch.services.provider.codex_direct uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_direct uses cc_switch.services.subscription, so a change to cc_switch.services.subscription can break cc_switch.services.provider.codex_direct, while a change to cc_switch.services.provider.codex_direct can't break cc_switch.services.subscription.
Position
Below the diagonal: cc_switch.services.provider.codex_direct uses a module listed above it, which is the healthy direction.
cc_switch.settings uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.settings, while a change to cc_switch.settings can't break cc_switch.app_config.
Position
Below the diagonal: cc_switch.settings uses a module listed above it, which is the healthy direction.
cc_switch.settings uses cc_switch.database, so a change to cc_switch.database can break cc_switch.settings, while a change to cc_switch.settings can't break cc_switch.database.
Position
Below the diagonal: cc_switch.settings uses a module listed above it, which is the healthy direction.
cc_switch.store uses cc_switch.database, so a change to cc_switch.database can break cc_switch.store, while a change to cc_switch.store can't break cc_switch.database.
Position
Below the diagonal: cc_switch.store uses a module listed above it, which is the healthy direction.
cc_switch.proxy.handlers uses cc_switch.services.claude_account.snapshot.state, so a change to cc_switch.services.claude_account.snapshot.state can break cc_switch.proxy.handlers, while a change to cc_switch.proxy.handlers can't break cc_switch.services.claude_account.snapshot.state.
Position
Below the diagonal: cc_switch.proxy.handlers uses a module listed above it, which is the healthy direction.
cc_switch.proxy.handlers uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.proxy.handlers, while a change to cc_switch.proxy.handlers can't break cc_switch.app_config.
Position
Below the diagonal: cc_switch.proxy.handlers uses a module listed above it, which is the healthy direction.
cc_switch.proxy.handlers uses cc_switch.database, so a change to cc_switch.database can break cc_switch.proxy.handlers, while a change to cc_switch.proxy.handlers can't break cc_switch.database.
Position
Below the diagonal: cc_switch.proxy.handlers uses a module listed above it, which is the healthy direction.
cc_switch.proxy.handlers uses cc_switch.proxy.forwarder, so a change to cc_switch.proxy.forwarder can break cc_switch.proxy.handlers, while a change to cc_switch.proxy.handlers can't break cc_switch.proxy.forwarder.
Position
Below the diagonal: cc_switch.proxy.handlers uses a module listed above it, which is the healthy direction.
cc_switch.proxy.handlers uses cc_switch.proxy.server, so a change to cc_switch.proxy.server can break cc_switch.proxy.handlers, while a change to cc_switch.proxy.handlers can't break cc_switch.proxy.server.
Position
Below the diagonal: cc_switch.proxy.handlers uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.claude_editor uses cc_switch.live.patch, so a change to cc_switch.live.patch can break cc_switch.services.provider.claude_editor, while a change to cc_switch.services.provider.claude_editor can't break cc_switch.live.patch.
Position
Below the diagonal: cc_switch.services.provider.claude_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.claude_editor uses cc_switch.live.patch.json, so a change to cc_switch.live.patch.json can break cc_switch.services.provider.claude_editor, while a change to cc_switch.services.provider.claude_editor can't break cc_switch.live.patch.json.
Position
Below the diagonal: cc_switch.services.provider.claude_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.claude_editor uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.services.provider.claude_editor, while a change to cc_switch.services.provider.claude_editor can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.services.provider.claude_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.claude_editor uses cc_switch.database, so a change to cc_switch.database can break cc_switch.services.provider.claude_editor, while a change to cc_switch.services.provider.claude_editor can't break cc_switch.database.
Position
Below the diagonal: cc_switch.services.provider.claude_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.claude_editor uses cc_switch.store, so a change to cc_switch.store can break cc_switch.services.provider.claude_editor, while a change to cc_switch.services.provider.claude_editor can't break cc_switch.store.
Position
Below the diagonal: cc_switch.services.provider.claude_editor uses a module listed above it, which is the healthy direction.
cc_switch.commands.misc uses cc_switch.services.claude_account.snapshot.state, so a change to cc_switch.services.claude_account.snapshot.state can break cc_switch.commands.misc, while a change to cc_switch.commands.misc can't break cc_switch.services.claude_account.snapshot.state.
Position
Below the diagonal: cc_switch.commands.misc uses a module listed above it, which is the healthy direction.
cc_switch.commands.misc uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.commands.misc, while a change to cc_switch.commands.misc can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.commands.misc uses a module listed above it, which is the healthy direction.
cc_switch.commands.misc uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.commands.misc, while a change to cc_switch.commands.misc can't break cc_switch.app_config.
Position
Below the diagonal: cc_switch.commands.misc uses a module listed above it, which is the healthy direction.
cc_switch.commands.misc uses cc_switch.database, so a change to cc_switch.database can break cc_switch.commands.misc, while a change to cc_switch.commands.misc can't break cc_switch.database.
Position
Below the diagonal: cc_switch.commands.misc uses a module listed above it, which is the healthy direction.
cc_switch.commands.misc uses cc_switch.services.provider.claude_editor, so a change to cc_switch.services.provider.claude_editor can break cc_switch.commands.misc, while a change to cc_switch.commands.misc can't break cc_switch.services.provider.claude_editor.
Position
Below the diagonal: cc_switch.commands.misc uses a module listed above it, which is the healthy direction.
cc_switch.commands.provider uses cc_switch.services.claude_account.snapshot.state, so a change to cc_switch.services.claude_account.snapshot.state can break cc_switch.commands.provider, while a change to cc_switch.commands.provider can't break cc_switch.services.claude_account.snapshot.state.
Position
Below the diagonal: cc_switch.commands.provider uses a module listed above it, which is the healthy direction.
cc_switch.commands.provider uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.commands.provider, while a change to cc_switch.commands.provider can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.commands.provider uses a module listed above it, which is the healthy direction.
cc_switch.commands.provider uses cc_switch.app_config, so a change to cc_switch.app_config can break cc_switch.commands.provider, while a change to cc_switch.commands.provider can't break cc_switch.app_config.
Position
Below the diagonal: cc_switch.commands.provider uses a module listed above it, which is the healthy direction.
cc_switch.commands.provider uses cc_switch.store, so a change to cc_switch.store can break cc_switch.commands.provider, while a change to cc_switch.commands.provider can't break cc_switch.store.
Position
Below the diagonal: cc_switch.commands.provider uses a module listed above it, which is the healthy direction.
cc_switch.commands.provider uses cc_switch.services.provider.claude_editor, so a change to cc_switch.services.provider.claude_editor can break cc_switch.commands.provider, while a change to cc_switch.commands.provider can't break cc_switch.services.provider.claude_editor.
Position
Below the diagonal: cc_switch.commands.provider uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_editor uses cc_switch.mode.state, so a change to cc_switch.mode.state can break cc_switch.services.provider.codex_editor, while a change to cc_switch.services.provider.codex_editor can't break cc_switch.mode.state.
Position
Below the diagonal: cc_switch.services.provider.codex_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_editor uses cc_switch.provider, so a change to cc_switch.provider can break cc_switch.services.provider.codex_editor, while a change to cc_switch.services.provider.codex_editor can't break cc_switch.provider.
Position
Below the diagonal: cc_switch.services.provider.codex_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_editor uses cc_switch.database, so a change to cc_switch.database can break cc_switch.services.provider.codex_editor, while a change to cc_switch.services.provider.codex_editor can't break cc_switch.database.
Position
Below the diagonal: cc_switch.services.provider.codex_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_editor uses cc_switch.services.provider.codex_direct, so a change to cc_switch.services.provider.codex_direct can break cc_switch.services.provider.codex_editor, while a change to cc_switch.services.provider.codex_editor can't break cc_switch.services.provider.codex_direct.
Position
Below the diagonal: cc_switch.services.provider.codex_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_editor uses cc_switch.store, so a change to cc_switch.store can break cc_switch.services.provider.codex_editor, while a change to cc_switch.services.provider.codex_editor can't break cc_switch.store.
Position
Below the diagonal: cc_switch.services.provider.codex_editor uses a module listed above it, which is the healthy direction.
cc_switch.services.provider.codex_editor uses cc_switch.services.provider.claude_editor, so a change to cc_switch.services.provider.claude_editor can break cc_switch.services.provider.codex_editor, while a change to cc_switch.services.provider.codex_editor can't break cc_switch.services.provider.claude_editor.
Position
Below the diagonal: cc_switch.services.provider.codex_editor uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 52% · Adequate · gated by D1, D2, R3 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
104
High / Critical
A03:2025 — Software Supply Chain Failures
81
High / Critical
A07:2025 — Authentication Failures
6
High / Critical
Roadmap
Top priorities: Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package; Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 157
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 2382
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 231
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 69 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 69 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 2706 of 2770 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 2,626 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 34 test source file(s) (.rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .rs, and the rust executor ran against the .rs half and never executed — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (vitest via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root (4002 tests)): measured (10 flaky) suite(s) did re-run, and came back with 10 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D24 compares a comment's words with the identifiers, literals and constructs of the code it annotates, using English function-word and rationale lexicons. Comments in another script or language were left unread rather than counted as clean.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `REDACTED`, `src/components/providers/forms/ProviderForm.tsx`, `src/components/providers/presentation.ts`, `src/components/sessions/utils.ts`, `src/components/usage/requestLogColumns.ts`, … (+6 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 25 further occurrence(s) are not listed individually; the score already reflects all 65.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. A program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. (rule: missing-tool). The renderer reported: the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): a program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. Last output: "> cc-switch@4.0.31 dev / > pnpm tauri dev / sh: 1: pnpm: not found" No runtime evidence was gathered.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): a program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. Last output: "> cc-switch@4.0.31 dev / > pnpm tauri dev / sh: 1: pnpm: not found" No runtime evidence was gathered.
C2 Access Controls — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 289 further occurrence(s) are not listed individually; the score already reflects all 329.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 239 further occurrence(s) are not listed individually; the score already reflects all 279.
R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 59 further occurrence(s) are not listed individually; the score already reflects all 99.
R7 Dead Code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 14 further occurrence(s) are not listed individually; the score already reflects all 54.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 15 further occurrence(s) are not listed individually; the score already reflects all 55.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 36 further occurrence(s) are not listed individually; the score already reflects all 76.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
339 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw at 280. A further 25 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being ApiFormat::native_value at 25 — they are counted neither in the figure above nor in this dimension's score. 10 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: src-tauri/src/prompt_files.rs (cc_switch::prompt_files::prompt_file_path at 25), src-tauri/src/session_manager/mod.rs (cc_switch::session_manager::load_messages at 20), src/hooks/useSettingsForm.ts (useSettingsForm.normalizeLanguage at 19), src-tauri/src/deeplink/mcp.rs (cc_switch::deeplink::mcp::parse_mcp_apps at 18), src-tauri/src/session_manager/content.rs (cc_switch::session_manager::content::project_dir_for at 18), and 5 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 199 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw (cyclomatic 280). — Refactoring it lifts Cyclomatic Complexity from 3.1 to about 3.4/10.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
514 method(s) exceeded the cognitive complexity threshold of 15; the worst was cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw at 1436.
+ 216 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 14 bodies over 120 down to 120 or less in Cognitive Complexity — start with cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw (cognitive 1436), cc_switch::proxy::providers::streaming::create_anthropic_sse_stream (cognitive 619), RequestForwarder::forward (cognitive 404). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 14 together lifts Cognitive Complexity from 2.0 to about 2.7/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.6 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 205 FunctionTooLong finding(s) in God Classes — start with handlers.rs (7), transform_responses.rs (4), session_usage_codex.rs (3). — One of this dimension's main actionable groups (205 warning-level).
Resolve the 118 FileTooLong finding(s) in God Classes — start with mod.rs (5), codex.rs (3), provider.rs (3). — One of this dimension's main actionable groups (118 warning-level).
Resolve the 42 ClassTooLong finding(s) in God Classes — start with forwarder.rs, REDACTED, CodexFormFields.tsx. — One of this dimension's main actionable groups (42 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
417 duplicated block group(s) detected. 3.4 % of the production lines (16,122 of 480,087) are in a reported copy. A further 241 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. Measured on part of this repository only: .tsx (19% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
+ 198 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 35 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with transform_responses.rs (4), misc.rs (2), codex.rs (2). — One of this dimension's main actionable groups (35 warning-level).
Resolve the 33 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with forwarder.rs (4), streaming_responses.rs (2), codex.rs (2). — One of this dimension's main actionable groups (33 warning-level).
Resolve the 30 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with hermes.rs (3), mod.rs (3), transform.rs (3). — One of this dimension's main actionable groups (30 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
2 production modules (Cargo+npm), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with app_config.rs. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2626 tests. Measured on the JavaScript/TypeScript suite only — at least 34 test source file(s) (.rs) went unread, so its test quality is unmeasured and is not in these counts.
Mock-dominated test: uses the web clipboard first on Linux (#9384) · ×43tests/lib/clipboard.test.ts:44
✓ On the Gold path — maintain.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
38 outdated, 0 yanked direct Cargo dependencies. 74 of 77 direct crates were graded against crates.io (0 not published there, 3 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: aho-corasick · ×38
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
Resolve the 4 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 754 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: src/components/providers/forms/ProviderForm.tsx (54×507=27378); src/App.tsx (68×296=20128); src-tauri/src/proxy/forwarder.rs (64×217=13888) Repeated repair below the complexity floor: src-tauri/src/services/proxy.rs (14 of 23 changes were fixes); src-tauri/src/proxy/providers/codex.rs (14 of 22 changes were fixes); src-tauri/src/claude_desktop_config.rs (10 of 19 changes were fixes)
Resolve the 158 Hotspot finding(s) in Churn × Complexity Hotspots — start with codex.rs (3), provider.rs (3), mod.rs (2). — One of this dimension's main actionable groups (158 warning-level).
Resolve the 33 Repeated repair finding(s) in Churn × Complexity Hotspots — start with proxy.rs, codex.rs, claude_desktop_config.rs. — One of this dimension's main actionable groups (33 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.7 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
90 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src-tauri/src/codex_history_migration.rs. Counted over 704 of the 873 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
1 deducted task-comment markers across 480087 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 128 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with package.json. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
3 naming inconsistencies among 172 declarations measured against a convention their peers follow.
`baseURL` spells `URL` where 147 names in the project spell it `Url` · ×2src/config/geminiProviderPresets.ts:22
`formatJSON` spells `JSON` where 22 names in the project spell it `Json`src/utils/formatters.ts:7
What to do
Resolve the 2 `baseURL` spells `URL` where 147 names in the project spell it `Url` finding(s) in Naming Consistency — start with geminiProviderPresets.ts, types.ts. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 `formatJSON` spells `JSON` where 22 names in the project spell it `Json` finding(s) in Naming Consistency — start with formatters.ts. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
doc comments repeat the namessrc/config/openclawProviderPresets.ts:41
What to do
Resolve the 3 redundant comment finding(s) in Comment Value — start with ClaudeFormFields.tsx, CodexFormFields.tsx, GeminiFormFields.tsx. — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
2 of 2 build units (Cargo, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
104 finding(s): 0 critical, 78 high, 26 medium, 0 low. 31 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 14 file(s) — `src-tauri/src/services/session_usage.rs` (line 1163), `REDACTED` (line 107), `src/components/providers/forms/ProviderForm.tsx`, `src/components/providers/presentation.ts` (line 254, line 406, line 433, …), `src/components/sessions/utils.ts` (line 25), … (+9 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 4 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 7 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 40 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (30), REDACTED (4), REDACTED (4). — One of this dimension's main actionable groups (40 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
No action in Static Analysis (SAST) — all 31 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (31 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 17 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (13), REDACTED (4). — One of this dimension's main actionable groups (17 issue-level).
Resolve the 4 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
2 of 704 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/lib/requestOverrides.ts. Counted over 704 of the 873 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned file · ×2src/lib/requestOverrides.ts:1
Orphaned files with no living knowledge
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 11 Boundary-crossing change coupling finding(s) in Change Coupling — start with opencodeProviderPresets.ts (3), claudeProviderPresets.ts (2), codexProviderPresets.ts (2). — One of this dimension's main actionable groups (11 issue-level).
Resolve the 20 Change coupling finding(s) in Change Coupling — start with claudeProviderPresets.ts (2), ClaudeStackModelsField.tsx, ProviderStatsTable.tsx. — One of this dimension's main actionable groups (20 warning-level).
Resolve the 10 Change-coupling hub finding(s) in Change Coupling — start with ModelStatsTable.tsx, codexProviderPresets.ts, settings.rs. — One of this dimension's main actionable groups (10 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
1 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 45 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d44_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Do you agree with this assessment?
AC2 · Forms & labels5.3 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×3) — deplink.html:586, deplink.html:785, deplink.html:796
This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×9) — src/components/apps/AppsPage.tsx:887, src/components/apps/AppsPage.tsx:907, src/components/openclaw/AgentsDefaultsPanel.tsx:241, …
This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×13) — src/components/deeplink/McpConfirmation.tsx:82, src/components/deeplink/McpConfirmation.tsx:98, src/components/deeplink/PromptConfirmation.tsx:29, …
This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it. (×3) — src/components/providers/forms/CodexFormFields.tsx:598, src/components/providers/forms/CopilotAuthSection.tsx:192, src/components/providers/forms/XaiOAuthSection.tsx:254
A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. (×5) — src/components/providers/forms/CopilotProviderForm.tsx:915, src/components/providers/forms/KimiProviderForm.tsx:519, src/components/providers/forms/McodeProviderForm.tsx:301, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). — src/components/providers/forms/EndpointSpeedTest.tsx:631
This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×4) — src/components/providers/forms/LocalProxyRequestOverridesField.tsx:47, src/components/providers/forms/LocalProxyRequestOverridesField.tsx:70, src/components/providers/forms/OmoFormFields.tsx:707, …
This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. — src/components/providers/forms/OmoFormFields.tsx:1204
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — src/components/sessions/reader/SessionMarkdown.tsx:1003
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Do you agree with this assessment?
AC3 · Page structure7.7 / 10Strong✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — deplink.html:404
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. — src/components/providers/forms/EndpointSpeedTest.tsx:578
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. (×2) — src/components/quota/QuotaLines.tsx:420, src/components/usage/UsageHeatmap.tsx:387
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×6) — src/components/quota/QuotaLines.tsx:587, src/components/usage/RequestLogTable.tsx:615, src/components/usage/UsageDateRangePicker.tsx:269, …
This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabIndex={0} in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabIndex={0}="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it. — src/components/usage/ModelsDevPickerDialog.tsx:247
This <div> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control. (×2) — src/components/workspace/DailyMemoryPanel.tsx:483, src/components/workspace/DailyMemoryPanel.tsx:532
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.toast` moves (`animation: tin 200ms cubic-bezier(.4, 0, .2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — deplink.html:306
`.btn.solid` sets color: #ffffff on background-color: #ea580c — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — deplink.html:174
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — src/components/providers/forms/OmoFormFields.tsx:164
<div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — src/components/universal/UniversalProviderPanel.tsx:244
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×2) — src/components/usage/TablePagination.tsx:112, src/tray-panel/TrayPanel.tsx:456
`html:not([data-keyboard]) :is(*:not(input, textarea, select, [contenteditable="true"])):focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/index.css:562
`.ui-checkbox::before` moves (`transition: transform 120ms ease-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/index.css:269
`.pi-thinking-popover[data-state="open"]` moves (`animation: pi-thinking-popover-in 260ms cubic-bezier(0.16, 1, 0.3, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/index.css:503
`.pi-thinking-popover[data-state="closed"]` moves (`animation: pi-thinking-popover-out 150ms cubic-bezier(0.4, 0, 1, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/index.css:507
`html[data-layout="floating"] .tp-sub[data-side="right"]` moves (`animation: tp-sub-in-right 140ms ease-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/tray-panel/tray-panel.css:129
`html[data-layout="floating"] .tp-sub[data-side="left"]` moves (`animation: tp-sub-in-left 140ms ease-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/tray-panel/tray-panel.css:132
`row.animate()` moves (`Web Animations API keyframes`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/components/usage/RequestLogTable.tsx:309
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability8.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
`package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — package.json:22
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
What to do
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
Do you agree with this assessment?
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
63 duplicated blocks under src/components/ have copies in at least two of the sibling directories apps, hermes, mcp, openclaw, profiles, prompts (+9 more sibling(s) not listed) — 30 of them are reported below, and 33 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 63 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 63 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 63 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — src/components/mcp/UnifiedMcpPanel.tsx:447
15 duplicated blocks under src/ have copies in at least two of the sibling directories components, config, hooks, lib, tray-panel, utils — 8 of them are reported below, and 7 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 15 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 15 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 15 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — src/config/appConfig.tsx:202
src/components/providers/forms/KimiProviderForm.tsx:98 · src/components/providers/forms/WorkBuddyProviderForm.tsx:57 — the two spans are one implementation copied and then locally edited — 1786 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/KimiProviderForm.tsx:98
src/components/providers/forms/HermesFormFields.tsx:36 · src/components/providers/forms/OpenClawFormFields.tsx:32 — the two spans are one implementation copied and then locally edited — 1753 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/HermesFormFields.tsx:36
src/components/usage/ModelsDevAutoSyncPanel.tsx:105 · src/components/usage/ModelsDevPickerDialog.tsx:73 — the two spans are one implementation copied and then locally edited — 990 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/usage/ModelsDevAutoSyncPanel.tsx:105
src/components/providers/forms/CodexOAuthSection.tsx:133 · src/components/providers/forms/CopilotAuthSection.tsx:121 — the two spans are one implementation copied and then locally edited — 733 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/CodexOAuthSection.tsx:133
src/components/prompts/PiPromptPanel.tsx:171 · src/components/prompts/PromptPanel.tsx:244 — the two spans are one implementation copied and then locally edited — 729 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/prompts/PiPromptPanel.tsx:171
src/components/providers/forms/AgyOAuthSection.tsx:58 · src/components/providers/forms/ClaudeOfficialSection.tsx:179 — the two spans are one implementation copied and then locally edited — 527 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/AgyOAuthSection.tsx:58
src/components/settings/WebdavSyncSection.tsx:1105 · src/components/settings/WebdavSyncSection.tsx:1301 — the two spans are one implementation copied and then locally edited — 413 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/settings/WebdavSyncSection.tsx:1105
src/components/providers/forms/hooks/useHermesFormState.ts:77 · src/components/providers/forms/hooks/useOpenclawFormState.ts:61 — the two spans are one implementation copied and then locally edited — 531 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/hooks/useHermesFormState.ts:77
src/components/usage/ModelStatsTable.tsx:1 · src/components/usage/ProviderStatsTable.tsx:1 — these 2 files are line-for-line copies of one another — 80 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — src/components/usage/ModelStatsTable.tsx:1
src/components/settings/WebdavSyncSection.tsx:1218 · src/components/settings/WebdavSyncSection.tsx:1525 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — src/components/settings/WebdavSyncSection.tsx:1218
src/components/providers/forms/ClaudeFormFields.tsx:951 · src/components/providers/forms/CodexFormFields.tsx:1625 — the two spans are one implementation copied and then locally edited — 233 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/ClaudeFormFields.tsx:951
src/components/providers/forms/CopilotProviderForm.tsx:744 · src/components/providers/forms/WorkBuddyProviderForm.tsx:624 — the two spans are one implementation copied and then locally edited — 282 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/CopilotProviderForm.tsx:744
src/components/providers/forms/RequestHeadersEditor.tsx:36 · src/components/providers/forms/StructuredOptionsEditor.tsx:63 — the two spans are one implementation copied and then locally edited — 284 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/RequestHeadersEditor.tsx:36
src/components/sessions/reader/SessionFinalReply.tsx:74 · src/components/sessions/reader/SessionQuestion.tsx:74 — the two spans are one implementation copied and then locally edited — 244 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/sessions/reader/SessionFinalReply.tsx:74
src/components/workspace/DailyMemoryPanel.tsx:439 · src/components/workspace/DailyMemoryPanel.tsx:497 — the two spans are one implementation copied and then locally edited — 242 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/workspace/DailyMemoryPanel.tsx:439
REDACTED:748 · REDACTED:974 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:748
src/components/prompts/PiNativePromptResources.tsx:664 · src/components/prompts/PromptFormPanel.tsx:187 — the two spans are one implementation copied and then locally edited — 226 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/prompts/PiNativePromptResources.tsx:664
src/components/providers/forms/GeminiConfigSections.tsx:18 · src/components/providers/forms/GeminiConfigSections.tsx:97 — the two spans are one implementation copied and then locally edited — 235 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/GeminiConfigSections.tsx:18
src/components/providers/forms/OpenClawFormFields.tsx:332 · REDACTED:1768 — the two spans are one implementation copied and then locally edited — 192 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/OpenClawFormFields.tsx:332
src/lib/query/mutations.ts:111 · src/lib/query/mutations.ts:266 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/lib/query/mutations.ts:111
src/components/providers/forms/KimiProviderForm.tsx:436 · src/components/providers/forms/McodeProviderForm.tsx:227 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/providers/forms/KimiProviderForm.tsx:436
src/components/openclaw/ToolsPanel.tsx:181 · src/components/openclaw/ToolsPanel.tsx:223 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/openclaw/ToolsPanel.tsx:181
src/components/providers/forms/CodexOAuthSection.tsx:434 · src/components/providers/forms/XaiOAuthSection.tsx:159 — the two spans are one implementation copied and then locally edited — 189 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/components/providers/forms/CodexOAuthSection.tsx:434
src/components/UsageScriptModal.tsx:1433 · src/components/UsageScriptModal.tsx:1524 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/UsageScriptModal.tsx:1433
src/config/piProviderPresets.ts:147 · src/config/piProviderPresets.ts:205 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — src/config/piProviderPresets.ts:147
src/components/mcp/UnifiedMcpPanel.tsx:447 · src/components/skills/UnifiedSkillsPanel.tsx:472 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/mcp/UnifiedMcpPanel.tsx:447
src/config/piProviderPresets.ts:3106 · src/config/piProviderPresets.ts:3179 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — src/config/piProviderPresets.ts:3106
src/components/UsageScriptModal.tsx:1276 · src/components/UsageScriptModal.tsx:1358 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — src/components/UsageScriptModal.tsx:1276
src/components/UsageScriptModal.tsx:1397 · src/components/UsageScriptModal.tsx:1490 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — src/components/UsageScriptModal.tsx:1397
src/components/providers/forms/ClaudeFormFields.tsx:416 · src/components/providers/forms/ClaudeFormFields.tsx:452 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/providers/forms/ClaudeFormFields.tsx:416
src/components/settings/WebdavSyncSection.tsx:1586 · src/components/settings/WebdavSyncSection.tsx:1747 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/components/settings/WebdavSyncSection.tsx:1586
src/components/universal/UniversalProviderFormModal.tsx:190 · src/components/universal/UniversalProviderFormModal.tsx:249 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/universal/UniversalProviderFormModal.tsx:190
src/config/codexProviderPresets.ts:3135 · src/config/codexProviderPresets.ts:3185 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — src/config/codexProviderPresets.ts:3135
src/components/providers/forms/ClaudeDesktopProviderForm.tsx:752 · src/components/providers/forms/ProviderForm.tsx:1588 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — src/components/providers/forms/ClaudeDesktopProviderForm.tsx:752
src/components/settings/WebdavSyncSection.tsx:516 · src/components/settings/WebdavSyncSection.tsx:768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/components/settings/WebdavSyncSection.tsx:516
src/components/AgyAccountQuotaFooter.tsx:7 · src/components/ClaudeAccountQuotaFooter.tsx:8 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/AgyAccountQuotaFooter.tsx:7
src/components/providers/forms/OpenCodeFormFields.tsx:1133 · src/components/providers/forms/OpenCodeFormFields.tsx:1220 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/components/providers/forms/OpenCodeFormFields.tsx:1133
src/config/piProviderPresets.ts:2968 · src/config/piProviderPresets.ts:3023 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — src/config/piProviderPresets.ts:2968
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
ProviderFormFull has cyclomatic complexity 181 and cognitive complexity 157; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ProviderForm.tsx:379
performSubmit has cyclomatic complexity 156 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ProviderForm.tsx:1779
ProviderCard has cyclomatic complexity 135 and cognitive complexity 118; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/ProviderCard.tsx:220
CodexFormFields has cyclomatic complexity 127 and cognitive complexity 98; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/CodexFormFields.tsx:637
ClaudeFormFields has cyclomatic complexity 92 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ClaudeFormFields.tsx:196
handleSubmit has cyclomatic complexity 89 and cognitive complexity 124; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ProviderForm.tsx:1375
DeepLinkImportDialog has cyclomatic complexity 87 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/DeepLinkImportDialog.tsx:86
UsageScriptModal has cyclomatic complexity 75 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/UsageScriptModal.tsx:253
(anonymous) has cyclomatic complexity 74 and cognitive complexity 113; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/AddProviderDialog.tsx:254
CopilotProviderForm has cyclomatic complexity 63 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/CopilotProviderForm.tsx:283
ToolRow has cyclomatic complexity 62 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/apps/AppsPage.tsx:736
buildAdditiveSections has cyclomatic complexity 61 and cognitive complexity 135; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/presentation.ts:800
SwitchModePanel has cyclomatic complexity 61 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/mode/SwitchModePanel.tsx:102
UnifiedSkillsPanel has cyclomatic complexity 61 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/skills/UnifiedSkillsPanel.tsx:129
McodeProviderForm has cyclomatic complexity 59 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/McodeProviderForm.tsx:83
handlePresetChange has cyclomatic complexity 58 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ProviderForm.tsx:2298
WebdavSyncSection has cyclomatic complexity 56 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/settings/WebdavSyncSection.tsx:236
KimiProviderForm has cyclomatic complexity 56 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/KimiProviderForm.tsx:111
ProviderList has cyclomatic complexity 55 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/ProviderList.tsx:111
SessionItem has cyclomatic complexity 54 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/sessions/SessionItem.tsx:85
CodexOAuthSection has cyclomatic complexity 54 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/CodexOAuthSection.tsx:78
WorkBuddyProviderForm has cyclomatic complexity 50 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/WorkBuddyProviderForm.tsx:129
handleSubmit has cyclomatic complexity 49 and cognitive complexity 59; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ClaudeDesktopProviderForm.tsx:718
handleTest has cyclomatic complexity 47 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/UsageScriptModal.tsx:617
renderRow has cyclomatic complexity 47 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/usage/RequestLogTable.tsx:371
parseDeepLinkConfigPreview has cyclomatic complexity 46 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/utils/deepLinkConfigPreview.ts:44
SessionManagerPage has cyclomatic complexity 46 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/sessions/SessionManagerPage.tsx:152
McpFormModal has cyclomatic complexity 45 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/mcp/McpFormModal.tsx:127
ClaudeDesktopProviderForm has cyclomatic complexity 45 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/ClaudeDesktopProviderForm.tsx:254
PiPromptPanel has cyclomatic complexity 45 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/prompts/PiPromptPanel.tsx:54
(anonymous) has cyclomatic complexity 44 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/sessions/reader/SessionMarkdown.tsx:936
SessionReader has cyclomatic complexity 42 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/sessions/reader/SessionReader.tsx:161
UnifiedMcpPanel has cyclomatic complexity 42 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/mcp/UnifiedMcpPanel.tsx:148
(anonymous) has cyclomatic complexity 39 and cognitive complexity 105; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/forms/hooks/useOmoModelSource.ts:117
PiProviderForm has cyclomatic complexity 39 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:507
load has cyclomatic complexity 38 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/providers/EditProviderDialog.tsx:139
BlockText has cyclomatic complexity 37 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/sessions/reader/SessionStepDetails.tsx:73
App has cyclomatic complexity 36 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/App.tsx:228
(anonymous) has cyclomatic complexity 35 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/components/sessions/reader/turns.ts:368
submit has cyclomatic complexity 35 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1358
Do you agree with this assessment?
R3 · Large Files2.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
src/config/openclawProviderPresets.ts has 7430 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/openclawProviderPresets.ts:1
src/config/codexProviderPresets.ts has 5113 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/codexProviderPresets.ts:1
src/config/opencodeProviderPresets.ts has 4922 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/opencodeProviderPresets.ts:1
src/config/hermesProviderPresets.ts has 4122 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/hermesProviderPresets.ts:1
src/config/piProviderPresets.ts has 3507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/piProviderPresets.ts:1
src/config/claudeProviderPresets.ts has 3237 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/claudeProviderPresets.ts:1
src/components/providers/forms/ProviderForm.tsx has 3104 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/ProviderForm.tsx:1
src/config/claudeDesktopProviderPresets.ts has 2600 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/claudeDesktopProviderPresets.ts:1
src/components/providers/forms/CodexFormFields.tsx has 2439 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/CodexFormFields.tsx:1
REDACTED has 2283 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
src/components/skills/UnifiedSkillsPanel.tsx has 2059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/skills/UnifiedSkillsPanel.tsx:1
src/App.tsx has 1969 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/App.tsx:1
src/components/settings/WebdavSyncSection.tsx has 1808 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/settings/WebdavSyncSection.tsx:1
src/components/UsageScriptModal.tsx has 1691 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/UsageScriptModal.tsx:1
REDACTED has 1636 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
src/components/sessions/SessionManagerPage.tsx has 1591 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/sessions/SessionManagerPage.tsx:1
src/components/providers/forms/ClaudeDesktopProviderForm.tsx has 1440 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/ClaudeDesktopProviderForm.tsx:1
src/components/mcp/McpFormModal.tsx has 1399 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/mcp/McpFormModal.tsx:1
src/components/providers/forms/ClaudeFormFields.tsx has 1301 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/ClaudeFormFields.tsx:1
src/components/providers/forms/OmoFormFields.tsx has 1259 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/OmoFormFields.tsx:1
src/icons/extracted/metadata.ts has 1238 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/icons/extracted/metadata.ts:1
src/components/providers/forms/OpenCodeFormFields.tsx has 1202 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/OpenCodeFormFields.tsx:1
src/components/mcp/UnifiedMcpPanel.tsx has 1188 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/mcp/UnifiedMcpPanel.tsx:1
src/tray-panel/TrayPanel.tsx has 1152 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/tray-panel/TrayPanel.tsx:1
src/config/geminiProviderPresets.ts has 1104 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/geminiProviderPresets.ts:1
src/components/providers/presentation.ts has 1094 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/presentation.ts:1
src/components/apps/useToolManagement.ts has 1088 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/apps/useToolManagement.ts:1
src/components/providers/forms/CopilotProviderForm.tsx has 1072 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/CopilotProviderForm.tsx:1
src/components/apps/AppsPage.tsx has 1042 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/apps/AppsPage.tsx:1
src/components/sessions/reader/SessionMarkdown.tsx has 1036 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/sessions/reader/SessionMarkdown.tsx:1
src/components/sessions/reader/turns.ts has 1022 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/sessions/reader/turns.ts:1
src/components/skills/SkillsPage.tsx has 1022 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/skills/SkillsPage.tsx:1
src/components/prompts/PiNativePromptResources.tsx has 1007 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/prompts/PiNativePromptResources.tsx:1
src/types.ts has 994 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/types.ts:1
src/components/usage/UsageDashboard.tsx has 984 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/usage/UsageDashboard.tsx:1
src/components/DeepLinkImportDialog.tsx has 981 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/DeepLinkImportDialog.tsx:1
src/config/piModelCatalog.ts has 938 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/piModelCatalog.ts:1
src/components/providers/forms/KimiProviderForm.tsx has 884 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/KimiProviderForm.tsx:1
src/components/providers/forms/ProviderPresetSelector.tsx has 879 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/components/providers/forms/ProviderPresetSelector.tsx:1
src/config/grokBuildProviderPresets.ts has 837 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/config/grokBuildProviderPresets.ts:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage9.9 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×6) — src/components/DatabaseUpgrade.tsx:1, src/types/proxy.ts:1, src/main.tsx:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code8.0 / 10Strong✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Nothing imports this binding — it is safe to review for removal. (×40) — src/components/BrandIcons.tsx:89, src/components/DatabaseUpgrade.tsx:301, src/components/prompts/PiNativePromptResources.tsx:1040, …
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. This repository serves HTTP itself (`.serve_connection(` (src-tauri/src/proxy/server.rs:206)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
Set: Referrer-Policy. Missing: Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each.(−2.0 on this card.) The server: `.serve_connection(` (src-tauri/src/proxy/server.rs:206).
What to do
Add Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options beside the headers the Rust server already sets.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
This `async` body is polled on an executor's worker thread, and `std::thread::sleep` blocks that thread: for the whole delay no other task scheduled on it makes progress — the Rust form of blocking on a task. Use `tokio::time::sleep(…).await` (or the runtime's own timer), which suspends only this task. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the executor with `tokio::task::spawn_blocking(…).await`. — src-tauri/src/services/kimi_oauth/lock.rs:196
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
This function unwraps IPv4-MAPPED IPv6 (`::ffff: (in `extractIpv4Octets`)`, line 130) and rejects `10.0.0.0/8` on its IPv4 path, and it handles some IPv4-in-IPv6 embeddings — but not IPv4-compatible (`::a.b.c.d`) and 6to4 (`2002::/16`): either it never names it, or it names it and returns the verdict its IPv4 path gives public space. So `::10.0.0.1`, `2002:0a00:0001::` name a host inside `10.0.0.0/8`, the range this same function declares non-public, and reach the IPv6 decision at line 168 with the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright. — REDACTED:168
What to do
Each finding names the IPv4 branch that rejects the host and the IPv6 branch that accepts the same host in another notation. Confirm from the two, then unwrap every IPv4-in-IPv6 embedding before classifying, or reject non-native IPv6 outright.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 0/1 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`copyImage` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — src/components/sessions/reader/SessionImageLightbox.tsx:30
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
~0.3 `!` null assertions per 1k TypeScript source lines — 50 assertion(s) across the 165023 source line(s) of the 490 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: src/lib/query/sessions.ts (10), src/components/quota/QuotaLines.tsx (4), src/components/sessions/utils.ts (4). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 32 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 13 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 57 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — AX6 reached only 33% of this repository's production lines — rust (322,673 lines), python (80 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): a program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. Last output: "> cc-switch@4.0.31 dev / > pnpm tauri dev / sh: 1: pnpm: not found" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 11 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the repository root runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (28 value object(s))
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X12 Unreachable branch — X12 reached only 33% of this repository's production lines — rust (322,673 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 33% of this repository's production lines — rust (322,673 lines), python (80 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — X17 reached only 33% of this repository's production lines — rust (322,673 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — X24 reached only 33% of this repository's production lines — rust (322,673 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X25 Inert configuration knob — X25 reached only 33% of this repository's production lines — rust (322,673 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X3 Exception handling — X3 reached only 33% of this repository's production lines — rust (322,673 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
AC2 · Forms & labels· <label> that labels no control · ×13
<label> that labels no control src/components/deeplink/McpConfirmation.tsx:82— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/McpConfirmation.tsx:98— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/PromptConfirmation.tsx:29— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/PromptConfirmation.tsx:36— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/PromptConfirmation.tsx:44— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/PromptConfirmation.tsx:52— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/SkillConfirmation.tsx:16— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/SkillConfirmation.tsx:25— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/deeplink/SkillConfirmation.tsx:34— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/providers/mode/ModeDialog.tsx:283— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/providers/mode/StackSettingsSheet.tsx:115— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/providers/mode/StackSubagentFields.tsx:128— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/components/providers/mode/StackSubagentFields.tsx:163— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
Boundary-crossing change coupling: claudeProviderPresets.ts ↔ metadata.ts src/config/claudeProviderPresets.ts:1— `src/config/claudeProviderPresets.ts` (context config) and `src/icons/extracted/metadata.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 81% of the time (57 of the 70 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 57 shared commits counted here, the most recent 3 are `cd15a164` feat(provider): add Genesis presets for compatible clients (#9269); `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets — run `git show` on any of them.
Boundary-crossing change coupling: claudeProviderPresets.ts ↔ index.ts src/config/claudeProviderPresets.ts:1— `src/config/claudeProviderPresets.ts` (context config) and `src/icons/extracted/index.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 80% of the time (65 of the 81 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 65 shared commits counted here, the most recent 3 are `cd15a164` feat(provider): add Genesis presets for compatible clients (#9269); `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets — run `git show` on any of them.
Boundary-crossing change coupling: codexProviderPresets.ts ↔ metadata.ts src/config/codexProviderPresets.ts:1— `src/config/codexProviderPresets.ts` (context config) and `src/icons/extracted/metadata.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 69% of the time (48 of the 70 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 48 shared commits counted here, the most recent 3 are `cd15a164` feat(provider): add Genesis presets for compatible clients (#9269); `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets — run `git show` on any of them.
Boundary-crossing change coupling: codexProviderPresets.ts ↔ index.ts src/config/codexProviderPresets.ts:1— `src/config/codexProviderPresets.ts` (context config) and `src/icons/extracted/index.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 68% of the time (55 of the 81 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 55 shared commits counted here, the most recent 3 are `cd15a164` feat(provider): add Genesis presets for compatible clients (#9269); `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets — run `git show` on any of them.
Boundary-crossing change coupling: opencodeProviderPresets.ts ↔ metadata.ts src/config/opencodeProviderPresets.ts:1— `src/config/opencodeProviderPresets.ts` (context config) and `src/icons/extracted/metadata.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 66% of the time (46 of the 70 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 46 shared commits counted here, the most recent 3 are `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets; `5a3330c5` feat(presets): add EveryAPI sponsor presets — run `git show` on any of them.
Boundary-crossing change coupling: opencodeProviderPresets.ts ↔ index.ts src/config/opencodeProviderPresets.ts:1— `src/config/opencodeProviderPresets.ts` (context config) and `src/icons/extracted/index.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 64% of the time (52 of the 81 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 52 shared commits counted here, the most recent 3 are `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets; `5a3330c5` feat(presets): add EveryAPI sponsor presets — run `git show` on any of them.
Boundary-crossing change coupling: openclawProviderPresets.ts ↔ metadata.ts src/config/openclawProviderPresets.ts:1— `src/config/openclawProviderPresets.ts` (context config) and `src/icons/extracted/metadata.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 61% of the time (43 of the 70 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 43 shared commits counted here, the most recent 3 are `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets; `5a3330c5` feat(presets): add EveryAPI sponsor presets — run `git show` on any of them.
Boundary-crossing change coupling: openclawProviderPresets.ts ↔ index.ts src/config/openclawProviderPresets.ts:1— `src/config/openclawProviderPresets.ts` (context config) and `src/icons/extracted/index.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 58% of the time (47 of the 81 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 47 shared commits counted here, the most recent 3 are `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets; `5a3330c5` feat(presets): add EveryAPI sponsor presets — run `git show` on any of them.
Boundary-crossing change coupling: opencodeProviderPresets.ts ↔ omo.ts src/config/opencodeProviderPresets.ts:1— `src/config/opencodeProviderPresets.ts` (context config) and `src/types/omo.ts` (context types) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `0877b9e3` Upgrade default Claude Opus model to 4.8; `1684cb32` feat(presets): migrate all aggregator and Bedrock presets to Claude O…; `6a083cdd` fix(omo): adapt to oh-my-openagent rename with backward compatibility… — run `git show` on any of them.
Boundary-crossing change coupling: hermesProviderPresets.ts ↔ metadata.ts src/config/hermesProviderPresets.ts:1— `src/config/hermesProviderPresets.ts` (context config) and `src/icons/extracted/metadata.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 53% of the time (37 of the 70 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 37 shared commits counted here, the most recent 3 are `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets; `5a3330c5` feat(presets): add EveryAPI sponsor presets — run `git show` on any of them.
Boundary-crossing change coupling: claudeDesktopProviderPresets.ts ↔ metadata.ts src/config/claudeDesktopProviderPresets.ts:1— `src/config/claudeDesktopProviderPresets.ts` (context config) and `src/icons/extracted/metadata.ts` (context icons) sit in DIFFERENT parts of the tree yet change together 53% of the time (37 of the 70 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 37 shared commits counted here, the most recent 3 are `9433caab` feat(presets): add OspreyAI as a sponsor; `95e29485` feat(presets): add ClinePass presets; `5a3330c5` feat(presets): add EveryAPI sponsor presets — run `git show` on any of them.
Flaky test: the repository roottests/components/AppsPage.test.tsx::AppsPage concurrent CLI upgrades does not confirm the next queued plan with a held Space — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm ignores a stale model-list response after the request config changes — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm keeps unknown fetched models on Pi defaults when the endpoint changes — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm requires custom model limits instead of inferring Pi metadata — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm reuses the shared model fetch command and lets the user select a real result — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm stores Pi-native request headers without mixing them with API-key auth — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm uses fetched model ownership only as display data, never as capability metadata — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm uses structured Pi-native capabilities and limits in collapsed model details — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/components/PiProviderForm.test.tsx::PiProviderForm writes omp presets without Pi-only fields and edits discovery — Passed 1×, failed 1× across repeated runs.
Flaky test: the repository roottests/integration/App.test.tsx::App integration with MSW navigates OpenClaw and Hermes pages with underline tabs — Passed 1×, failed 1× across repeated runs.
AC2 · Forms & labels· <textarea> without a programmatic label · ×3
<textarea> without a programmatic label deplink.html:586— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label deplink.html:785— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label deplink.html:796— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×2
Click handler on a non-interactive <div> src/components/providers/forms/EndpointSpeedTest.tsx:578— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> src/components/usage/UsageDateRangePicker.tsx:269— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×2
Hover-only interaction on <div> src/components/quota/QuotaLines.tsx:420— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
Hover-only interaction on <div> src/components/usage/UsageHeatmap.tsx:387— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC4 · Keyboard semantics· Click handler on a non-interactive <span> · ×2
Click handler on a non-interactive <span> src/components/quota/QuotaLines.tsx:587— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <span> src/components/usage/UsageHero.tsx:147— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC4 · Keyboard semantics· Click handler on a non-interactive <p> · ×2
Click handler on a non-interactive <p> src/components/workspace/DailyMemoryPanel.tsx:361— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <p> src/components/workspace/WorkspaceFilesPanel.tsx:89— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC4 · Keyboard semantics· Click handler on a <div> nested inside <button> · ×2
Click handler on a <div> nested inside <button> src/components/workspace/DailyMemoryPanel.tsx:483— This <div> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control.
Click handler on a <div> nested inside <button> src/components/workspace/DailyMemoryPanel.tsx:532— This <div> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control.
AC2 · Forms & labels· <button> with no accessible text · ×1
<button> with no accessible text src/components/providers/forms/EndpointSpeedTest.tsx:631— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels· <input> without a programmatic label · ×1
<input> without a programmatic label src/components/sessions/reader/SessionMarkdown.tsx:1003— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics· Clickable role="button" that no keyboard user can reach · ×1
Clickable role="button" that no keyboard user can reach src/components/usage/ModelsDevPickerDialog.tsx:247— This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabIndex={0} in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabIndex={0}="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it.
AC4 · Keyboard semantics· Click handler on a non-interactive <tr> · ×1
Click handler on a non-interactive <tr> src/components/usage/RequestLogTable.tsx:615— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw (cognitive 1436) src-tauri/src/proxy/providers/streaming_responses.rs:2399— cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw has cognitive complexity 1436 (threshold 15). Drivers by points: if/else 216 (1174 pts), loops 35 (216 pts), match/switch 6 (24 pts), boolean chains 22 (nesting depth added 1157). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::streaming::create_anthropic_sse_stream (cognitive 619) src-tauri/src/proxy/providers/streaming.rs:242— cc_switch::proxy::providers::streaming::create_anthropic_sse_stream has cognitive complexity 619 (threshold 15). Drivers by points: if/else 59 (443 pts), loops 23 (169 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 531). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::run (cognitive 184) src-tauri/src/lib.rs:486— cc_switch::run has cognitive complexity 184 (threshold 15). Drivers by points: if/else 73 (116 pts), match/switch 32 (51 pts), loops 8 (11 pts), boolean chains 6 (nesting depth added 65). Of this number, 177 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::services::session_usage_codex::parse_codex_file_with_index (cognitive 144) src-tauri/src/services/session_usage_codex.rs:1252— cc_switch::services::session_usage_codex::parse_codex_file_with_index has cognitive complexity 144 (threshold 15). Drivers by points: if/else 41 (110 pts), match/switch 7 (22 pts), boolean chains 11, loops 1 (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::providers::streaming_gemini::create_anthropic_sse_stream_from_gemini (cognitive 120) src-tauri/src/proxy/providers/streaming_gemini.rs:237— cc_switch::proxy::providers::streaming_gemini::create_anthropic_sse_stream_from_gemini has cognitive complexity 120 (threshold 15). Drivers by points: if/else 30 (105 pts), loops 4 (9 pts), match/switch 2 (6 pts) (nesting depth added 84). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::mcp::codex::import_from_codex (cognitive 115) src-tauri/src/mcp/codex.rs:69— cc_switch::mcp::codex::import_from_codex has cognitive complexity 115 (threshold 15). Drivers by points: if/else 31 (89 pts), loops 5 (15 pts), match/switch 4 (11 pts) (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::transform_responses::responses_to_anthropic_with_web_search_options (cognitive 94) src-tauri/src/proxy/providers/transform_responses.rs:2557— cc_switch::proxy::providers::transform_responses::responses_to_anthropic_with_web_search_options has cognitive complexity 94 (threshold 15). Drivers by points: if/else 27 (76 pts), loops 7 (12 pts), match/switch 2 (6 pts) (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::transform_responses::convert_messages_to_input (cognitive 89) src-tauri/src/proxy/providers/transform_responses.rs:2335— cc_switch::proxy::providers::transform_responses::convert_messages_to_input has cognitive complexity 89 (threshold 15). Drivers by points: if/else 20 (75 pts), loops 3 (7 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 63). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value (cognitive 87) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1424— cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value has cognitive complexity 87 (threshold 15). Drivers by points: if/else 26 (67 pts), loops 4 (9 pts), match/switch 4 (8 pts), boolean chains 3 (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::response_processor::create_logged_passthrough_stream (cognitive 87) src-tauri/src/proxy/response_processor.rs:731— cc_switch::proxy::response_processor::create_logged_passthrough_stream has cognitive complexity 87 (threshold 15). Drivers by points: if/else 17 (49 pts), match/switch 5 (26 pts), loops 3 (11 pts), boolean chains 1 (nesting depth added 61). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::commands::misc::build_tool_search_paths (cognitive 81) src-tauri/src/commands/misc.rs:2696— cc_switch::commands::misc::build_tool_search_paths has cognitive complexity 81 (threshold 15). Drivers by points: if/else 27 (59 pts), loops 7 (22 pts) (nesting depth added 47). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::transform_responses::anthropic_to_responses (cognitive 72) src-tauri/src/proxy/providers/transform_responses.rs:1781— cc_switch::proxy::providers::transform_responses::anthropic_to_responses has cognitive complexity 72 (threshold 15). Drivers by points: if/else 37 (65 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::services::session_usage_codex::sync_single_codex_file (cognitive 72) src-tauri/src/services/session_usage_codex.rs:2314— cc_switch::services::session_usage_codex::sync_single_codex_file has cognitive complexity 72 (threshold 15). Drivers by points: if/else 26 (50 pts), match/switch 5 (12 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages (cognitive 71) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:526— cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages has cognitive complexity 71 (threshold 15). Drivers by points: if/else 16 (55 pts), match/switch 3 (10 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::cache_injector::inject (cognitive 70) src-tauri/src/proxy/cache_injector.rs:9— cc_switch::proxy::cache_injector::inject has cognitive complexity 70 (threshold 15). Drivers by points: if/else 21 (61 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic (cognitive 70) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:242— cc_switch::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic has cognitive complexity 70 (threshold 15). Drivers by points: if/else 34 (60 pts), boolean chains 7, loops 1 (2 pts), match/switch 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::providers::transform_codex_responses_namespace::flatten_request_namespaces (cognitive 69) src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:92— cc_switch::proxy::providers::transform_codex_responses_namespace::flatten_request_namespaces has cognitive complexity 69 (threshold 15). Drivers by points: if/else 26 (61 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::providers::transform::openai_to_anthropic (cognitive 67) src-tauri/src/proxy/providers/transform.rs:656— cc_switch::proxy::providers::transform::openai_to_anthropic has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (53 pts), match/switch 3 (8 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::transform_responses::markdown_code_scan (cognitive 67) src-tauri/src/proxy/providers/transform_responses.rs:775— cc_switch::proxy::providers::transform_responses::markdown_code_scan has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (58 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::streaming_codex_chat::create_responses_sse_stream_from_chat_with_context (cognitive 65) src-tauri/src/proxy/providers/streaming_codex_chat.rs:764— cc_switch::proxy::providers::streaming_codex_chat::create_responses_sse_stream_from_chat_with_context has cognitive complexity 65 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 7 (23 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::proxy::providers::streaming_codex_anthropic::create_responses_sse_stream_from_anthropic_with_context (cognitive 62) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:724— cc_switch::proxy::providers::streaming_codex_anthropic::create_responses_sse_stream_from_anthropic_with_context has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 7 (24 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::proxy::providers::transform::convert_message_to_openai (cognitive 60) src-tauri/src/proxy/providers/transform.rs:423— cc_switch::proxy::providers::transform::convert_message_to_openai has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (47 pts), match/switch 3 (9 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cc_switch::omp_config::edit_provider (cognitive 59) src-tauri/src/omp_config.rs:547— cc_switch::omp_config::edit_provider has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (40 pts), boolean chains 10, loops 5 (9 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::services::session_usage::sync_single_file (cognitive 59) src-tauri/src/services/session_usage.rs:651— cc_switch::services::session_usage::sync_single_file has cognitive complexity 59 (threshold 15). Drivers by points: if/else 20 (35 pts), match/switch 9 (17 pts), boolean chains 4, loops 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cc_switch::session_manager::providers::codex::parse_session_lines (cognitive 58) src-tauri/src/session_manager/providers/codex.rs:1976— cc_switch::session_manager::providers::codex::parse_session_lines has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (48 pts), boolean chains 5, match/switch 2 (3 pts), loops 2 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FunctionTooLong: ProviderForm.ProviderFormFull src/components/providers/forms/ProviderForm.tsx:379— FunctionTooLong — ProviderFormFull runs 2215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2115 over it, 22.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: PiProviderForm.PiProviderForm REDACTED:507— FunctionTooLong — PiProviderForm runs 1469 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1369 over it, 14.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: CodexFormFields.CodexFormFields src/components/providers/forms/CodexFormFields.tsx:637— FunctionTooLong — CodexFormFields runs 1452 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1352 over it, 14.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: WebdavSyncSection.WebdavSyncSection src/components/settings/WebdavSyncSection.tsx:236— FunctionTooLong — WebdavSyncSection runs 1401 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1301 over it, 14.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: App.App src/App.tsx:228— FunctionTooLong — App runs 1367 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1267 over it, 13.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: UnifiedSkillsPanel.UnifiedSkillsPanel src/components/skills/UnifiedSkillsPanel.tsx:129— FunctionTooLong — UnifiedSkillsPanel runs 1313 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1213 over it, 13.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: UsageScriptModal.UsageScriptModal src/components/UsageScriptModal.tsx:253— FunctionTooLong — UsageScriptModal runs 1181 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1081 over it, 11.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SessionManagerPage.SessionManagerPage src/components/sessions/SessionManagerPage.tsx:152— FunctionTooLong — SessionManagerPage runs 1099 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 999 over it, 10.99× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: McpFormModal.McpFormModal src/components/mcp/McpFormModal.tsx:127— FunctionTooLong — McpFormModal runs 1086 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 986 over it, 10.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cc_switch::run src-tauri/src/lib.rs:486— FunctionTooLong — cc_switch::run runs 1057 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 957 over it, 10.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ClaudeDesktopProviderForm.ClaudeDesktopProviderForm src/components/providers/forms/ClaudeDesktopProviderForm.tsx:254— FunctionTooLong — ClaudeDesktopProviderForm runs 976 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 876 over it, 9.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ClaudeFormFields.ClaudeFormFields src/components/providers/forms/ClaudeFormFields.tsx:196— FunctionTooLong — ClaudeFormFields runs 938 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 838 over it, 9.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: UnifiedMcpPanel.UnifiedMcpPanel src/components/mcp/UnifiedMcpPanel.tsx:148— FunctionTooLong — UnifiedMcpPanel runs 892 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 792 over it, 8.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: OmoFormFields.OmoFormFields src/components/providers/forms/OmoFormFields.tsx:315— FunctionTooLong — OmoFormFields runs 810 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 710 over it, 8.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: OpenCodeFormFields.OpenCodeFormFields src/components/providers/forms/OpenCodeFormFields.tsx:312— FunctionTooLong — OpenCodeFormFields runs 752 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 652 over it, 7.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: DeepLinkImportDialog.DeepLinkImportDialog src/components/DeepLinkImportDialog.tsx:86— FunctionTooLong — DeepLinkImportDialog runs 738 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 638 over it, 7.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: CopilotProviderForm.CopilotProviderForm src/components/providers/forms/CopilotProviderForm.tsx:283— FunctionTooLong — CopilotProviderForm runs 689 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 589 over it, 6.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: KimiProviderForm.KimiProviderForm src/components/providers/forms/KimiProviderForm.tsx:111— FunctionTooLong — KimiProviderForm runs 662 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 562 over it, 6.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: UsageDashboard.UsageDashboard src/components/usage/UsageDashboard.tsx:253— FunctionTooLong — UsageDashboard runs 639 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 539 over it, 6.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: WorkBuddyProviderForm.WorkBuddyProviderForm src/components/providers/forms/WorkBuddyProviderForm.tsx:129— FunctionTooLong — WorkBuddyProviderForm runs 600 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 500 over it, 6.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SkillsPage.SkillsPage src/components/skills/SkillsPage.tsx:167— FunctionTooLong — SkillsPage runs 572 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 472 over it, 5.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: UniversalProviderFormModal.UniversalProviderFormModal src/components/universal/UniversalProviderFormModal.tsx:30— FunctionTooLong — UniversalProviderFormModal runs 567 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 467 over it, 5.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SessionReader.SessionReader src/components/sessions/reader/SessionReader.tsx:161— FunctionTooLong — SessionReader runs 544 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 444 over it, 5.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ProviderCard.ProviderCard src/components/providers/ProviderCard.tsx:220— FunctionTooLong — ProviderCard runs 532 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 432 over it, 5.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: TrayPanel.TrayPanel src/tray-panel/TrayPanel.tsx:523— FunctionTooLong — TrayPanel runs 532 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 432 over it, 5.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Hotspot: src/components/providers/forms/ProviderForm.tsx src/components/providers/forms/ProviderForm.tsx:379— src/components/providers/forms/ProviderForm.tsx changed 54 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 507 in ProviderForm.ProviderFormFull at line 379. 16 of those changes were fix/bug commits, and the other 38 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/forms/ProviderForm.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/App.tsx src/App.tsx:228— src/App.tsx changed 68 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 296 in App.App at line 228. 20 of those changes were fix/bug commits, and the other 48 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/App.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/proxy/forwarder.rs src-tauri/src/proxy/forwarder.rs:1543— src-tauri/src/proxy/forwarder.rs changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 217 in RequestForwarder::forward at line 1543. 46 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/forwarder.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/lib.rs src-tauri/src/lib.rs:486— src-tauri/src/lib.rs changed 104 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in cc_switch::run at line 486. 28 of those changes were fix/bug commits, and the other 76 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/forms/CodexFormFields.tsx src/components/providers/forms/CodexFormFields.tsx:637— src/components/providers/forms/CodexFormFields.tsx changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 219 in CodexFormFields.CodexFormFields at line 637. 15 of those changes were fix/bug commits, and the other 27 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/forms/CodexFormFields.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/ProviderCard.tsx src/components/providers/ProviderCard.tsx:220— src/components/providers/ProviderCard.tsx changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 126 in ProviderCard.ProviderCard at line 220. 12 of those changes were fix/bug commits, and the other 36 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/ProviderCard.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/ProviderList.tsx src/components/providers/ProviderList.tsx:111— src/components/providers/ProviderList.tsx changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in ProviderList.ProviderList at line 111. 7 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/ProviderList.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/skills/UnifiedSkillsPanel.tsx src/components/skills/UnifiedSkillsPanel.tsx:129— src/components/skills/UnifiedSkillsPanel.tsx changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 220 in UnifiedSkillsPanel.UnifiedSkillsPanel at line 129. 6 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/skills/UnifiedSkillsPanel.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:507— REDACTED changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 225 in PiProviderForm.PiProviderForm at line 507. 5 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/UsageScriptModal.tsx src/components/UsageScriptModal.tsx:253— src/components/UsageScriptModal.tsx changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 223 in UsageScriptModal.UsageScriptModal at line 253. 5 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/UsageScriptModal.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/AddProviderDialog.tsx src/components/providers/AddProviderDialog.tsx:58— src/components/providers/AddProviderDialog.tsx changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 124 in AddProviderDialog.AddProviderDialog at line 58. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/AddProviderDialog.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/mcp/UnifiedMcpPanel.tsx src/components/mcp/UnifiedMcpPanel.tsx:148— src/components/mcp/UnifiedMcpPanel.tsx changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in UnifiedMcpPanel.UnifiedMcpPanel at line 148. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/mcp/UnifiedMcpPanel.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/services/provider/mod.rs src-tauri/src/services/provider/mod.rs:6410— src-tauri/src/services/provider/mod.rs changed 71 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in ProviderService::update at line 6410. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/provider/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/forms/ClaudeFormFields.tsx src/components/providers/forms/ClaudeFormFields.tsx:196— src/components/providers/forms/ClaudeFormFields.tsx changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 136 in ClaudeFormFields.ClaudeFormFields at line 196. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/forms/ClaudeFormFields.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/DeepLinkImportDialog.tsx src/components/DeepLinkImportDialog.tsx:86— src/components/DeepLinkImportDialog.tsx changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 141 in DeepLinkImportDialog.DeepLinkImportDialog at line 86. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/DeepLinkImportDialog.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/commands/misc.rs src-tauri/src/commands/misc.rs:2696— src-tauri/src/commands/misc.rs changed 72 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in cc_switch::commands::misc::build_tool_search_paths at line 2696. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/commands/misc.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/forms/ClaudeDesktopProviderForm.tsx src/components/providers/forms/ClaudeDesktopProviderForm.tsx:254— src/components/providers/forms/ClaudeDesktopProviderForm.tsx changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 148 in ClaudeDesktopProviderForm.ClaudeDesktopProviderForm at line 254. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/forms/ClaudeDesktopProviderForm.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/mode/SwitchModePanel.tsx src/components/providers/mode/SwitchModePanel.tsx:102— src/components/providers/mode/SwitchModePanel.tsx changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in SwitchModePanel.SwitchModePanel at line 102. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/mode/SwitchModePanel.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/usage/RequestLogTable.tsx src/components/usage/RequestLogTable.tsx:182— src/components/usage/RequestLogTable.tsx changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in RequestLogTable.RequestLogTable at line 182. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/usage/RequestLogTable.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/sessions/SessionManagerPage.tsx src/components/sessions/SessionManagerPage.tsx:152— src/components/sessions/SessionManagerPage.tsx changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 153 in SessionManagerPage.SessionManagerPage at line 152. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/sessions/SessionManagerPage.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/presentation.ts src/components/providers/presentation.ts:800— src/components/providers/presentation.ts changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in presentation.buildAdditiveSections at line 800. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/presentation.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/database/schema.rs src-tauri/src/database/schema.rs:492— src-tauri/src/database/schema.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in Database::apply_schema_migrations_on_conn at line 492. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/database/schema.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/components/providers/EditProviderDialog.tsx src/components/providers/EditProviderDialog.tsx:67— src/components/providers/EditProviderDialog.tsx changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in EditProviderDialog.EditProviderDialog at line 67. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/EditProviderDialog.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/proxy/providers/streaming_responses.rs src-tauri/src/proxy/providers/streaming_responses.rs:2399— src-tauri/src/proxy/providers/streaming_responses.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 280 in cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw at line 2399. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/providers/streaming_responses.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src-tauri/src/services/session_usage_codex.rs src-tauri/src/services/session_usage_codex.rs:1252— src-tauri/src/services/session_usage_codex.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in cc_switch::services::session_usage_codex::parse_codex_file_with_index at line 1252. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/session_usage_codex.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
FileTooLong: config/openclawProviderPresets.ts src/config/openclawProviderPresets.ts— FileTooLong — 5330 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4830 over it, 10.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: commands/misc.rs src-tauri/src/commands/misc.rs— FileTooLong — 4311 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 251 free functions. The bar is 500 significant lines; this is 3811 over it, 8.62× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: config/opencodeProviderPresets.ts src/config/opencodeProviderPresets.ts— FileTooLong — 3739 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3239 over it, 7.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: providers/streaming_responses.rs src-tauri/src/proxy/providers/streaming_responses.rs— FileTooLong — 3376 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2876 over it, 6.75× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: services/skill.rs src-tauri/src/services/skill.rs— FileTooLong — 3225 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2725 over it, 6.45× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: proxy/forwarder.rs src-tauri/src/proxy/forwarder.rs— FileTooLong — 3131 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: RequestForwarder (2 blocks, 356-3632), declaring 63 free functions. The bar is 500 significant lines; this is 2631 over it, 6.26× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: config/hermesProviderPresets.ts src/config/hermesProviderPresets.ts— FileTooLong — 2803 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2303 over it, 5.61× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: config/piProviderPresets.ts src/config/piProviderPresets.ts— FileTooLong — 2556 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2056 over it, 5.11× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/tray.rs src-tauri/src/tray.rs— FileTooLong — 2541 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 96 free functions. The bar is 500 significant lines; this is 2041 over it, 5.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: forms/ProviderForm.tsx src/components/providers/forms/ProviderForm.tsx— FileTooLong — 2533 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: ProviderFormFull (379-3271). The bar is 500 significant lines; this is 2033 over it, 5.07× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: provider/mod.rs src-tauri/src/services/provider/mod.rs— FileTooLong — 2451 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1951 over it, 4.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: proxy/handlers.rs src-tauri/src/proxy/handlers.rs— FileTooLong — 2365 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 64 free functions. The bar is 500 significant lines; this is 1865 over it, 4.73× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 2164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 45 free functions. The bar is 500 significant lines; this is 1664 over it, 4.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: database/schema.rs src-tauri/src/database/schema.rs— FileTooLong — 1979 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 100% of them inside a single declaration: Database (16-4039). The bar is 500 significant lines; this is 1479 over it, 3.96× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: config/claudeDesktopProviderPresets.ts src/config/claudeDesktopProviderPresets.ts— FileTooLong — 1970 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1470 over it, 3.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: forms/CodexFormFields.tsx src/components/providers/forms/CodexFormFields.tsx— FileTooLong — 1953 significant lines (blank, comment-only and punctuation-only lines excluded), about 74% of them inside a single declaration: CodexFormFields (637-2544). The bar is 500 significant lines; this is 1453 over it, 3.91× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: providers/transform_responses.rs src-tauri/src/proxy/providers/transform_responses.rs— FileTooLong — 1914 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 60 free functions. The bar is 500 significant lines; this is 1414 over it, 3.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1894 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: PiProviderForm (507-2352). The bar is 500 significant lines; this is 1394 over it, 3.79× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/codex_config.rs src-tauri/src/codex_config.rs— FileTooLong — 1888 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 107 free functions. The bar is 500 significant lines; this is 1388 over it, 3.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: services/session_usage_codex.rs src-tauri/src/services/session_usage_codex.rs— FileTooLong — 1798 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 51 free functions. The bar is 500 significant lines; this is 1298 over it, 3.60× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: skills/UnifiedSkillsPanel.tsx src/components/skills/UnifiedSkillsPanel.tsx— FileTooLong — 1739 significant lines (blank, comment-only and punctuation-only lines excluded), about 76% of them inside a single declaration: UnifiedSkillsPanel (129-1776). The bar is 500 significant lines; this is 1239 over it, 3.48× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: providers/transform_codex_chat.rs src-tauri/src/proxy/providers/transform_codex_chat.rs— FileTooLong — 1640 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 67 free functions. The bar is 500 significant lines; this is 1140 over it, 3.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs src-tauri/src/lib.rs— FileTooLong — 1586 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 31 free functions. The bar is 500 significant lines; this is 1086 over it, 3.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: settings/WebdavSyncSection.tsx src/components/settings/WebdavSyncSection.tsx— FileTooLong — 1571 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: WebdavSyncSection (236-1917). The bar is 500 significant lines; this is 1071 over it, 3.14× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/App.tsx src/App.tsx— FileTooLong — 1565 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: App (228-2079). The bar is 500 significant lines; this is 1065 over it, 3.13× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw (cyclomatic 280) src-tauri/src/proxy/providers/streaming_responses.rs:2399— cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses_raw has cyclomatic complexity 280 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::run (cyclomatic 132) src-tauri/src/lib.rs:486— cc_switch::run has cyclomatic complexity 132 (threshold 15). Of this number, 125 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::streaming::create_anthropic_sse_stream (cyclomatic 82) src-tauri/src/proxy/providers/streaming.rs:242— cc_switch::proxy::providers::streaming::create_anthropic_sse_stream has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::services::session_usage_codex::parse_codex_file_with_index (cyclomatic 59) src-tauri/src/services/session_usage_codex.rs:1252— cc_switch::services::session_usage_codex::parse_codex_file_with_index has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::session_manager::providers::blocks::normalize_tool (cyclomatic 53) src-tauri/src/session_manager/providers/blocks.rs:63— cc_switch::session_manager::providers::blocks::normalize_tool has cyclomatic complexity 53 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
cc_switch::mcp::codex::import_from_codex (cyclomatic 48) src-tauri/src/mcp/codex.rs:69— cc_switch::mcp::codex::import_from_codex has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value (cyclomatic 47) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1424— cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic (cyclomatic 44) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:242— cc_switch::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::services::session_usage_codex::sync_single_codex_file (cyclomatic 43) src-tauri/src/services/session_usage_codex.rs:2314— cc_switch::services::session_usage_codex::sync_single_codex_file has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::handlers::chat_sse_to_response_value (cyclomatic 41) src-tauri/src/proxy/handlers.rs:3023— cc_switch::proxy::handlers::chat_sse_to_response_value has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cc_switch::proxy::providers::transform_responses::anthropic_to_responses (cyclomatic 39) src-tauri/src/proxy/providers/transform_responses.rs:1781— cc_switch::proxy::providers::transform_responses::anthropic_to_responses has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_responses::responses_to_anthropic_with_web_search_options (cyclomatic 38) src-tauri/src/proxy/providers/transform_responses.rs:2557— cc_switch::proxy::providers::transform_responses::responses_to_anthropic_with_web_search_options has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform::openai_to_anthropic (cyclomatic 36) src-tauri/src/proxy/providers/transform.rs:656— cc_switch::proxy::providers::transform::openai_to_anthropic has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::commands::misc::build_tool_search_paths (cyclomatic 35) src-tauri/src/commands/misc.rs:2696— cc_switch::commands::misc::build_tool_search_paths has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::omp_config::edit_provider (cyclomatic 35) src-tauri/src/omp_config.rs:547— cc_switch::omp_config::edit_provider has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::streaming_gemini::create_anthropic_sse_stream_from_gemini (cyclomatic 34) src-tauri/src/proxy/providers/streaming_gemini.rs:237— cc_switch::proxy::providers::streaming_gemini::create_anthropic_sse_stream_from_gemini has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::services::session_usage::sync_single_file (cyclomatic 34) src-tauri/src/services/session_usage.rs:651— cc_switch::services::session_usage::sync_single_file has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages (cyclomatic 33) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:526— cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::services::provider::codex_direct::plan (cyclomatic 33) src-tauri/src/services/provider/codex_direct.rs:586— cc_switch::services::provider::codex_direct::plan has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_codex_chat::append_responses_item_as_chat_message (cyclomatic 31) src-tauri/src/proxy/providers/transform_codex_chat.rs:844— cc_switch::proxy::providers::transform_codex_chat::append_responses_item_as_chat_message has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_codex_responses_namespace::flatten_request_namespaces (cyclomatic 31) src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:92— cc_switch::proxy::providers::transform_codex_responses_namespace::flatten_request_namespaces has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::providers::transform_responses::convert_messages_to_input (cyclomatic 31) src-tauri/src/proxy/providers/transform_responses.rs:2335— cc_switch::proxy::providers::transform_responses::convert_messages_to_input has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::proxy::handlers::handle_claude_transform (cyclomatic 29) src-tauri/src/proxy/handlers.rs:622— cc_switch::proxy::handlers::handle_claude_transform has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::services::provider::codex_terminal::build (cyclomatic 29) src-tauri/src/services/provider/codex_terminal.rs:108— cc_switch::services::provider::codex_terminal::build has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cc_switch::services::session_usage_pi::parse_pi_file (cyclomatic 28) src-tauri/src/services/session_usage_pi.rs:522— cc_switch::services::session_usage_pi::parse_pi_file has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClassTooLong: RequestForwarder src-tauri/src/proxy/forwarder.rs:356— ClassTooLong — 2040 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 2 blocks, lines 356-3632. The bar is 400 significant lines; this is 1640 over it, 5.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PiProviderForm REDACTED:1— ClassTooLong — 1469 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 1069 over it, 3.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CodexFormFields src/components/providers/forms/CodexFormFields.tsx:1— ClassTooLong — 1452 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 1052 over it, 3.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WebdavSyncSection src/components/settings/WebdavSyncSection.tsx:1— ClassTooLong — 1401 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 1001 over it, 3.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: App src/App.tsx:1— ClassTooLong — 1367 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 967 over it, 3.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UnifiedSkillsPanel src/components/skills/UnifiedSkillsPanel.tsx:1— ClassTooLong — 1313 significant lines (blank, comment-only and punctuation-only lines excluded), 8 methods. The bar is 400 significant lines; this is 913 over it, 3.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UsageScriptModal src/components/UsageScriptModal.tsx:1— ClassTooLong — 1181 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 781 over it, 2.95× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SessionManagerPage src/components/sessions/SessionManagerPage.tsx:1— ClassTooLong — 1099 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 699 over it, 2.75× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: McpFormModal src/components/mcp/McpFormModal.tsx:1— ClassTooLong — 1086 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 686 over it, 2.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CodexOAuthManager src-tauri/src/proxy/providers/codex_oauth_auth.rs:374— ClassTooLong — 1074 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 374-2104. The bar is 400 significant lines; this is 674 over it, 2.69× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ClaudeDesktopProviderForm src/components/providers/forms/ClaudeDesktopProviderForm.tsx:1— ClassTooLong — 976 significant lines (blank, comment-only and punctuation-only lines excluded), 11 methods. The bar is 400 significant lines; this is 576 over it, 2.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ClaudeFormFields src/components/providers/forms/ClaudeFormFields.tsx:1— ClassTooLong — 938 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 538 over it, 2.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UnifiedMcpPanel src/components/mcp/UnifiedMcpPanel.tsx:1— ClassTooLong — 892 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 492 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: OmoFormFields src/components/providers/forms/OmoFormFields.tsx:1— ClassTooLong — 810 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 410 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BufferedCitationTextState src-tauri/src/proxy/providers/streaming_responses.rs:705— ClassTooLong — 806 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 2 blocks, lines 705-1802. The bar is 400 significant lines; this is 406 over it, 2.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: OpenCodeFormFields src/components/providers/forms/OpenCodeFormFields.tsx:1— ClassTooLong — 752 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 352 over it, 1.88× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DeepLinkImportDialog src/components/DeepLinkImportDialog.tsx:1— ClassTooLong — 738 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 338 over it, 1.85× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CopilotAuthManager src-tauri/src/proxy/providers/copilot_auth.rs:563— ClassTooLong — 721 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 42 methods, 2 blocks, lines 563-1741. The bar is 400 significant lines; this is 321 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CopilotProviderForm src/components/providers/forms/CopilotProviderForm.tsx:1— ClassTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded), 12 methods. The bar is 400 significant lines; this is 289 over it, 1.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: KimiProviderForm src/components/providers/forms/KimiProviderForm.tsx:1— ClassTooLong — 662 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 262 over it, 1.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UsageDashboard src/components/usage/UsageDashboard.tsx:1— ClassTooLong — 639 significant lines (blank, comment-only and punctuation-only lines excluded), 8 methods. The bar is 400 significant lines; this is 239 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WorkBuddyProviderForm src/components/providers/forms/WorkBuddyProviderForm.tsx:1— ClassTooLong — 600 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 200 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: McpService src-tauri/src/services/mcp.rs:10— ClassTooLong — 581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 27 methods. The bar is 400 significant lines; this is 181 over it, 1.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SkillsPage src/components/skills/SkillsPage.tsx:1— ClassTooLong — 572 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 172 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UniversalProviderFormModal src/components/universal/UniversalProviderFormModal.tsx:1— ClassTooLong — 567 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 167 over it, 1.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (7 lines × 2) src-tauri/src/commands/auth.rs:276— src-tauri/src/commands/auth.rs:276-282 | src-tauri/src/commands/auth.rs:294-302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/auth.rs:276` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/commands/misc.rs:3387— src-tauri/src/commands/misc.rs:3387-3393 | src-tauri/src/commands/misc.rs:3442-3448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:3387` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/commands/workspace.rs:88— src-tauri/src/commands/workspace.rs:88-94 | src-tauri/src/commands/workspace.rs:263-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src-tauri/src/live/project/codex.rs:314— src-tauri/src/live/project/codex.rs:314-320 | src-tauri/src/live/project/codex.rs:324-330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src-tauri/src/mcp/codex.rs:749— src-tauri/src/mcp/codex.rs:749-755 | src-tauri/src/mcp/codex.rs:765-771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/codex.rs:749` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/codex_chat_history.rs:445— src-tauri/src/proxy/providers/codex_chat_history.rs:445-451 | src-tauri/src/proxy/providers/streaming_gemini.rs:258-265 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_chat_history.rs:445` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:420— src-tauri/src/proxy/providers/streaming_responses.rs:420-426 | src-tauri/src/proxy/providers/streaming_responses.rs:845-851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:420` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform.rs:718— src-tauri/src/proxy/providers/transform.rs:718-724 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1637-1646 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_codex_chat.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:917— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:917-923 | src-tauri/src/proxy/providers/transform_responses.rs:237-243 — before extracting anything, compare `src-tauri/src/proxy/providers/transform_codex_anthropic.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_codex_anthropic.rs:917` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:60— src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:60-66 | src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:127-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:59` calls `trim` and `src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:126` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_gemini.rs:216— src-tauri/src/proxy/providers/transform_gemini.rs:216-222 | src-tauri/src/proxy/providers/transform_gemini.rs:1258-1264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_responses.rs:348— src-tauri/src/proxy/providers/transform_responses.rs:348-354 | src-tauri/src/proxy/providers/transform_responses.rs:435-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_responses.rs:781— src-tauri/src/proxy/providers/transform_responses.rs:781-787 | src-tauri/src/proxy/providers/transform_responses.rs:1081-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_responses.rs:781` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_responses.rs:937— src-tauri/src/proxy/providers/transform_responses.rs:937-943 | src-tauri/src/proxy/providers/transform_responses.rs:1041-1047 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_responses.rs:937` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/services/balance.rs:498— src-tauri/src/services/balance.rs:498-504 | src-tauri/src/services/coding_plan.rs:506-512 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) src-tauri/src/services/provider/mod.rs:8124— src-tauri/src/services/provider/mod.rs:8124-8130 | src-tauri/src/services/provider/mod.rs:8145-8151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/mod.rs:8124` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src-tauri/src/services/provider/pi.rs:185— src-tauri/src/services/provider/pi.rs:185-191 | src-tauri/src/services/provider/pi.rs:209-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src-tauri/src/claude_mcp.rs:90— src-tauri/src/claude_mcp.rs:90-96 | src-tauri/src/gemini_mcp.rs:24-30 — before extracting anything, compare `src-tauri/src/claude_mcp.rs` and `src-tauri/src/gemini_mcp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) src-tauri/src/pi_config/mod.rs:175— src-tauri/src/pi_config/mod.rs:175-181 | src-tauri/src/pi_config/mod.rs:205-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) src-tauri/src/commands/misc.rs:1991— src-tauri/src/commands/misc.rs:1991-1997 | src-tauri/src/session_manager/terminal/mod.rs:148-154 — before extracting anything, compare `src-tauri/src/commands/misc.rs` and `src-tauri/src/session_manager/terminal/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) src-tauri/src/services/coding_plan.rs:1368— src-tauri/src/services/coding_plan.rs:1368-1374 | src-tauri/src/services/s3.rs:91-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) src-tauri/src/commands/s3_sync.rs:33— src-tauri/src/commands/s3_sync.rs:33-39 | src-tauri/src/commands/webdav_sync.rs:38-44 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) src-tauri/src/commands/s3_sync.rs:184— src-tauri/src/commands/s3_sync.rs:184-190 | src-tauri/src/commands/webdav_sync.rs:202-208 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) src-tauri/src/mcp/claude.rs:41— src-tauri/src/mcp/claude.rs:41-47 | src-tauri/src/mcp/gemini.rs:41-47 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/gemini.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) src-tauri/src/proxy/providers/transform_responses.rs:2413— src-tauri/src/proxy/providers/transform_responses.rs:2413-2419 | src-tauri/src/proxy/providers/transform_responses.rs:2436-2447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Repeated repair: src-tauri/src/services/proxy.rs src-tauri/src/services/proxy.rs:277— src-tauri/src/services/proxy.rs changed 23 times in last 90 days and 14 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is ProxyService::live_has_proxy_placeholder at line 277), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): let clients reach local routing through a separate connection address (#7878)”; “fix(proxy): roll back the saved listen address when the restart fails to bind”; “fix(proxy): save global routing settings without clobbering per-app retries and timeouts”; “fix(codex): keep proxy sessions in the same history bucket as direct”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/proxy.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/proxy/providers/codex.rs src-tauri/src/proxy/providers/codex.rs:1168— src-tauri/src/proxy/providers/codex.rs changed 22 times in last 90 days and 14 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is CodexAdapter::extract_base_url at line 1168), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): strip every OpenAI-only Codex field for third-party Responses upstreams”; “fix(proxy): drop Codex-private include markers for third-party upstreams (#9077)”; “fix(codex): reuse the Grok compat layer for GitHub Copilot Responses (#7989)”; “fix(codex): restore reasoning effort after re-enabling (#8998)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/providers/codex.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/claude_desktop_config.rs src-tauri/src/claude_desktop_config.rs:1103— src-tauri/src/claude_desktop_config.rs changed 19 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is cc_switch::claude_desktop_config::normalize_mimo_anthropic_thinking_history at line 1103), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(apps): require Claude.app on macOS to count Claude Desktop as installed”; “fix(claude-desktop): point the official card at claude.com/download”; “fix(claude-desktop): publish claude-haiku-5-5 for the Haiku tier in route mode”; “fix(claude-desktop): write inferenceModels in the UI tier order (#7491)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/claude_desktop_config.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/config.rs src-tauri/src/config.rs:215— src-tauri/src/config.rs changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is cc_switch::config::derive_wsl_home_dir at line 215), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: recover configuration locks and caches after panics (#9483)”; “fix(config): write through symlinked live config files”; “fix(wsl): skip syscalls 9P rejects when piConfigDir targets WSL (#8249)”; “fix(config): let the test home override win over the legacy HOME fallback (#7812)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/config.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/proxy/server.rs src-tauri/src/proxy/server.rs:104— src-tauri/src/proxy/server.rs changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is ProxyServer::start at line 104), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): reject browser-originated requests to the local router”; “fix(proxy): reject upstream URLs that loop back to the proxy itself (#8598)”; “fix(proxy): stop child processes from inheriting the listener socket on Windows”; “fix(codex): keep proxy sessions in the same history bucket as direct”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/server.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/services/provider/codex_editor.rs src-tauri/src/services/provider/codex_editor.rs:412— src-tauri/src/services/provider/codex_editor.rs changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is cc_switch::services::provider::codex_editor::store_into_row at line 412), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(codex): show the on-disk login in the official card's auth.json editor”; “fix(codex): keep a top-level base_url when saving a provider”; “fix(codex): treat model_catalog_json as a plain key field”; “fix(codex): let users switch back to CC Switch's model catalog when aggregation is blocked”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/provider/codex_editor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/model_capabilities.rs src-tauri/src/model_capabilities.rs:19— src-tauri/src/model_capabilities.rs changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is cc_switch::model_capabilities::resolve_image_input_capability at line 19), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): strip non-text media (file/audio) for text-only upstreams (#6274)”; “fix(codex): handle text-only DeepSeek V4 Flash 0731 on OpenRouter (#6194)”; “fix(presets): move MiniMax CN and BaiLing to their current official endpoints”; “fix(pricing): move retired DeepSeek V4 family to the V4.1 Flash tier”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/model_capabilities.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/services/balance.rs src-tauri/src/services/balance.rs:215— src-tauri/src/services/balance.rs changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is cc_switch::services::balance::query_siliconflow at line 215), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(usage): stop treating an empty DeepSeek balance as an expired plan”; “fix(usage): show the balance amount even when it is used up”; “fix(usage): show account balance when a Zhipu account has no coding plan”; “fix(usage): hide empty DeepSeek wallets when another currency has funds”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/balance.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/session_manager/providers/agy.rs src-tauri/src/session_manager/providers/agy.rs:88— src-tauri/src/session_manager/providers/agy.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is cc_switch::session_manager::providers::agy::transcripts_in_root at line 88), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(usage): track sync cursors for Antigravity session transcripts (#9346)”; “fix(ci): keep the WSL2 suite on a stable test root and match UNC catalog pointers”; “fix(agy): let a transcript win over another root's index-only entry”; “fix(ci): make WSL2 checks manual and guard SQLite tests”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/session_manager/providers/agy.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/services/agy_account/quota.rs src-tauri/src/services/agy_account/quota.rs:181— src-tauri/src/services/agy_account/quota.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is cc_switch::services::agy_account::quota::fetch_with at line 181), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agy): pass cloudaicompanionProject in quota lookup and surface region ineligibility (#9414)”; “fix(agy): align account quota endpoint with agy CLI and distinguish Ultra 5x/20x plans (#9319)”; “fix(agy): add Weekly Argon quota limit line (#8913)”; “fix(agy): show Gemini quota when querying Google directly”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/agy_account/quota.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/lib/modelMetadata.ts src/lib/modelMetadata.ts:174— src/lib/modelMetadata.ts changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is modelMetadata.indexModelsDev at line 174), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(models): don't borrow a vendor-hosted entry that points at another vendor”; “fix(models): match old OpenCode Zen/Go addresses to the moved models.dev entries”; “fix(models): cap only borrowed GPT windows and warn on oversized entries”; “fix(presets): cap GPT context windows at the 272K subscription window”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/lib/modelMetadata.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: REDACTED REDACTED:82— REDACTED changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is cc_switch::services::session_usage_opencode::sync_opencode_usage at line 82), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(usage): dedupe Codex request model aliases (#7643)”; “fix(usage): prefer opencode streamed time for session latency (#8410)”; “fix(usage): derive opencode session request latency from message times (#8309)”; “fix(usage): bill Claude 1-hour cache writes at the 1h rate (#7653)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/components/shell/AppPageHeader.tsx src/components/shell/AppPageHeader.tsx:42— src/components/shell/AppPageHeader.tsx changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is AppPageHeader.AppPageHeader at line 42), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): keep the window draggable and its controls clickable while a dialog is open (#9140)”; “fix(linux): restore window dragging and resize feedback (#8092)”; “fix(ui): show compact mode-colored connection badge in header (#8634)”; “fix(windows): avoid native CSS drag regions (#8327)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/shell/AppPageHeader.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/proxy/opaque_state_rectifier.rs src-tauri/src/proxy/opaque_state_rectifier.rs:298— src-tauri/src/proxy/opaque_state_rectifier.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is cc_switch::proxy::opaque_state_rectifier::rectify_opaque_state at line 298), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): retry Claude Responses requests rejected for replayed reasoning”; “fix(proxy): retry Codex requests rejected for a foreign Azure resource”; “fix(proxy): explain unreadable sub-agent tasks instead of emptying them”; “fix(proxy): retry Codex history carrying MiniMax turns on OpenAI-family upstreams”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/opaque_state_rectifier.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/commands/profile.rs src-tauri/src/commands/profile.rs:64— src-tauri/src/commands/profile.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is cc_switch::commands::profile::emit_profile_apply_events at line 64), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): keep the remaining DB-lock-waiting sync commands off the UI thread (#9178)”; “fix(startup): keep database lock waits off the UI thread (#9098)”; “fix(claude-desktop): stop the routing service when leaving a mapping card”; “fix(proxy): keep the routing service running for Claude Desktop model mapping”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/commands/profile.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/lightweight.rs src-tauri/src/lightweight.rs:37— src-tauri/src/lightweight.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is cc_switch::lightweight::exit_lightweight_mode at line 37), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(window): keep the main window inside the monitor work area on launch (#9336)”; “fix(tray): keep lightweight mode across restarts”; “fix(tray): release the tray panel WebView in lightweight mode”; “fix(linux): restore Wayland title-bar controls on first show and tray re-show (#7947)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/lightweight.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/components/ui/dialog.tsx src/components/ui/dialog.tsx:19— src/components/ui/dialog.tsx changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is dialog.DialogOverlay at line 19), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): stop the what's-new dialog from collapsing on macOS and Linux (#9401)”; “fix(ui): keep the window draggable and its controls clickable while a dialog is open (#9140)”; “fix(ui): center dialogs without translate so they stay sharp on 1x displays”; “fix(icon-picker): keep picker clear of macOS traffic lights (#9076)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/ui/dialog.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/proxy/media_sanitizer.rs src-tauri/src/proxy/media_sanitizer.rs:78— src-tauri/src/proxy/media_sanitizer.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is cc_switch::proxy::media_sanitizer::is_unsupported_image_error at line 78), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): strip non-text media (file/audio) for text-only upstreams (#6274)”; “fix(codex): handle text-only DeepSeek V4 Flash 0731 on OpenRouter (#6194)”; “fix(pricing): move retired DeepSeek V4 family to the V4.1 Flash tier”; “fix(codex): mirror vision-capable DeepSeek catalog and un-gate the legacy v4-flash alias (#7286)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/media_sanitizer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/proxy/providers/codex_chat_common.rs src-tauri/src/proxy/providers/codex_chat_common.rs:5— src-tauri/src/proxy/providers/codex_chat_common.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is cc_switch::proxy::providers::codex_chat_common::extract_reasoning_field_text at line 5), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): fall back to Gemini's skip signature on the Gemini Native path”; “fix(proxy): fall back to Gemini's skip signature when a cached one is lost”; “fix(proxy): round-trip Gemini thought signatures on Codex chat tool calls”; “fix(proxy): strip inline <think>/<thinking> blocks on the Claude and Codex chat paths (#7741)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/proxy/providers/codex_chat_common.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/services/provider/codex_client_catalog.rs src-tauri/src/services/provider/codex_client_catalog.rs:351— src-tauri/src/services/provider/codex_client_catalog.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is cc_switch::services::provider::codex_client_catalog::stale_clients at line 351), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(codex): warn about stale Codex clients on Windows without a process table”; “fix(codex): run stale-client detection outside the aggregate stack view (#7892)”; “fix(codex): expose cached-account restart notice outside Stack mode (#8006)”; “fix(codex): keep proxy sessions in the same history bucket as direct”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/provider/codex_client_catalog.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/components/ui/sheet.tsx src/components/ui/sheet.tsx:44— src/components/ui/sheet.tsx changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is sheet.SheetPanel at line 44), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): keep the window draggable and its controls clickable while a dialog is open (#9140)”; “fix(ui): reserve the scrollbar gutter on main scroll areas”; “fix(ui): stop form drawers from closing on an overlay click”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/ui/sheet.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/grok_config.rs src-tauri/src/grok_config.rs:243— src-tauri/src/grok_config.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is cc_switch::grok_config::strip_grok_mcp_servers_from_settings at line 243), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(presets): refresh stale default models (grok-4.7, kimi-k3.1-pro, qwen3.7-plus) (#9193)”; “fix: stop shared config and live files from leaking provider settings”; “fix(grokbuild): keep provider model table selected when backfilling live config”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/grok_config.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/tray-panel/api.ts src/tray-panel/api.ts:132— src/tray-panel/api.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is state at line 132), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tray): show the tray panel without waiting for its data (#9154)”; “fix(tray): align quota bars and show time until reset”; “fix(tray): keep tray panel rows stable and fit scaled displays (#8572)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/tray-panel/api.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/components/providers/forms/ApiKeyInput.tsx src/components/providers/forms/ApiKeyInput.tsx:22— src/components/providers/forms/ApiKeyInput.tsx changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is ApiKeyInput.ApiKeyInput at line 22), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(provider-form): stop macOS from capitalizing typed API keys”; “fix(providers): mark API Key as required where saving checks it”; “fix(providers): show the preset's promotion under the API Key field again”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src/components/providers/forms/ApiKeyInput.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src-tauri/src/services/model_pricing.rs src-tauri/src/services/model_pricing.rs:454— src-tauri/src/services/model_pricing.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is cc_switch::services::model_pricing::update_model_pricing_batch_inner at line 454), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: recover configuration locks and caches after panics (#9483)”; “fix(pricing): give the models.dev fetch time to finish reading the body”; “fix: fetch models.dev through the backend proxy-aware client, fixing sync failures in proxy-only environments (#8739)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 07:28:34 -08:00' --until='2026-11-13 07:28:34 -08:00' --full-history --no-merges -- src-tauri/src/services/model_pricing.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Duplicated block (8 lines × 2) src-tauri/src/commands/auth.rs:513— src-tauri/src/commands/auth.rs:513-520 | src-tauri/src/commands/auth.rs:549-556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/auth.rs:513` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/commands/misc.rs:6643— src-tauri/src/commands/misc.rs:6643-6650 | src-tauri/src/session_manager/terminal/mod.rs:328-335 — before extracting anything, compare `src-tauri/src/commands/misc.rs` and `src-tauri/src/session_manager/terminal/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:6643` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/commands/tool_lifecycle_progress.rs:123— src-tauri/src/commands/tool_lifecycle_progress.rs:123-130 | src-tauri/src/services/claude_account/login.rs:206-213 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) REDACTED:896— REDACTED:896-903 | src-tauri/src/database/dao/profiles.rs:53-60 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:896` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/hermes_config.rs:384— src-tauri/src/hermes_config.rs:384-391 | src-tauri/src/openclaw_config.rs:396-403 — before extracting anything, compare `src-tauri/src/hermes_config.rs` and `src-tauri/src/openclaw_config.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/hermes_config.rs:384` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/jsonc_document.rs:377— src-tauri/src/jsonc_document.rs:377-384 | src-tauri/src/jsonc_document.rs:422-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/jsonc_document.rs:377` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/proxy/forwarder.rs:3524— src-tauri/src/proxy/forwarder.rs:3524-3531 | src-tauri/src/proxy/forwarder.rs:3552-3560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/forwarder.rs:3524` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/proxy/forwarder.rs:4161— src-tauri/src/proxy/forwarder.rs:4161-4168 | src-tauri/src/proxy/forwarder.rs:4183-4190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:2067— src-tauri/src/proxy/providers/codex_oauth_auth.rs:2067-2074 | src-tauri/src/proxy/providers/copilot_auth.rs:1637-1644 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) src-tauri/src/services/profile.rs:222— src-tauri/src/services/profile.rs:222-229 | src-tauri/src/services/profile.rs:231-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/profile.rs:222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:346— src-tauri/src/session_manager/providers/hermes.rs:346-353 | src-tauri/src/session_manager/providers/opencode.rs:244-252 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `src-tauri/src/session_manager/providers/opencode.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/hermes.rs:346` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/session_manager/providers/opencode.rs:705— src-tauri/src/session_manager/providers/opencode.rs:705-712 | src-tauri/src/session_manager/providers/opencode.rs:722-729 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src-tauri/src/mode/controller.rs:1553— src-tauri/src/mode/controller.rs:1553-1560 | src-tauri/src/mode/controller.rs:1567-1574 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mode/controller.rs:1553` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/mode/controller.rs:1550` calls `settled_stack`, `Ok` and `src-tauri/src/mode/controller.rs:1566` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:1935— src-tauri/src/proxy/providers/streaming_responses.rs:1935-1942 | src-tauri/src/proxy/providers/streaming_responses.rs:1946-1953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:1935` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/streaming_responses.rs:1945` calls `tool_item_key_from_event` and `src-tauri/src/proxy/providers/streaming_responses.rs:1934` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src-tauri/src/proxy/forwarder.rs:4064— src-tauri/src/proxy/forwarder.rs:4064-4071 | src-tauri/src/proxy/forwarder.rs:4134-4141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src-tauri/src/services/session_usage_codex.rs:577— src-tauri/src/services/session_usage_codex.rs:577-584 | REDACTED:72-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) src-tauri/src/commands/s3_sync.rs:45— src-tauri/src/commands/s3_sync.rs:45-52 | src-tauri/src/commands/webdav_sync.rs:50-57 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/s3_sync.rs:45` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `existing` to `Option<S3SyncSettings>` in one and `Option<WebDavSyncSettings>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 2) src-tauri/src/proxy/providers/codex.rs:1101— src-tauri/src/proxy/providers/codex.rs:1101-1108 | src-tauri/src/proxy/providers/gemini.rs:129-140 — before extracting anything, compare `src-tauri/src/proxy/providers/codex.rs` and `src-tauri/src/proxy/providers/gemini.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:1101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) src-tauri/src/proxy/providers/transform.rs:409— src-tauri/src/proxy/providers/transform.rs:409-416 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1934-1943 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_codex_chat.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_codex_chat.rs:1934` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/proxy/providers/transform.rs:416` calls `clone` and `src-tauri/src/proxy/providers/transform_codex_chat.rs:1943` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src-tauri/src/deeplink/provider.rs:1013— src-tauri/src/deeplink/provider.rs:1013-1020 | src-tauri/src/deeplink/provider.rs:1044-1052 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/deeplink/provider.rs:1013` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/mcp/codex.rs:391— src-tauri/src/mcp/codex.rs:391-398 | src-tauri/src/mcp/grokbuild.rs:161-168 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/codex.rs:391` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) src-tauri/src/proxy/forwarder.rs:3834— src-tauri/src/proxy/forwarder.rs:3834-3841 | src-tauri/src/proxy/forwarder.rs:4213-4220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src-tauri/src/mcp/validation.rs:30— src-tauri/src/mcp/validation.rs:30-37 | src-tauri/src/mcp/validation.rs:38-45 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/validation.rs:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src-tauri/src/provider.rs:919— src-tauri/src/provider.rs:919-926 | src-tauri/src/provider.rs:1018-1025 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/provider.rs:919` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src-tauri/src/session_manager/content.rs:599— src-tauri/src/session_manager/content.rs:599-606 | src-tauri/src/session_manager/content.rs:696-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) src-tauri/src/commands/provider.rs:82— src-tauri/src/commands/provider.rs:82-86 | src-tauri/src/commands/provider.rs:112-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/provider.rs:82` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/mcp/hermes.rs:143— src-tauri/src/mcp/hermes.rs:143-147 | src-tauri/src/mcp/opencode.rs:155-160 — before extracting anything, compare `src-tauri/src/mcp/hermes.rs` and `src-tauri/src/mcp/opencode.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) src-tauri/src/pi_config/mod.rs:123— src-tauri/src/pi_config/mod.rs:123-128 | src-tauri/src/pi_config/mod.rs:226-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/pi_config/mod.rs:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/responses_late_arguments.rs:32— src-tauri/src/proxy/providers/responses_late_arguments.rs:32-36 | src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:578-582 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/responses_late_arguments.rs:32` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/transform.rs:253— src-tauri/src/proxy/providers/transform.rs:253-257 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:254-261 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/transform.rs:746— src-tauri/src/proxy/providers/transform.rs:746-750 | src-tauri/src/proxy/providers/transform_responses.rs:2726-2730 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:898— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:898-902 | src-tauri/src/proxy/providers/transform_responses.rs:222-226 — before extracting anything, compare `src-tauri/src/proxy/providers/transform_codex_anthropic.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_codex_anthropic.rs:898` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/transform_responses.rs:438— src-tauri/src/proxy/providers/transform_responses.rs:438-442 | src-tauri/src/proxy/providers/transform_responses.rs:1865-1869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_responses.rs:438` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/proxy/providers/transform_responses.rs:1870` calls `get`, `and_then`, `is_some_and` and `src-tauri/src/proxy/providers/transform_responses.rs:443` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) src-tauri/src/services/profile.rs:406— src-tauri/src/services/profile.rs:406-410 | src-tauri/src/services/profile.rs:426-430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/profile.rs:406` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/services/session_usage.rs:656— src-tauri/src/services/session_usage.rs:656-661 | src-tauri/src/services/session_usage_grokbuild.rs:196-200 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) src-tauri/src/services/session_usage_dsh.rs:543— src-tauri/src/services/session_usage_dsh.rs:543-548 | src-tauri/src/services/session_usage_kimi.rs:176-180 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage_dsh.rs:543` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/services/session_usage_pi.rs:472— src-tauri/src/services/session_usage_pi.rs:472-476 | src-tauri/src/services/session_usage_pi.rs:500-504 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage_pi.rs:472` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `flavor` to `&Flavor` in one and `&'static Flavor` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) REDACTED:1097— REDACTED:1097-1102 | REDACTED:1253-1257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1097` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) REDACTED:1525— REDACTED:1525-1529 | REDACTED:1601-1605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:282— src-tauri/src/session_manager/providers/hermes.rs:282-287 | src-tauri/src/session_manager/providers/opencode.rs:749-753 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `src-tauri/src/session_manager/providers/opencode.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) src-tauri/src/session_manager/providers/workbuddy.rs:53— src-tauri/src/session_manager/providers/workbuddy.rs:53-57 | src-tauri/src/session_manager/providers/workbuddy.rs:90-95 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/workbuddy.rs:53` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) src-tauri/src/proxy/forwarder.rs:3807— src-tauri/src/proxy/forwarder.rs:3807-3811 | src-tauri/src/proxy/gemini_url.rs:158-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) src-tauri/src/commands/hermes.rs:35— src-tauri/src/commands/hermes.rs:35-39 | src-tauri/src/commands/openclaw.rs:29-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) src-tauri/src/commands/s3_sync.rs:14— src-tauri/src/commands/s3_sync.rs:14-18 | src-tauri/src/commands/webdav_sync.rs:14-18 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `settings` to `&mut S3SyncSettings` in one and `&mut WebDavSyncSettings` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) src-tauri/src/services/agy_account/mod.rs:673— src-tauri/src/services/agy_account/mod.rs:673-677 | src-tauri/src/services/workbuddy_account/mod.rs:992-1000 — `src-tauri/src/services/agy_account/mod.rs` and `src-tauri/src/services/workbuddy_account/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 2) src-tauri/src/services/s3_auto_sync.rs:72— src-tauri/src/services/s3_auto_sync.rs:72-76 | src-tauri/src/services/webdav_auto_sync.rs:72-76 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `settings` to `&mut S3SyncSettings` in one and `&mut WebDavSyncSettings` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/codex.rs:1219— src-tauri/src/proxy/providers/codex.rs:1219-1223 | src-tauri/src/proxy/providers/codex.rs:1225-1229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:1219` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:159— src-tauri/src/proxy/providers/streaming_responses.rs:159-163 | src-tauri/src/proxy/providers/streaming_responses.rs:251-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/database/mod.rs:334— src-tauri/src/database/mod.rs:334-338 | src-tauri/src/database/mod.rs:343-347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/database/mod.rs:334` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/claude.rs:774— src-tauri/src/proxy/providers/claude.rs:774-778 | src-tauri/src/proxy/providers/gemini.rs:167-171 — before extracting anything, compare `src-tauri/src/proxy/providers/claude.rs` and `src-tauri/src/proxy/providers/gemini.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) src-tauri/src/deeplink/provider.rs:1354— src-tauri/src/deeplink/provider.rs:1354-1359 | src-tauri/src/deeplink/provider.rs:1706-1713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/deeplink/provider.rs:1354` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/dsh_config.rs:373— src-tauri/src/dsh_config.rs:373-378 | src-tauri/src/services/omo.rs:340-345 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/dsh_config.rs:373` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/mode/stack.rs:607— src-tauri/src/mode/stack.rs:607-612 | src-tauri/src/mode/stack.rs:624-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) src-tauri/src/proxy/cache_injector.rs:36— src-tauri/src/proxy/cache_injector.rs:36-41 | src-tauri/src/proxy/cache_injector.rs:60-65 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/cache_injector.rs:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/proxy/copilot_optimizer.rs:316— src-tauri/src/proxy/copilot_optimizer.rs:316-322 | src-tauri/src/proxy/copilot_optimizer.rs:345-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) src-tauri/src/proxy/forwarder.rs:1787— src-tauri/src/proxy/forwarder.rs:1787-1792 | src-tauri/src/proxy/providers/claude.rs:395-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/forwarder.rs:1787` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/proxy/providers/codex_chat_common.rs:7— src-tauri/src/proxy/providers/codex_chat_common.rs:7-12 | src-tauri/src/proxy/providers/codex_chat_common.rs:52-57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_chat_common.rs:7` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/proxy/providers/transform.rs:305— src-tauri/src/proxy/providers/transform.rs:305-310 | src-tauri/src/proxy/providers/transform_responses.rs:1836-1841 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) src-tauri/src/services/env_checker.rs:77— src-tauri/src/services/env_checker.rs:77-82 | src-tauri/src/services/env_checker.rs:93-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/env_checker.rs:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/services/provider/mod.rs:6801— src-tauri/src/services/provider/mod.rs:6801-6806 | src-tauri/src/services/provider/mod.rs:6991-6996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/mod.rs:6801` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) REDACTED:1400— REDACTED:1400-1405 | REDACTED:1514-1519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1400` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/session_manager/providers/dsh.rs:214— src-tauri/src/session_manager/providers/dsh.rs:214-219 | src-tauri/src/session_manager/providers/kimi.rs:261-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/dsh.rs:214` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/proxy/providers/transform_codex_chat.rs:1852— src-tauri/src/proxy/providers/transform_codex_chat.rs:1852-1857 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1873-1878 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) src-tauri/src/services/pi_prompt_files.rs:133— src-tauri/src/services/pi_prompt_files.rs:133-138 | src-tauri/src/services/pi_prompt_files.rs:243-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/pi_prompt_files.rs:133` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/services/provider/codex_client_catalog.rs:140— src-tauri/src/services/provider/codex_client_catalog.rs:140-145 | src-tauri/src/services/provider/codex_official_models.rs:159-164 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) src-tauri/src/services/s3_auto_sync.rs:32— src-tauri/src/services/s3_auto_sync.rs:32-37 | src-tauri/src/services/webdav_auto_sync.rs:32-37 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) src-tauri/src/services/s3_auto_sync.rs:48— src-tauri/src/services/s3_auto_sync.rs:48-53 | src-tauri/src/services/webdav_auto_sync.rs:48-53 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) src-tauri/src/session_manager/providers/copilot.rs:140— src-tauri/src/session_manager/providers/copilot.rs:140-145 | src-tauri/src/session_manager/providers/kimi.rs:306-311 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) REDACTED:240— REDACTED:240-246 | REDACTED:1075-1080 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:240` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) src-tauri/src/services/agy_account/mod.rs:561— src-tauri/src/services/agy_account/mod.rs:561-566 | src-tauri/src/services/workbuddy_account/mod.rs:907-912 — `src-tauri/src/services/agy_account/mod.rs` and `src-tauri/src/services/workbuddy_account/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/agy_account/mod.rs:561` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/mcp/agy.rs:76— src-tauri/src/mcp/agy.rs:76-81 | src-tauri/src/mcp/mcode.rs:49-54 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/mcode.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) src-tauri/src/services/provider/live.rs:1474— src-tauri/src/services/provider/live.rs:1474-1479 | src-tauri/src/services/provider/live.rs:1549-1554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/live.rs:1474` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/mcp/opencode.rs:81— src-tauri/src/mcp/opencode.rs:81-86 | src-tauri/src/mcp/opencode.rs:155-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) src-tauri/src/commands/misc.rs:1907— src-tauri/src/commands/misc.rs:1907-1912 | src-tauri/src/commands/misc.rs:3089-3094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:1907` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src-tauri/src/proxy/providers/transform.rs:708— src-tauri/src/proxy/providers/transform.rs:708-713 | src-tauri/src/proxy/providers/transform_codex_chat.rs:2075-2080 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_codex_chat.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform.rs:708` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/claude_desktop_config.rs:991— src-tauri/src/claude_desktop_config.rs:991-999 | src-tauri/src/proxy/model_mapper.rs:161-169 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/claude_desktop_config.rs:991` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/commands/auth.rs:444— src-tauri/src/commands/auth.rs:444-452 | src-tauri/src/commands/auth.rs:454-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/auth.rs:444` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) src-tauri/src/commands/codex_oauth.rs:111— src-tauri/src/commands/codex_oauth.rs:111-119 | src-tauri/src/commands/xai_oauth.rs:38-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/codex_oauth.rs:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/jsonc_document.rs:306— src-tauri/src/jsonc_document.rs:306-314 | src-tauri/src/jsonc_document.rs:343-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/jsonc_document.rs:306` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/proxy/circuit_breaker.rs:176— src-tauri/src/proxy/circuit_breaker.rs:176-184 | src-tauri/src/proxy/circuit_breaker.rs:206-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/circuit_breaker.rs:176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/proxy/providers/codex.rs:1060— src-tauri/src/proxy/providers/codex.rs:1060-1068 | src-tauri/src/tray.rs:1218-1226 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:1060` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:517— src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:517-525 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:523-531 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:517` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:234— src-tauri/src/proxy/providers/streaming_responses.rs:234-246 | src-tauri/src/proxy/providers/streaming_responses.rs:274-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3005— src-tauri/src/proxy/providers/streaming_responses.rs:3005-3013 | src-tauri/src/proxy/providers/streaming_responses.rs:4241-4249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3005` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/services/kimi_oauth/account.rs:252— src-tauri/src/services/kimi_oauth/account.rs:252-260 | src-tauri/src/services/kimi_oauth/account.rs:270-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src-tauri/src/services/s3_sync.rs:162— src-tauri/src/services/s3_sync.rs:162-170 | src-tauri/src/services/webdav_sync.rs:191-199 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `settings` to `&mut S3SyncSettings` in one and `&mut WebDavSyncSettings` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) src-tauri/src/session_manager/providers/pi_blocks.rs:140— src-tauri/src/session_manager/providers/pi_blocks.rs:140-148 | src-tauri/src/session_manager/providers/pi_blocks.rs:326-334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src-tauri/src/session_manager/providers/workbuddy.rs:48— src-tauri/src/session_manager/providers/workbuddy.rs:48-56 | src-tauri/src/session_manager/providers/workbuddy.rs:73-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/workbuddy.rs:48` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/settings.rs:201— src-tauri/src/settings.rs:201-209 | src-tauri/src/settings.rs:298-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/settings.rs:201` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/services/skill.rs:2525— src-tauri/src/services/skill.rs:2525-2533 | src-tauri/src/services/skill.rs:2599-2607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src-tauri/src/commands/s3_sync.rs:89— src-tauri/src/commands/s3_sync.rs:89-97 | src-tauri/src/commands/webdav_sync.rs:94-102 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src-tauri/src/services/s3_auto_sync.rs:55— src-tauri/src/services/s3_auto_sync.rs:55-63 | src-tauri/src/services/webdav_auto_sync.rs:55-63 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src-tauri/src/deeplink/provider.rs:1450— src-tauri/src/deeplink/provider.rs:1450-1458 | src-tauri/src/deeplink/provider.rs:1591-1599 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/deeplink/provider.rs:1450` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/proxy/providers/claude.rs:797— src-tauri/src/proxy/providers/claude.rs:797-805 | src-tauri/src/proxy/providers/gemini.rs:182-190 — before extracting anything, compare `src-tauri/src/proxy/providers/claude.rs` and `src-tauri/src/proxy/providers/gemini.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/claude.rs:797` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/commands/config.rs:272— src-tauri/src/commands/config.rs:272-280 | src-tauri/src/commands/workspace.rs:350-358 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/config.rs:272` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/openclaw_config.rs:736— src-tauri/src/openclaw_config.rs:736-744 | src-tauri/src/openclaw_config.rs:775-783 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) src-tauri/src/copilot_config.rs:638— src-tauri/src/copilot_config.rs:638-646 | src-tauri/src/copilot_config.rs:712-720 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src-tauri/src/database/schema.rs:3979— src-tauri/src/database/schema.rs:3979-3987 | src-tauri/src/database/schema.rs:4005-4013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/database/schema.rs:3979` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src-tauri/src/hermes_config.rs:370— src-tauri/src/hermes_config.rs:370-378 | src-tauri/src/openclaw_config.rs:382-390 — before extracting anything, compare `src-tauri/src/hermes_config.rs` and `src-tauri/src/openclaw_config.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Change coupling: claudeProviderPresets.ts ↔ presetSearchAliases.ts src/config/claudeProviderPresets.ts:1— `src/config/claudeProviderPresets.ts` and `src/config/presetSearchAliases.ts` change together 100% of the time (10 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `b9fd5d99` feat(presets): move Mistral AI to Large 4 and unhide it; `5c8f4e2e` feat(presets): add OpenAI API key presets; `645f8fa1` feat(presets): add Astron MaaS pay-as-you-go preset for Claude Code — run `git show` on any of them.
Change coupling: ClaudeStackModelsField.tsx ↔ CodexFormFields.tsx src/components/providers/forms/ClaudeStackModelsField.tsx:1— `src/components/providers/forms/ClaudeStackModelsField.tsx` and `src/components/providers/forms/CodexFormFields.tsx` change together 90% of the time (9 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `644b7d5c` feat(forms): show model parameters in the picker and fill picks quietly; `f7244745` feat(forms): pick fetched models in a dialog that can also remove them; `e615a6f4` refactor(forms): make provider form hints follow the app's actual mode — run `git show` on any of them.
Change coupling: ProviderStatsTable.tsx ↔ RequestLogTable.tsx src/components/usage/ProviderStatsTable.tsx:1— `src/components/usage/ProviderStatsTable.tsx` and `src/components/usage/RequestLogTable.tsx` change together 85% of the time (11 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `cb3c9fef` fix(usage): left-align every usage table column and rebalance request…; `a0dd3b39` feat(usage): show first-token time in stats and estimate it without r…; `dd07b8f4` fix(usage): show localized names for session-log usage providers — run `git show` on any of them.
Change coupling: claudeProviderPresets.ts ↔ geminiProviderPresets.ts src/config/claudeProviderPresets.ts:1— `src/config/claudeProviderPresets.ts` and `src/config/geminiProviderPresets.ts` change together 79% of the time (38 of the 48 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 38 shared commits counted here, the most recent 3 are `3494d0d1` chore(presets): add V-API backup endpoints; `eb69e492` feat(presets): add XycAi partner preset across all seven apps; `30409878` chore(presets): add PackyCode backup endpoints — run `git show` on any of them.
Change coupling: opencodeProviderPresets.ts ↔ piProviderPresets.ts src/config/opencodeProviderPresets.ts:1— `src/config/opencodeProviderPresets.ts` and `src/config/piProviderPresets.ts` change together 70% of the time (30 of the 43 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 30 shared commits counted here, the most recent 3 are `0103f4c8` chore(presets): move Qwen pay-as-you-go and Token Plan to the new Maa…; `9433caab` feat(presets): add OspreyAI as a sponsor; `ebdedbee` feat(presets): add ccswitch channel tracking to StreamLake API key links — run `git show` on any of them.
Change coupling: provider.rs ↔ vite-env.d.ts src-tauri/src/commands/provider.rs:1— `src-tauri/src/commands/provider.rs` and `src/vite-env.d.ts` change together 70% of the time (23 of the 33 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `9eb991d0` feat(ui): add drag-and-drop sorting for provider list (#126) (at that commit the file was still `src-tauri/src/commands.rs`); `3b6048b1` feat(config): migrate app_config_dir to Tauri Store for independent m… (at that commit the file was still `src-tauri/src/commands.rs`); `3e4df2c9` feat: add provider usage query with JavaScript scripting support (#101) (at that commit the file was still `src-tauri/src/commands.rs`) — run `git show` on any of them.
Change coupling: coding_plan.rs ↔ codingPlanProviders.ts src-tauri/src/services/coding_plan.rs:1— `src-tauri/src/services/coding_plan.rs` and `src/config/codingPlanProviders.ts` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `6837f361` fix(claude-desktop): use the documented OpenCode Go base URL (#8720); `793e67d9` feat(provider): add Command Code presets and quota support (#7358); `270a4ff3` feat(usage): add OpenCode Go subscription usage query via token plan … — run `git show` on any of them.
Change coupling: misc.rs ↔ OpenTerminalDialog.tsx src-tauri/src/commands/misc.rs:1— `src-tauri/src/commands/misc.rs` and `src/components/providers/OpenTerminalDialog.tsx` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `89409412` feat(terminal): open a Grok Build terminal for the current provider (…; `ebb00da1` feat(terminal): let users append extra arguments when opening a terminal; `6776bc06` feat(terminal): open a Codex terminal from a provider card — run `git show` on any of them.
Change coupling: geminiProviderPresets.ts ↔ opencodeProviderPresets.ts src/config/geminiProviderPresets.ts:1— `src/config/geminiProviderPresets.ts` and `src/config/opencodeProviderPresets.ts` change together 62% of the time (30 of the 48 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 30 shared commits counted here, the most recent 3 are `eb69e492` feat(presets): add XycAi partner preset across all seven apps; `7f028632` feat(presets): restore SudoCode.us to coexist with SudoCode.chat sponsor; `618723b4` feat(presets): promote SudoCode to paid sponsor across six clients — run `git show` on any of them.
Change coupling: session_usage_gemini.rs ↔ REDACTED src-tauri/src/services/session_usage_gemini.rs:1— `src-tauri/src/services/session_usage_gemini.rs` and `REDACTED` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `0b274ec3` fix(usage): dedupe Codex request model aliases (#7643); `533055bb` fix(usage): bill Claude 1-hour cache writes at the 1h rate (#7653); `bcee61be` perf(usage): incremental byte-cursor scan for Claude session logs — run `git show` on any of them.
Change coupling: settings.rs ↔ CodexAuthSettings.tsx src-tauri/src/commands/settings.rs:1— `src-tauri/src/commands/settings.rs` and `src/components/settings/CodexAuthSettings.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `b0e452ff` feat(codex): turn quota protection on by default and add a pause for …; `2c5e5d2c` feat(codex): keep moving official sessions into the shared bucket whi…; `8641cd1d` feat(codex): read compressed session rollouts and add a compression t… — run `git show` on any of them.
Change coupling: CodexFormFields.tsx ↔ useCodexConfigState.ts src/components/providers/forms/CodexFormFields.tsx:1— `src/components/providers/forms/CodexFormFields.tsx` and `src/components/providers/forms/hooks/useCodexConfigState.ts` change together 55% of the time (11 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `62688ab3` feat(codex): let a card keep the official Fast speed tier on GPT rows; `a9e607c3` feat(codex): add sub-agent concurrency limit field to the provider fo…; `e70e844c` feat(codex): let Auto Review use another model — run `git show` on any of them.
Change coupling: PricingConfigPanel.tsx ↔ RequestLogTable.tsx src/components/usage/PricingConfigPanel.tsx:1— `src/components/usage/PricingConfigPanel.tsx` and `src/components/usage/RequestLogTable.tsx` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `cb3c9fef` fix(usage): left-align every usage table column and rebalance request…; `ebd9357c` feat(usage): paginate the request log, provider, model and pricing ta…; `6d077f2a` Revert "feat(usage): paginate the request log, provider, model and pr… — run `git show` on any of them.
Change coupling: REDACTED ↔ ProviderStatsTable.tsx REDACTED:1— `REDACTED` and `src/components/usage/ProviderStatsTable.tsx` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `a0dd3b39` feat(usage): show first-token time in stats and estimate it without r…; `a0be6456` fix(usage): keep provider stats rows distinct across apps (#8032); `c615c3ee` feat(usage): show success rate and speed in model stats — run `git show` on any of them.
Change coupling: claude_mcp.rs ↔ codex.rs src-tauri/src/claude_mcp.rs:1— `src-tauri/src/claude_mcp.rs` and `src-tauri/src/mcp/codex.rs` change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `67bd8f5c` fix(mcp): correct Codex MCP configuration format to [mcp_servers] (at that commit the file was still `src-tauri/src/mcp.rs`); `bfc27349` feat(mcp): add SSE (Server-Sent Events) transport type support (at that commit the file was still `src-tauri/src/mcp.rs`); `c985db8f` feat(mcp): implement unified MCP management for v3.7.0 (at that commit the file was still `src-tauri/src/mcp.rs`) — run `git show` on any of them.
Change coupling: usage.rs ↔ usage.ts src-tauri/src/commands/usage.rs:1— `src-tauri/src/commands/usage.rs` and `src/lib/query/usage.ts` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `5d24fdf9` feat(usage): show all history in the all-time heatmap; `31e5ae3f` feat(sessions): show total tokens and API-price cost in the reader he…; `a75f4795` feat(usage): lift provider/model filters to dashboard-wide scope — run `git show` on any of them.
Change coupling: HermesFormFields.tsx ↔ OpenClawFormFields.tsx src/components/providers/forms/HermesFormFields.tsx:1— `src/components/providers/forms/HermesFormFields.tsx` and `src/components/providers/forms/OpenClawFormFields.tsx` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `ab5d4a12` fix(ui): trim redundant provider and settings helper copy (#8633); `8d7a7415` fix(models): cap only borrowed GPT windows and warn on oversized entries; `e675d586` refactor(providers): share models.dev query options and committable refs — run `git show` on any of them.
Change coupling: tray.rs ↔ GeneralSection.tsx src-tauri/src/tray.rs:1— `src-tauri/src/tray.rs` and `src/components/settings/sections/GeneralSection.tsx` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `51a96e24` feat(i18n): add German as an eighth UI language; `cdca0984` feat(i18n): add Russian community localization (#7788); `752998a6` feat(tray): add a setting to switch between the tray panel and the na… — run `git show` on any of them.
Change coupling: ProviderCard.tsx ↔ subscription.ts src/components/providers/ProviderCard.tsx:1— `src/components/providers/ProviderCard.tsx` and `src/lib/api/subscription.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `88c878ac` feat(claude): show the subscription plan on official cards; `0d6386ed` feat(claude): show each bound account's quota on its card; `15d5dbe0` feat: add Grok official subscription quota query — run `git show` on any of them.
Change coupling: SubscriptionQuotaFooter.tsx ↔ subscription.ts src/components/SubscriptionQuotaFooter.tsx:1— `src/components/SubscriptionQuotaFooter.tsx` and `src/lib/api/subscription.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `0d6386ed` feat(claude): show each bound account's quota on its card; `15d5dbe0` feat: add Grok official subscription quota query; `c4630b5c` feat(providers): add Volcengine Ark usage query with AK/SK signing — run `git show` on any of them.
Duplicated block (11 lines × 2) src-tauri/src/codex_config.rs:1088— src-tauri/src/codex_config.rs:1088-1098 | src-tauri/src/codex_config.rs:1162-1172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) REDACTED:1011— REDACTED:1011-1021 | REDACTED:1153-1163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:872— src-tauri/src/proxy/providers/codex_oauth_auth.rs:872-882 | src-tauri/src/proxy/providers/codex_oauth_auth.rs:917-927 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1913— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1913-1923 | src-tauri/src/proxy/providers/copilot_auth.rs:1437-1447 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/streaming_gemini.rs:71— src-tauri/src/proxy/providers/streaming_gemini.rs:71-81 | src-tauri/src/proxy/providers/transform_gemini.rs:1533-1543 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_gemini.rs:71` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/xai_oauth_auth.rs:296— src-tauri/src/proxy/providers/xai_oauth_auth.rs:296-306 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:520-531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src-tauri/src/services/coding_plan.rs:704— src-tauri/src/services/coding_plan.rs:704-714 | src-tauri/src/services/coding_plan.rs:725-735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:704` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src-tauri/src/services/s3_auto_sync.rs:79— src-tauri/src/services/s3_auto_sync.rs:79-89 | src-tauri/src/services/webdav_auto_sync.rs:79-89 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) REDACTED:734— REDACTED:734-744 | REDACTED:1297-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:734` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) REDACTED:2720— REDACTED:2720-2730 | REDACTED:2746-2756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2720` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) src-tauri/src/session_manager/providers/dsh.rs:189— src-tauri/src/session_manager/providers/dsh.rs:189-199 | src-tauri/src/session_manager/providers/kimi.rs:235-245 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/dsh.rs:189` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) src-tauri/src/services/coding_plan.rs:220— src-tauri/src/services/coding_plan.rs:220-230 | src-tauri/src/services/coding_plan.rs:243-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:475— src-tauri/src/proxy/providers/streaming_responses.rs:475-485 | src-tauri/src/proxy/providers/streaming_responses.rs:969-979 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:136— src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:136-146 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:193-205 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) src-tauri/src/commands/s3_sync.rs:74— src-tauri/src/commands/s3_sync.rs:74-84 | src-tauri/src/commands/webdav_sync.rs:79-89 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) src-tauri/src/services/session_usage_copilot.rs:266— src-tauri/src/services/session_usage_copilot.rs:266-276 | src-tauri/src/services/session_usage_workbuddy.rs:196-207 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:715— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:715-725 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:728-738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_codex_anthropic.rs:715` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src-tauri/src/services/provider/live.rs:1446— src-tauri/src/services/provider/live.rs:1446-1456 | src-tauri/src/services/provider/live.rs:1534-1544 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/live.rs:1446` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src-tauri/src/mcp/codex.rs:413— src-tauri/src/mcp/codex.rs:413-423 | src-tauri/src/mcp/grokbuild.rs:197-207 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/codex.rs:413` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
MethodTooLong: RequestForwarder.forward src-tauri/src/proxy/forwarder.rs:1543— MethodTooLong — forward runs 966 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 866 over it, 9.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.seed_model_pricing src-tauri/src/database/schema.rs:1782— MethodTooLong — seed_model_pricing runs 572 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 472 over it, 5.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TrayTexts.from_language src-tauri/src/tray.rs:201— MethodTooLong — from_language runs 432 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 332 over it, 4.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RequestForwarder.forward_with_retry_inner src-tauri/src/proxy/forwarder.rs:915— MethodTooLong — forward_with_retry_inner runs 420 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 320 over it, 4.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.create_tables_on_conn_unbatched src-tauri/src/database/schema.rs:55— MethodTooLong — create_tables_on_conn_unbatched runs 284 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.get_daily_trends REDACTED:1315— MethodTooLong — get_daily_trends runs 271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.apply_schema_migrations_on_conn src-tauri/src/database/schema.rs:492— MethodTooLong — apply_schema_migrations_on_conn runs 194 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 94 over it, 1.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.get_model_stats REDACTED:1944— MethodTooLong — get_model_stats runs 161 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.get_provider_stats REDACTED:1751— MethodTooLong — get_provider_stats runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CodexOAuthManager.add_account_internal src-tauri/src/proxy/providers/codex_oauth_auth.rs:1691— MethodTooLong — add_account_internal runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PanelTexts.from_language src-tauri/src/tray_panel.rs:102— MethodTooLong — from_language runs 146 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.get_usage_summary_by_app REDACTED:1150— MethodTooLong — get_usage_summary_by_app runs 135 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: BufferedCitationTextState.render_message_part src-tauri/src/proxy/providers/streaming_responses.rs:1653— MethodTooLong — render_message_part runs 118 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.migrate_proxy_config_to_per_app src-tauri/src/database/schema.rs:953— MethodTooLong — migrate_proxy_config_to_per_app runs 113 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Database.migrate_v1_to_v2 src-tauri/src/database/schema.rs:815— MethodTooLong — migrate_v1_to_v2 runs 109 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RequestContext.new src-tauri/src/proxy/handler_context.rs:97— MethodTooLong — new runs 106 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 6 over it, 1.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CodexOAuthManager.resolve_valid_cached_token_under_lock src-tauri/src/proxy/providers/codex_oauth_auth.rs:894— MethodTooLong — resolve_valid_cached_token_under_lock runs 104 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×16
Edited copy of a member (6 corresponding lines) src-tauri/src/proxy/hyper_client.rs:352— src-tauri/src/proxy/hyper_client.rs:352-357 | src-tauri/src/proxy/hyper_client.rs:365-370 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/database/dao/mcp.rs:173— src-tauri/src/database/dao/mcp.rs:173-178 | src-tauri/src/database/dao/profiles.rs:109-115 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/session_manager/providers/blocks.rs:360— src-tauri/src/session_manager/providers/blocks.rs:360-367 | src-tauri/src/services/balance.rs:534-539 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/commands/mod.rs:105— src-tauri/src/commands/mod.rs:105-110 | src-tauri/src/commands/profile.rs:102-107 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/copilot_config.rs:103— src-tauri/src/copilot_config.rs:103-108 | src-tauri/src/kimi_config.rs:89-94 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/commands/custom_icon.rs:23— src-tauri/src/commands/custom_icon.rs:23-28 | src-tauri/src/commands/skill.rs:106-113 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/pi_config/mod.rs:464— src-tauri/src/pi_config/mod.rs:464-471 | src-tauri/src/services/claude_account/shared.rs:280-285 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/commands/skill.rs:208— src-tauri/src/commands/skill.rs:208-213 | src-tauri/src/commands/usage.rs:15-20 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/commands/custom_icon.rs:43— src-tauri/src/commands/custom_icon.rs:43-48 | src-tauri/src/commands/skill.rs:94-99 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/services/exchange_rates.rs:89— src-tauri/src/services/exchange_rates.rs:89-94 | src-tauri/src/services/prompt.rs:13-18 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/proxy/usage/parser.rs:64— src-tauri/src/proxy/usage/parser.rs:64-69 | src-tauri/src/services/session_usage_codex.rs:769-776 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/commands/custom_icon.rs:11— src-tauri/src/commands/custom_icon.rs:11-16 | src-tauri/src/commands/skill.rs:38-43 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/commands/profile.rs:181— src-tauri/src/commands/profile.rs:181-186 | src-tauri/src/commands/provider.rs:1067-1072 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/deeplink/mod.rs:79— src-tauri/src/deeplink/mod.rs:79-84 | src-tauri/src/services/kimi_oauth/mod.rs:869-877 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/services/claude_account/snapshot/state.rs:62— src-tauri/src/services/claude_account/snapshot/state.rs:62-67 | src-tauri/src/services/kimi_oauth/account.rs:59-64 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) src-tauri/src/services/session_usage_pi.rs:986— src-tauri/src/services/session_usage_pi.rs:986-991 | src-tauri/src/session_manager/providers/pi.rs:588-594 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
SkillService::import_from_apps (cognitive 64) src-tauri/src/services/skill.rs:2580— SkillService::import_from_apps has cognitive complexity 64 (threshold 15). Drivers by points: if/else 19 (50 pts), loops 5 (8 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::migrate_storage (cognitive 47) src-tauri/src/services/skill.rs:2139— SkillService::migrate_storage has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (32 pts), match/switch 4 (8 pts), loops 6 (7 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::uninstall (cognitive 42) src-tauri/src/services/skill.rs:1095— SkillService::uninstall has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 5 (10 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SkillService::check_updates_report (cognitive 33) src-tauri/src/services/skill.rs:1453— SkillService::check_updates_report has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 5 (11 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SkillService::update_managed_skill_files (cognitive 33) src-tauri/src/services/skill.rs:1899— SkillService::update_managed_skill_files has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (6 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::update_skill (cognitive 30) src-tauri/src/services/skill.rs:1620— SkillService::update_skill has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 4, loops 3 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::sync_to_app_unlocked (cognitive 24) src-tauri/src/services/skill.rs:3290— SkillService::sync_to_app_unlocked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::toggle_app (cognitive 23) src-tauri/src/services/skill.rs:2441— SkillService::toggle_app has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::extract_repo_archive (cognitive 22) src-tauri/src/services/skill.rs:4308— SkillService::extract_repo_archive has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::resolve_symlinks_in_dir (cognitive 21) src-tauri/src/services/skill.rs:4625— SkillService::resolve_symlinks_in_dir has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 4 (10 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::scan_unmanaged (cognitive 20) src-tauri/src/services/skill.rs:2516— SkillService::scan_unmanaged has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::sync_to_app_dir (cognitive 18) src-tauri/src/services/skill.rs:2998— SkillService::sync_to_app_dir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::install_from_zip (cognitive 17) src-tauri/src/services/skill.rs:4718— SkillService::install_from_zip has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::extract_local_zip_in (cognitive 17) src-tauri/src/services/skill.rs:4877— SkillService::extract_local_zip_in has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillService::get_app_skills_dir (cognitive 16) src-tauri/src/services/skill.rs:686— SkillService::get_app_skills_dir has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×13
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×13
Edited copy of a member (15 corresponding lines) src-tauri/src/services/session_usage_pi.rs:470— src-tauri/src/services/session_usage_pi.rs:470-492 | src-tauri/src/services/session_usage_pi.rs:498-512 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) REDACTED:889— REDACTED:889-903 | src-tauri/src/database/dao/mcp.rs:64-80 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/pi_config/mod.rs:473— src-tauri/src/pi_config/mod.rs:473-489 | src-tauri/src/services/pi_prompt_files.rs:281-295 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/mode/stack.rs:605— src-tauri/src/mode/stack.rs:605-619 | src-tauri/src/mode/stack.rs:622-636 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1564— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1564-1581 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:416-430 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/proxy/providers/transform_codex_chat_moonshot_schema.rs:74— src-tauri/src/proxy/providers/transform_codex_chat_moonshot_schema.rs:74-88 | src-tauri/src/proxy/providers/transform_codex_responses_kimi_history.rs:33-47 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/session_manager/terminal/mod.rs:58— src-tauri/src/session_manager/terminal/mod.rs:58-72 | src-tauri/src/session_manager/terminal/mod.rs:285-305 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/codex_history_migration.rs:1193— src-tauri/src/codex_history_migration.rs:1193-1217 | src-tauri/src/services/session_usage_codex.rs:1159-1173 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/services/coding_plan.rs:1382— src-tauri/src/services/coding_plan.rs:1382-1396 | src-tauri/src/services/s3.rs:105-120 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/commands/config.rs:20— src-tauri/src/commands/config.rs:20-34 | src-tauri/src/commands/config.rs:36-50 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/session_manager/terminal/mod.rs:242— src-tauri/src/session_manager/terminal/mod.rs:242-257 | src-tauri/src/session_manager/terminal/mod.rs:259-273 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/services/stream_check.rs:328— src-tauri/src/services/stream_check.rs:328-342 | src-tauri/src/services/stream_check.rs:345-359 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) src-tauri/src/services/coding_plan.rs:1747— src-tauri/src/services/coding_plan.rs:1747-1761 | REDACTED:90-104 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×13
Edited copy of a member (11 corresponding lines) src-tauri/src/mode/controller.rs:1547— src-tauri/src/mode/controller.rs:1547-1560 | src-tauri/src/mode/controller.rs:1564-1574 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/proxy/copilot_optimizer.rs:520— src-tauri/src/proxy/copilot_optimizer.rs:520-530 | src-tauri/src/proxy/copilot_optimizer.rs:626-642 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/claude_desktop_config.rs:989— src-tauri/src/claude_desktop_config.rs:989-999 | src-tauri/src/proxy/model_mapper.rs:159-169 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/commands/config.rs:324— src-tauri/src/commands/config.rs:324-337 | src-tauri/src/commands/skill.rs:250-260 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/live/project/codex.rs:491— src-tauri/src/live/project/codex.rs:491-501 | src-tauri/src/live/project/codex.rs:504-517 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/commands/misc.rs:2678— src-tauri/src/commands/misc.rs:2678-2691 | src-tauri/src/commands/misc.rs:3301-3311 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/proxy/forwarder.rs:3832— src-tauri/src/proxy/forwarder.rs:3832-3842 | src-tauri/src/proxy/forwarder.rs:4211-4221 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/commands/usage.rs:343— src-tauri/src/commands/usage.rs:343-353 | src-tauri/src/commands/usage.rs:376-389 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/services/workbuddy_account/quota.rs:301— src-tauri/src/services/workbuddy_account/quota.rs:301-314 | src-tauri/src/services/workbuddy_account/quota.rs:320-330 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/agy_config.rs:320— src-tauri/src/agy_config.rs:320-330 | src-tauri/src/commands/misc.rs:6116-6126 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/proxy/providers/transform_codex_chat.rs:570— src-tauri/src/proxy/providers/transform_codex_chat.rs:570-581 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:50-60 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/database/dao/failover.rs:97— src-tauri/src/database/dao/failover.rs:97-107 | src-tauri/src/database/dao/proxy.rs:599-610 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) src-tauri/src/proxy/providers/codex.rs:1020— src-tauri/src/proxy/providers/codex.rs:1020-1030 | src-tauri/src/tray.rs:1245-1260 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
AC2 · Forms & labels· <Select> field component without a label · ×12
<Select> field component without a label src/components/apps/AppsPage.tsx:887— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/apps/AppsPage.tsx:907— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/openclaw/AgentsDefaultsPanel.tsx:241— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/openclaw/AgentsDefaultsPanel.tsx:284— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/openclaw/ToolsPanel.tsx:146— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/providers/forms/ClaudeDesktopProviderForm.tsx:1185— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/providers/forms/ClaudeFormFields.tsx:951— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/providers/forms/CodexFormFields.tsx:598— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label src/components/providers/forms/CodexFormFields.tsx:1625— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label src/components/providers/forms/CopilotAuthSection.tsx:192— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label src/components/providers/forms/XaiOAuthSection.tsx:254— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label src/components/settings/BackupListSection.tsx:183— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×12
Edited copy of a member (13 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_chat.rs:538— src-tauri/src/proxy/providers/streaming_codex_chat.rs:538-550 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:552-564 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/proxy/handlers.rs:2998— src-tauri/src/proxy/handlers.rs:2998-3010 | src-tauri/src/proxy/providers/responses_late_arguments.rs:29-48 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/services/agy_account/oauth.rs:74— src-tauri/src/services/agy_account/oauth.rs:74-86 | src-tauri/src/services/dsh_account.rs:284-298 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/commands/misc.rs:3471— src-tauri/src/commands/misc.rs:3471-3486 | src-tauri/src/commands/misc.rs:3496-3508 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/commands/workspace.rs:138— src-tauri/src/commands/workspace.rs:138-150 | src-tauri/src/commands/workspace.rs:327-340 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/services/kimi_oauth/lock.rs:150— src-tauri/src/services/kimi_oauth/lock.rs:150-162 | src-tauri/src/services/kimi_oauth/lock.rs:165-177 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/services/claude_account/mod.rs:691— src-tauri/src/services/claude_account/mod.rs:691-705 | src-tauri/src/services/claude_account/mod.rs:713-725 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/services/provider/codex_client_catalog.rs:264— src-tauri/src/services/provider/codex_client_catalog.rs:264-276 | src-tauri/src/services/provider/codex_official_models.rs:391-403 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/commands/workspace.rs:119— src-tauri/src/commands/workspace.rs:119-134 | src-tauri/src/commands/workspace.rs:310-322 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/dsh_config.rs:1147— src-tauri/src/dsh_config.rs:1147-1159 | src-tauri/src/dsh_config.rs:1229-1241 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/services/provider/mod.rs:5492— src-tauri/src/services/provider/mod.rs:5492-5504 | src-tauri/src/services/provider/mod.rs:5509-5521 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src-tauri/src/mcp/claude.rs:129— src-tauri/src/mcp/claude.rs:129-142 | src-tauri/src/mcp/gemini.rs:125-137 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×12
Edited copy of a member (8 corresponding lines) src-tauri/src/services/agy_account/mod.rs:559— src-tauri/src/services/agy_account/mod.rs:559-566 | src-tauri/src/services/workbuddy_account/mod.rs:905-912 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/services/agy_account/oauth.rs:177— src-tauri/src/services/agy_account/oauth.rs:177-186 | src-tauri/src/services/dsh_account.rs:602-609 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/proxy/providers/transform_codex_chat.rs:1752— src-tauri/src/proxy/providers/transform_codex_chat.rs:1752-1760 | src-tauri/src/proxy/providers/codex_chat_common.rs:288-295 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/commands/failover.rs:11— src-tauri/src/commands/failover.rs:11-18 | src-tauri/src/commands/proxy.rs:12-19 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/commands/session_manager.rs:136— src-tauri/src/commands/session_manager.rs:136-144 | src-tauri/src/commands/session_manager.rs:152-159 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/codex_config.rs:922— src-tauri/src/codex_config.rs:922-929 | src-tauri/src/grok_config.rs:66-80 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/commands/skill.rs:121— src-tauri/src/commands/skill.rs:121-128 | src-tauri/src/commands/skill.rs:451-458 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/tray.rs:1047— src-tauri/src/tray.rs:1047-1057 | src-tauri/src/services/provider/mod.rs:5415-5422 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/commands/settings.rs:272— src-tauri/src/commands/settings.rs:272-280 | src-tauri/src/commands/import_export.rs:233-240 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1376— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1376-1383 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:403-410 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/copilot_config.rs:853— src-tauri/src/copilot_config.rs:853-862 | src-tauri/src/services/provider/codex_direct.rs:940-947 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) src-tauri/src/mcode_config.rs:21— src-tauri/src/mcode_config.rs:21-28 | src-tauri/src/proxy/forwarder.rs:132-139 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (15 lines × 2) src-tauri/src/app_config.rs:135— src-tauri/src/app_config.rs:135-149 | src-tauri/src/app_config.rs:280-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 2) src-tauri/src/live/project/codex.rs:943— src-tauri/src/live/project/codex.rs:943-957 | src-tauri/src/live/project/grok.rs:282-296 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/live/project/codex.rs:943` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src-tauri/src/proxy/providers/codex.rs:1113— src-tauri/src/proxy/providers/codex.rs:1113-1127 | src-tauri/src/proxy/providers/gemini.rs:134-148 — before extracting anything, compare `src-tauri/src/proxy/providers/codex.rs` and `src-tauri/src/proxy/providers/gemini.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:1113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3447— src-tauri/src/proxy/providers/streaming_responses.rs:3447-3461 | src-tauri/src/proxy/providers/streaming_responses.rs:3502-3516 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3447` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src-tauri/src/services/s3_auto_sync.rs:158— src-tauri/src/services/s3_auto_sync.rs:158-172 | src-tauri/src/services/webdav_auto_sync.rs:167-181 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/s3_auto_sync.rs:158` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) REDACTED:1435— REDACTED:1435-1449 | REDACTED:1634-1648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) src-tauri/src/session_manager/providers/codex.rs:2005— src-tauri/src/session_manager/providers/codex.rs:2005-2019 | src-tauri/src/session_manager/providers/openclaw.rs:173-187 — before extracting anything, compare `src-tauri/src/session_manager/providers/codex.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) src-tauri/src/session_manager/providers/opencode.rs:235— src-tauri/src/session_manager/providers/opencode.rs:235-249 | src-tauri/src/session_manager/providers/opencode.rs:269-283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) src-tauri/src/database/schema.rs:622— src-tauri/src/database/schema.rs:622-636 | src-tauri/src/database/schema.rs:682-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/database/schema.rs:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src-tauri/src/services/session_usage.rs:985— src-tauri/src/services/session_usage.rs:985-999 | src-tauri/src/services/session_usage.rs:1082-1096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage.rs:985` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15 lines × 2) src-tauri/src/services/s3_sync.rs:65— src-tauri/src/services/s3_sync.rs:65-79 | src-tauri/src/services/webdav_sync.rs:88-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/s3_sync.rs:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `settings` to `&mut S3SyncSettings` in one and `&mut WebDavSyncSettings` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15 lines × 2) src-tauri/src/live/project/grok.rs:233— src-tauri/src/live/project/grok.rs:233-247 | src-tauri/src/live/project/grok.rs:344-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/live/project/grok.rs:233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/mcp/hermes.rs:287— src-tauri/src/mcp/hermes.rs:287-299 | src-tauri/src/mcp/opencode.rs:231-243 — before extracting anything, compare `src-tauri/src/mcp/hermes.rs` and `src-tauri/src/mcp/opencode.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/hermes.rs:287` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) src-tauri/src/mcp/kimi.rs:70— src-tauri/src/mcp/kimi.rs:70-82 | src-tauri/src/mcp/mcode.rs:55-67 — before extracting anything, compare `src-tauri/src/mcp/kimi.rs` and `src-tauri/src/mcp/mcode.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/kimi.rs:70` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/proxy/forwarder.rs:3181— src-tauri/src/proxy/forwarder.rs:3181-3193 | src-tauri/src/proxy/forwarder.rs:3208-3220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1927— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1927-1939 | src-tauri/src/proxy/providers/copilot_auth.rs:1460-1472 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1927` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3291— src-tauri/src/proxy/providers/streaming_responses.rs:3291-3303 | src-tauri/src/proxy/providers/streaming_responses.rs:4149-4161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3291` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/proxy/providers/transform.rs:860— src-tauri/src/proxy/providers/transform.rs:860-872 | src-tauri/src/proxy/providers/transform_responses.rs:2843-2855 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform.rs:860` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/session_manager/providers/opencode.rs:585— src-tauri/src/session_manager/providers/opencode.rs:585-597 | src-tauri/src/session_manager/providers/opencode.rs:879-891 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/opencode.rs:585` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/usage_script.rs:70— src-tauri/src/usage_script.rs:70-82 | src-tauri/src/usage_script.rs:145-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/usage_script.rs:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src-tauri/src/mcp/claude.rs:145— src-tauri/src/mcp/claude.rs:145-157 | src-tauri/src/mcp/gemini.rs:140-152 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/gemini.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) src-tauri/src/session_manager/terminal/mod.rs:35— src-tauri/src/session_manager/terminal/mod.rs:35-47 | src-tauri/src/session_manager/terminal/mod.rs:157-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src-tauri/src/services/skill.rs:1071— src-tauri/src/services/skill.rs:1071-1084 | src-tauri/src/services/skill.rs:4845-4857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/skill.rs:1071` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) src-tauri/src/mcp/claude.rs:79— src-tauri/src/mcp/claude.rs:79-91 | src-tauri/src/mcp/gemini.rs:75-87 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/gemini.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/claude.rs:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ProviderService::update (cognitive 67) src-tauri/src/services/provider/mod.rs:6410— ProviderService::update has cognitive complexity 67 (threshold 15). Drivers by points: if/else 28 (54 pts), boolean chains 8, match/switch 2 (5 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::add (cognitive 40) src-tauri/src/services/provider/mod.rs:5789— ProviderService::add has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (31 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::delete (cognitive 35) src-tauri/src/services/provider/mod.rs:6749— ProviderService::delete has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 2 (6 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::validate_provider_settings (cognitive 33) src-tauri/src/services/provider/mod.rs:8265— ProviderService::validate_provider_settings has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::list (cognitive 31) src-tauri/src/services/provider/mod.rs:5528— ProviderService::list has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::remove_from_live_config (cognitive 30) src-tauri/src/services/provider/mod.rs:6924— ProviderService::remove_from_live_config has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::switch_normal (cognitive 27) src-tauri/src/services/provider/mod.rs:7227— ProviderService::switch_normal has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (18 pts), match/switch 3 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProviderService::save_native_provider (cognitive 22) src-tauri/src/services/provider/mod.rs:5680— ProviderService::save_native_provider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::scrub_leaked_gemini_common_config (cognitive 22) src-tauri/src/services/provider/mod.rs:7923— ProviderService::scrub_leaked_gemini_common_config has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 3, match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProviderService::extract_codex_common_config (cognitive 20) src-tauri/src/services/provider/mod.rs:7765— ProviderService::extract_codex_common_config has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderService::switch_inner (cognitive 16) src-tauri/src/services/provider/mod.rs:7103— ProviderService::switch_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×11
Change-coupling hub: ModelStatsTable.tsx → REDACTED, ProviderStatsTable.tsx, RequestLogTable.tsx src/components/usage/ModelStatsTable.tsx— `src/components/usage/ModelStatsTable.tsx` changes together with 3 other files — `REDACTED`, `src/components/usage/ProviderStatsTable.tsx`, `src/components/usage/RequestLogTable.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: codexProviderPresets.ts → claudeDesktopProviderPresets.ts, geminiProviderPresets.ts, hermesProviderPresets.ts, openclawProviderPresets.ts, opencodeProviderPresets.ts, piProviderPresets.ts, presetSearchAliases.ts src/config/codexProviderPresets.ts— `src/config/codexProviderPresets.ts` changes together with 7 other files — `src/config/claudeDesktopProviderPresets.ts`, `src/config/geminiProviderPresets.ts`, `src/config/hermesProviderPresets.ts`, `src/config/openclawProviderPresets.ts`, `src/config/opencodeProviderPresets.ts`, `src/config/piProviderPresets.ts`, `src/config/presetSearchAliases.ts` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 7.
Change-coupling hub: settings.rs → CodexAuthSettings.tsx, GeneralSection.tsx, useSettingsForm.ts, index.ts src-tauri/src/settings.rs— `src-tauri/src/settings.rs` changes together with 4 other files — `src/components/settings/CodexAuthSettings.tsx`, `src/components/settings/sections/GeneralSection.tsx`, `src/hooks/useSettingsForm.ts`, `src/i18n/index.ts` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Change-coupling hub: types.ts → CodexAuthSettings.tsx, GeneralSection.tsx, index.ts src/types.ts— `src/types.ts` changes together with 3 other files — `src/components/settings/CodexAuthSettings.tsx`, `src/components/settings/sections/GeneralSection.tsx`, `src/i18n/index.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: openclawProviderPresets.ts → claudeDesktopProviderPresets.ts, geminiProviderPresets.ts, hermesProviderPresets.ts, opencodeProviderPresets.ts, piProviderPresets.ts, presetSearchAliases.ts src/config/openclawProviderPresets.ts— `src/config/openclawProviderPresets.ts` changes together with 6 other files — `src/config/claudeDesktopProviderPresets.ts`, `src/config/geminiProviderPresets.ts`, `src/config/hermesProviderPresets.ts`, `src/config/opencodeProviderPresets.ts`, `src/config/piProviderPresets.ts`, `src/config/presetSearchAliases.ts` — none of which declares a dependency on it: one file is the hub of 6 separate couplings, not 6 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 6.
Change-coupling hub: hermesProviderPresets.ts → opencodeProviderPresets.ts, piProviderPresets.ts, presetSearchAliases.ts src/config/hermesProviderPresets.ts— `src/config/hermesProviderPresets.ts` changes together with 3 other files — `src/config/opencodeProviderPresets.ts`, `src/config/piProviderPresets.ts`, `src/config/presetSearchAliases.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: lib.rs → index.ts, subscription.ts, usage.ts, vite-env.d.ts src-tauri/src/lib.rs— `src-tauri/src/lib.rs` changes together with 4 other files — `src/lib/api/index.ts`, `src/lib/api/subscription.ts`, `src/lib/api/usage.ts`, `src/vite-env.d.ts` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Change-coupling hub: claudeDesktopProviderPresets.ts → hermesProviderPresets.ts, opencodeProviderPresets.ts, piProviderPresets.ts, presetSearchAliases.ts src/config/claudeDesktopProviderPresets.ts— `src/config/claudeDesktopProviderPresets.ts` changes together with 4 other files — `src/config/hermesProviderPresets.ts`, `src/config/opencodeProviderPresets.ts`, `src/config/piProviderPresets.ts`, `src/config/presetSearchAliases.ts` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Change-coupling hub: DeepLinkImportDialog.tsx → parser.rs, provider.rs, REDACTED src/components/DeepLinkImportDialog.tsx— `src/components/DeepLinkImportDialog.tsx` changes together with 3 other files — `src-tauri/src/deeplink/parser.rs`, `src-tauri/src/deeplink/provider.rs`, `src-tauri/src/deeplink/tests.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: App.tsx → FullScreenPanel.tsx, PromptFormPanel.tsx, index.ts src/App.tsx— `src/App.tsx` changes together with 3 other files — `src/components/common/FullScreenPanel.tsx`, `src/components/prompts/PromptFormPanel.tsx`, `src/lib/api/index.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×10
Edited copy of a member (12 corresponding lines) src-tauri/src/model_capabilities.rs:159— src-tauri/src/model_capabilities.rs:159-170 | src-tauri/src/model_capabilities.rs:172-183 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/settings.rs:198— src-tauri/src/settings.rs:198-209 | src-tauri/src/settings.rs:293-306 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/services/provider/mod.rs:7399— src-tauri/src/services/provider/mod.rs:7399-7416 | src-tauri/src/services/provider/mod.rs:7468-7479 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/proxy/providers/xai_oauth_auth.rs:457— src-tauri/src/proxy/providers/xai_oauth_auth.rs:457-468 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:655-667 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/services/session_usage_codex.rs:1822— src-tauri/src/services/session_usage_codex.rs:1822-1834 | src-tauri/src/services/session_usage_codex.rs:1850-1861 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/proxy/forwarder.rs:4708— src-tauri/src/proxy/forwarder.rs:4708-4719 | src-tauri/src/proxy/handlers.rs:2617-2630 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/services/s3_sync.rs:161— src-tauri/src/services/s3_sync.rs:161-172 | src-tauri/src/services/webdav_sync.rs:190-201 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/openclaw_config.rs:858— src-tauri/src/openclaw_config.rs:858-869 | src-tauri/src/openclaw_config.rs:882-896 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/commands/s3_sync.rs:103— src-tauri/src/commands/s3_sync.rs:103-114 | src-tauri/src/commands/webdav_sync.rs:108-122 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) src-tauri/src/proxy/media_sanitizer.rs:277— src-tauri/src/proxy/media_sanitizer.rs:277-288 | src-tauri/src/proxy/opaque_state_rectifier.rs:272-285 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (12 lines × 2) src-tauri/src/commands/misc.rs:2811— src-tauri/src/commands/misc.rs:2811-2822 | src-tauri/src/commands/misc.rs:2826-2837 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:2811` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) REDACTED:608— REDACTED:608-619 | src-tauri/src/services/config.rs:50-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:608` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src-tauri/src/proxy/providers/codex.rs:99— src-tauri/src/proxy/providers/codex.rs:99-110 | src-tauri/src/proxy/providers/codex.rs:802-813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src-tauri/src/proxy/providers/streaming.rs:581— src-tauri/src/proxy/providers/streaming.rs:581-592 | src-tauri/src/proxy/providers/streaming.rs:595-606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming.rs:581` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/streaming.rs:577` calls `insert` and `src-tauri/src/proxy/providers/streaming.rs:591` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:630— src-tauri/src/proxy/providers/streaming_responses.rs:630-641 | src-tauri/src/proxy/providers/streaming_responses.rs:647-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:630` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src-tauri/src/proxy/providers/transform_responses.rs:1510— src-tauri/src/proxy/providers/transform_responses.rs:1510-1521 | src-tauri/src/proxy/providers/transform_responses.rs:1560-1571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/transform_responses.rs:1507` calls `get`, `and_then`, `Some` and `src-tauri/src/proxy/providers/transform_responses.rs:1559` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) src-tauri/src/session_manager/providers/claude.rs:147— src-tauri/src/session_manager/providers/claude.rs:147-158 | src-tauri/src/session_manager/providers/codex.rs:1986-1997 — before extracting anything, compare `src-tauri/src/session_manager/providers/claude.rs` and `src-tauri/src/session_manager/providers/codex.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/claude.rs:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src-tauri/src/mcp/kimi.rs:90— src-tauri/src/mcp/kimi.rs:90-101 | src-tauri/src/mcp/mcode.rs:75-86 — before extracting anything, compare `src-tauri/src/mcp/kimi.rs` and `src-tauri/src/mcp/mcode.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/kimi.rs:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src-tauri/src/services/s3_auto_sync.rs:124— src-tauri/src/services/s3_auto_sync.rs:124-135 | src-tauri/src/services/webdav_auto_sync.rs:133-144 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) src-tauri/src/services/coding_plan.rs:1198— src-tauri/src/services/coding_plan.rs:1198-1209 | src-tauri/src/services/coding_plan.rs:1239-1250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:1198` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) src-tauri/src/commands/auth.rs:533— src-tauri/src/commands/auth.rs:533-542 | src-tauri/src/commands/auth.rs:551-560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/auth.rs:533` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) src-tauri/src/commands/misc.rs:1236— src-tauri/src/commands/misc.rs:1236-1245 | src-tauri/src/commands/misc.rs:1267-1276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:1236` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) src-tauri/src/mcp/kimi.rs:51— src-tauri/src/mcp/kimi.rs:51-60 | src-tauri/src/mcp/mcode.rs:41-50 — before extracting anything, compare `src-tauri/src/mcp/kimi.rs` and `src-tauri/src/mcp/mcode.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/kimi.rs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:131— src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:131-140 | src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:182-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:366— src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:366-376 | src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:386-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src-tauri/src/services/skill.rs:479— src-tauri/src/services/skill.rs:479-488 | src-tauri/src/services/skill.rs:489-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/skill.rs:479` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) REDACTED:239— REDACTED:239-248 | src-tauri/src/services/subscription_grok.rs:43-52 — before extracting anything, compare `REDACTED` and `src-tauri/src/services/subscription_grok.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:239` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) REDACTED:1086— REDACTED:1086-1095 | src-tauri/src/services/subscription_grok.rs:644-653 — before extracting anything, compare `REDACTED` and `src-tauri/src/services/subscription_grok.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1086` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) src-tauri/src/services/subscription_grok.rs:292— src-tauri/src/services/subscription_grok.rs:292-301 | src-tauri/src/services/subscription_grok.rs:329-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/subscription_grok.rs:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) src-tauri/src/services/agy_account/mod.rs:168— src-tauri/src/services/agy_account/mod.rs:168-177 | src-tauri/src/services/workbuddy_account/mod.rs:352-361 — `src-tauri/src/services/agy_account/mod.rs` and `src-tauri/src/services/workbuddy_account/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/agy_account/mod.rs:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ProviderService::update (cyclomatic 41) src-tauri/src/services/provider/mod.rs:6410— ProviderService::update has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderService::add (cyclomatic 33) src-tauri/src/services/provider/mod.rs:5789— ProviderService::add has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderService::validate_provider_settings (cyclomatic 32) src-tauri/src/services/provider/mod.rs:8265— ProviderService::validate_provider_settings has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderService::delete (cyclomatic 28) src-tauri/src/services/provider/mod.rs:6749— ProviderService::delete has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderService::switch_normal (cyclomatic 26) src-tauri/src/services/provider/mod.rs:7227— ProviderService::switch_normal has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProviderService::remove_from_live_config (cyclomatic 25) src-tauri/src/services/provider/mod.rs:6924— ProviderService::remove_from_live_config has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderService::scrub_leaked_gemini_common_config (cyclomatic 18) src-tauri/src/services/provider/mod.rs:7923— ProviderService::scrub_leaked_gemini_common_config has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProviderService::list (cyclomatic 16) src-tauri/src/services/provider/mod.rs:5528— ProviderService::list has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderService::switch_inner (cyclomatic 16) src-tauri/src/services/provider/mod.rs:7103— ProviderService::switch_inner has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Duplicated block (14 lines × 2) src-tauri/src/codex_history_migration.rs:796— src-tauri/src/codex_history_migration.rs:796-809 | src-tauri/src/codex_history_migration.rs:1375-1388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) src-tauri/src/mcp/claude.rs:62— src-tauri/src/mcp/claude.rs:62-75 | src-tauri/src/mcp/gemini.rs:58-71 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/gemini.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/claude.rs:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) src-tauri/src/mcp/hermes.rs:306— src-tauri/src/mcp/hermes.rs:306-319 | src-tauri/src/mcp/opencode.rs:250-263 — before extracting anything, compare `src-tauri/src/mcp/hermes.rs` and `src-tauri/src/mcp/opencode.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/hermes.rs:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:2073— src-tauri/src/proxy/providers/streaming_responses.rs:2073-2086 | src-tauri/src/proxy/providers/transform_responses.rs:2681-2694 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:2073` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) src-tauri/src/services/provider/live.rs:1013— src-tauri/src/services/provider/live.rs:1013-1026 | src-tauri/src/services/provider/live.rs:1174-1187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/live.rs:1013` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) src-tauri/src/services/s3.rs:315— src-tauri/src/services/s3.rs:315-328 | src-tauri/src/services/webdav.rs:450-463 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) src-tauri/src/services/s3_auto_sync.rs:138— src-tauri/src/services/s3_auto_sync.rs:138-151 | src-tauri/src/services/webdav_auto_sync.rs:147-160 — before extracting anything, compare `src-tauri/src/services/s3_auto_sync.rs` and `src-tauri/src/services/webdav_auto_sync.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) src-tauri/src/session_manager/providers/gemini.rs:451— src-tauri/src/session_manager/providers/gemini.rs:451-464 | src-tauri/src/session_manager/providers/pi_blocks.rs:454-467 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/gemini.rs:451` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:1868— src-tauri/src/proxy/providers/streaming_responses.rs:1868-1881 | src-tauri/src/proxy/providers/streaming_responses.rs:1885-1898 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:1868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×8
Animation without a prefers-reduced-motion guard deplink.html:306— `.toast` moves (`animation: tin 200ms cubic-bezier(.4, 0, .2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/components/universal/UniversalProviderPanel.tsx:244— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard src/index.css:269— `.ui-checkbox::before` moves (`transition: transform 120ms ease-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/index.css:503— `.pi-thinking-popover[data-state="open"]` moves (`animation: pi-thinking-popover-in 260ms cubic-bezier(0.16, 1, 0.3, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/index.css:507— `.pi-thinking-popover[data-state="closed"]` moves (`animation: pi-thinking-popover-out 150ms cubic-bezier(0.4, 0, 1, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/tray-panel/tray-panel.css:129— `html[data-layout="floating"] .tp-sub[data-side="right"]` moves (`animation: tp-sub-in-right 140ms ease-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/tray-panel/tray-panel.css:132— `html[data-layout="floating"] .tp-sub[data-side="left"]` moves (`animation: tp-sub-in-left 140ms ease-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/components/usage/RequestLogTable.tsx:309— `row.animate()` moves (`Web Animations API keyframes`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
TooManyMethods: Database src-tauri/src/database/mod.rs:123— TooManyMethods — 231 methods, declared across 18 files: database/schema.rs (37), REDACTED (36), dao/proxy.rs (29), dao/settings.rs (27), +14 more file(s). The bar is 30 methods; this is 201 over it, 7.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SkillService src-tauri/src/services/skill.rs:590— TooManyMethods — 121 methods. The bar is 30 methods; this is 91 over it, 4.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ProviderService src-tauri/src/services/provider/mod.rs:181— TooManyMethods — 78 methods. The bar is 30 methods; this is 48 over it, 2.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CodexOAuthManager src-tauri/src/proxy/providers/codex_oauth_auth.rs:374— TooManyMethods — 43 methods, declared across 2 files: providers/codex_oauth_auth.rs (39), codex_oauth_auth/browser.rs (4). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CopilotAuthManager src-tauri/src/proxy/providers/copilot_auth.rs:563— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RequestForwarder src-tauri/src/proxy/forwarder.rs:356— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BufferedCitationTextState src-tauri/src/proxy/providers/streaming_responses.rs:705— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ProxyService src-tauri/src/services/proxy.rs:20— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×8
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/lib.rs:311— src-tauri/src/lib.rs:311-365 | src-tauri/src/lib.rs:437-483 | src-tauri/src/lib.rs:486-2145 | src-tauri/src/tray.rs:3058-3080 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp/agy.rs:62— src-tauri/src/mcp/agy.rs:62-105 | src-tauri/src/mcp/kimi.rs:50-82 | src-tauri/src/mcp/mcode.rs:40-67 | src-tauri/src/mcp/pi.rs:205-247 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp/agy.rs:167— src-tauri/src/mcp/agy.rs:167-183 | src-tauri/src/mcp/kimi.rs:143-158 | src-tauri/src/mcp/mcode.rs:128-138 | src-tauri/src/mcp/pi.rs:345-355 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp/claude.rs:51— src-tauri/src/mcp/claude.rs:51-122 | src-tauri/src/mcp/codex.rs:69-298 | src-tauri/src/mcp/gemini.rs:51-118 | src-tauri/src/mcp/opencode.rs:213-294 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp/hermes.rs:61— src-tauri/src/mcp/hermes.rs:61-105 | src-tauri/src/mcp/hermes.rs:117-163 | src-tauri/src/mcp/opencode.rs:44-105 | src-tauri/src/mcp/opencode.rs:116-178 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/proxy/handlers.rs:630— src-tauri/src/proxy/handlers.rs:630-939 | src-tauri/src/proxy/handlers.rs:1827-2058 | src-tauri/src/proxy/handlers.rs:2230-2308 | src-tauri/src/proxy/response_processor.rs:501-591 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/proxy/handlers.rs:1668— src-tauri/src/proxy/handlers.rs:1668-1818 | src-tauri/src/proxy/handlers.rs:1827-2058 | src-tauri/src/proxy/handlers.rs:2075-2222 | src-tauri/src/proxy/response_processor.rs:230-331 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/services/s3.rs:333— src-tauri/src/services/s3.rs:333-367 | src-tauri/src/services/s3.rs:375-411 | src-tauri/src/services/s3.rs:420-485 | src-tauri/src/services/s3.rs:491-532 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×8
Edited copy of a member (24 corresponding lines) src-tauri/src/deeplink/provider.rs:1086— src-tauri/src/deeplink/provider.rs:1086-1116 | src-tauri/src/deeplink/provider.rs:1125-1148 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/commands/misc.rs:3338— src-tauri/src/commands/misc.rs:3338-3361 | src-tauri/src/commands/misc.rs:3369-3400 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:2054— src-tauri/src/proxy/providers/codex_oauth_auth.rs:2054-2077 | src-tauri/src/proxy/providers/copilot_auth.rs:1622-1654 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/services/s3_auto_sync.rs:157— src-tauri/src/services/s3_auto_sync.rs:157-180 | src-tauri/src/services/webdav_auto_sync.rs:166-189 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/services/s3_sync.rs:181— src-tauri/src/services/s3_sync.rs:181-204 | src-tauri/src/services/webdav_sync.rs:246-269 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/proxy/providers/codex.rs:609— src-tauri/src/proxy/providers/codex.rs:609-632 | src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:134-158 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/session_manager/providers/hermes.rs:35— src-tauri/src/session_manager/providers/hermes.rs:35-58 | src-tauri/src/session_manager/providers/opencode.rs:103-127 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:2079— src-tauri/src/proxy/providers/codex_oauth_auth.rs:2079-2103 | src-tauri/src/proxy/providers/copilot_auth.rs:1717-1740 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (5 lines × 3) src-tauri/src/codex_config.rs:1011— src-tauri/src/codex_config.rs:1011-1017 | src-tauri/src/codex_config.rs:1093-1097 | src-tauri/src/codex_config.rs:1167-1171 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) src-tauri/src/copilot_config.rs:805— src-tauri/src/copilot_config.rs:805-809 | src-tauri/src/opencode_config.rs:20-24 | src-tauri/src/services/omo.rs:330-334 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/copilot_config.rs:805` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1901— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1901-1905 | src-tauri/src/proxy/providers/copilot_auth.rs:1424-1429 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:777-781 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1901` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/proxy/providers/xai_oauth_auth.rs:784` calls `then_with`, `cmp` and `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1908` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:552— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:552-556 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:588-593 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:610-615 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) REDACTED:2722— REDACTED:2722-2726 | REDACTED:2748-2752 | src-tauri/src/session_manager/providers/agy.rs:200-204 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2722` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1406— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1406-1410 | src-tauri/src/proxy/providers/copilot_auth.rs:615-619 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:432-436 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) src-tauri/src/proxy/providers/claude.rs:642— src-tauri/src/proxy/providers/claude.rs:642-647 | src-tauri/src/proxy/providers/codex.rs:1099-1103 | src-tauri/src/proxy/providers/gemini.rs:126-131 — before extracting anything, compare `src-tauri/src/proxy/providers/claude.rs` and `src-tauri/src/proxy/providers/codex.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/claude.rs:642` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) src-tauri/src/services/agy_account/mod.rs:166— src-tauri/src/services/agy_account/mod.rs:166-170 | src-tauri/src/services/claude_account/mod.rs:163-167 | src-tauri/src/services/workbuddy_account/mod.rs:350-354 — `src-tauri/src/services/agy_account/mod.rs` and `src-tauri/src/services/workbuddy_account/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/agy_account/mod.rs:166` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
SkillService::get_app_skills_dir (cyclomatic 33) src-tauri/src/services/skill.rs:686— SkillService::get_app_skills_dir has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SkillService::import_from_apps (cyclomatic 27) src-tauri/src/services/skill.rs:2580— SkillService::import_from_apps has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillService::migrate_storage (cyclomatic 25) src-tauri/src/services/skill.rs:2139— SkillService::migrate_storage has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillService::update_skill (cyclomatic 21) src-tauri/src/services/skill.rs:1620— SkillService::update_skill has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillService::uninstall (cyclomatic 19) src-tauri/src/services/skill.rs:1095— SkillService::uninstall has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillService::update_managed_skill_files (cyclomatic 19) src-tauri/src/services/skill.rs:1899— SkillService::update_managed_skill_files has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillService::check_updates_report (cyclomatic 17) src-tauri/src/services/skill.rs:1453— SkillService::check_updates_report has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
RolloutParser::finish_call (cognitive 65) src-tauri/src/session_manager/providers/codex.rs:1572— RolloutParser::finish_call has cognitive complexity 65 (threshold 15). Drivers by points: if/else 26 (46 pts), match/switch 4 (8 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RolloutParser::backfill_finished_result (cognitive 32) src-tauri/src/session_manager/providers/codex.rs:1436— RolloutParser::backfill_finished_result has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (29 pts), loops 2 (3 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RolloutParser::process_line (cognitive 25) src-tauri/src/session_manager/providers/codex.rs:629— RolloutParser::process_line has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 2 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
RolloutParser::on_user_message (cognitive 22) src-tauri/src/session_manager/providers/codex.rs:951— RolloutParser::on_user_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RolloutParser::finish (cognitive 22) src-tauri/src/session_manager/providers/codex.rs:1774— RolloutParser::finish has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RolloutParser::response_item (cognitive 19) src-tauri/src/session_manager/providers/codex.rs:688— RolloutParser::response_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
RolloutParser::event_msg (cognitive 16) src-tauri/src/session_manager/providers/codex.rs:739— RolloutParser::event_msg has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×7
Edited copy of a member (23 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:402— src-tauri/src/proxy/providers/codex_oauth_auth.rs:402-426 | src-tauri/src/proxy/providers/copilot_auth.rs:588-610 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) src-tauri/src/services/pi_prompt_files.rs:42— src-tauri/src/services/pi_prompt_files.rs:42-64 | src-tauri/src/services/pi_prompt_files.rs:255-279 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) src-tauri/src/proxy/forwarder.rs:3180— src-tauri/src/proxy/forwarder.rs:3180-3202 | src-tauri/src/proxy/forwarder.rs:3207-3232 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) src-tauri/src/commands/import_export.rs:56— src-tauri/src/commands/import_export.rs:56-79 | src-tauri/src/commands/import_export.rs:175-197 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) src-tauri/src/services/provider/pi.rs:159— src-tauri/src/services/provider/pi.rs:159-182 | src-tauri/src/services/provider/pi.rs:184-206 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) src-tauri/src/codex_config.rs:431— src-tauri/src/codex_config.rs:431-454 | src-tauri/src/codex_config.rs:459-481 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) src-tauri/src/proxy/usage/logger.rs:283— src-tauri/src/proxy/usage/logger.rs:283-306 | src-tauri/src/proxy/usage/logger.rs:326-348 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×7
Edited copy of a member (16 corresponding lines) src-tauri/src/services/provider/mod.rs:94— src-tauri/src/services/provider/mod.rs:94-109 | src-tauri/src/services/provider/mod.rs:115-137 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) src-tauri/src/commands/s3_sync.rs:166— src-tauri/src/commands/s3_sync.rs:166-181 | src-tauri/src/commands/webdav_sync.rs:174-189 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) src-tauri/src/commands/omo.rs:22— src-tauri/src/commands/omo.rs:22-37 | src-tauri/src/commands/omo.rs:58-73 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) src-tauri/src/proxy/providers/streaming_responses.rs:1403— src-tauri/src/proxy/providers/streaming_responses.rs:1403-1418 | src-tauri/src/proxy/providers/streaming_responses.rs:1424-1439 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) src-tauri/src/commands/copilot.rs:42— src-tauri/src/commands/copilot.rs:42-61 | src-tauri/src/commands/copilot.rs:71-86 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) src-tauri/src/proxy/providers/reasoning_bridge.rs:36— src-tauri/src/proxy/providers/reasoning_bridge.rs:36-51 | src-tauri/src/session_manager/providers/workbuddy.rs:120-135 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1468— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1468-1484 | src-tauri/src/proxy/providers/copilot_auth.rs:736-751 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×7
Edited copy of a member (9 corresponding lines) src-tauri/src/commands/profile.rs:150— src-tauri/src/commands/profile.rs:150-158 | src-tauri/src/commands/profile.rs:167-178 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) src-tauri/src/proxy/providers/xai_oauth_auth.rs:707— src-tauri/src/proxy/providers/xai_oauth_auth.rs:707-715 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:717-729 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) src-tauri/src/commands/s3_sync.rs:117— src-tauri/src/commands/s3_sync.rs:117-125 | src-tauri/src/commands/webdav_sync.rs:125-133 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) src-tauri/src/proxy/providers/gemini_shadow.rs:194— src-tauri/src/proxy/providers/gemini_shadow.rs:194-205 | src-tauri/src/proxy/providers/gemini_shadow.rs:209-217 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) src-tauri/src/session_manager/providers/utils.rs:286— src-tauri/src/session_manager/providers/utils.rs:286-298 | src-tauri/src/tray.rs:686-694 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) src-tauri/src/proxy/providers/reasoning_bridge.rs:26— src-tauri/src/proxy/providers/reasoning_bridge.rs:26-34 | src-tauri/src/services/claude_account/snapshot/creds.rs:11-22 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) src-tauri/src/services/codex_oauth_models.rs:130— src-tauri/src/services/codex_oauth_models.rs:130-138 | src-tauri/src/services/model_fetch.rs:331-339 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×7
Edited copy of a member (7 corresponding lines) src-tauri/src/services/proxy.rs:331— src-tauri/src/services/proxy.rs:331-349 | src-tauri/src/services/proxy.rs:378-384 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) src-tauri/src/session_manager/providers/hermes.rs:664— src-tauri/src/session_manager/providers/hermes.rs:664-673 | src-tauri/src/session_manager/providers/opencode.rs:150-156 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) src-tauri/src/session_manager/providers/opencode.rs:927— src-tauri/src/session_manager/providers/opencode.rs:927-933 | src-tauri/src/session_manager/providers/opencode.rs:935-941 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) REDACTED:128— REDACTED:128-136 | src-tauri/src/services/claude_account/snapshot/store.rs:142-148 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) src-tauri/src/codex_config.rs:128— src-tauri/src/codex_config.rs:128-134 | src-tauri/src/codex_config.rs:1212-1218 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) src-tauri/src/proxy/providers/reasoning_bridge.rs:64— src-tauri/src/proxy/providers/reasoning_bridge.rs:64-70 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:106-113 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) src-tauri/src/live/patch/json.rs:252— src-tauri/src/live/patch/json.rs:252-258 | src-tauri/src/live/patch/toml.rs:183-189 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (16 lines × 2) src-tauri/src/deeplink/codex_link.rs:273— src-tauri/src/deeplink/codex_link.rs:273-288 | src-tauri/src/deeplink/grok_link.rs:210-225 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) src-tauri/src/proxy/providers/copilot_auth.rs:1149— src-tauri/src/proxy/providers/copilot_auth.rs:1149-1164 | src-tauri/src/proxy/providers/copilot_auth.rs:1263-1278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/copilot_auth.rs:1149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:2862— src-tauri/src/proxy/providers/streaming_responses.rs:2862-2877 | src-tauri/src/proxy/providers/streaming_responses.rs:4199-4215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:2862` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src-tauri/src/services/provider/codex_editor.rs:78— src-tauri/src/services/provider/codex_editor.rs:78-93 | src-tauri/src/services/provider/grok_editor.rs:48-63 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/codex_editor.rs:78` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src-tauri/src/services/session_usage_codex.rs:1195— src-tauri/src/services/session_usage_codex.rs:1195-1210 | src-tauri/src/services/session_usage_codex.rs:1216-1231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) REDACTED:1926— REDACTED:1926-1941 | REDACTED:2128-2143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1926` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:378— src-tauri/src/proxy/providers/streaming_responses.rs:378-393 | src-tauri/src/proxy/providers/streaming_responses.rs:802-817 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
TooManyFunctions: cc_switch::opencode_config src-tauri/src/opencode_config.rs:13— TooManyFunctions — 45 free functions. The bar is 30 free functions; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: cc_switch::commands::proxy src-tauri/src/commands/proxy.rs:12— TooManyFunctions — 42 free functions. The bar is 30 free functions; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: cc_switch::config src-tauri/src/config.rs:22— TooManyFunctions — 35 free functions. The bar is 30 free functions; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: cc_switch::pi_config src-tauri/src/pi_config/mod.rs:34— TooManyFunctions — 35 free functions. The bar is 30 free functions; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: cc_switch::commands::skill src-tauri/src/commands/skill.rs:25— TooManyFunctions — 32 free functions. The bar is 30 free functions; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: cc_switch::proxy::media_sanitizer src-tauri/src/proxy/media_sanitizer.rs:31— TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×6
Edited copy of a member (19 corresponding lines) src-tauri/src/session_manager/providers/claude.rs:1599— src-tauri/src/session_manager/providers/claude.rs:1599-1620 | src-tauri/src/session_manager/providers/codex_items.rs:55-73 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) src-tauri/src/database/schema.rs:3969— src-tauri/src/database/schema.rs:3969-3987 | src-tauri/src/database/schema.rs:3993-4013 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) src-tauri/src/hermes_config.rs:363— src-tauri/src/hermes_config.rs:363-381 | src-tauri/src/openclaw_config.rs:375-393 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) src-tauri/src/services/provider/mod.rs:8108— src-tauri/src/services/provider/mod.rs:8108-8130 | src-tauri/src/services/provider/mod.rs:8133-8151 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) REDACTED:2714— REDACTED:2714-2732 | REDACTED:2737-2758 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) src-tauri/src/proxy/providers/transform_codex_chat.rs:1466— src-tauri/src/proxy/providers/transform_codex_chat.rs:1466-1484 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1489-1508 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×6
Edited copy of a member (20 corresponding lines) src-tauri/src/app_config.rs:64— src-tauri/src/app_config.rs:64-83 | src-tauri/src/app_config.rs:209-228 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) src-tauri/src/services/agy_account/mod.rs:162— src-tauri/src/services/agy_account/mod.rs:162-181 | src-tauri/src/services/workbuddy_account/mod.rs:346-368 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) src-tauri/src/services/provider/mod.rs:6100— src-tauri/src/services/provider/mod.rs:6100-6119 | src-tauri/src/services/provider/mod.rs:6129-6154 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1176— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1176-1195 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1197-1216 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) src-tauri/src/services/mcp.rs:496— src-tauri/src/services/mcp.rs:496-515 | src-tauri/src/services/prompt.rs:301-321 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) src-tauri/src/services/mcp.rs:345— src-tauri/src/services/mcp.rs:345-364 | src-tauri/src/services/mcp.rs:433-452 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×6
Edited copy of a member (17 corresponding lines) src-tauri/src/proxy/copilot_optimizer.rs:309— src-tauri/src/proxy/copilot_optimizer.rs:309-329 | src-tauri/src/proxy/copilot_optimizer.rs:338-354 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) src-tauri/src/proxy/providers/auth.rs:42— src-tauri/src/proxy/providers/auth.rs:42-58 | src-tauri/src/proxy/providers/auth.rs:62-79 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) src-tauri/src/services/skill.rs:4402— src-tauri/src/services/skill.rs:4402-4418 | src-tauri/src/services/skill.rs:4428-4444 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) src-tauri/src/services/proxy.rs:475— src-tauri/src/services/proxy.rs:475-497 | src-tauri/src/services/proxy.rs:502-518 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) src-tauri/src/services/s3.rs:254— src-tauri/src/services/s3.rs:254-270 | src-tauri/src/services/webdav.rs:109-126 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) src-tauri/src/services/s3_auto_sync.rs:78— src-tauri/src/services/s3_auto_sync.rs:78-94 | src-tauri/src/services/webdav_auto_sync.rs:78-94 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 3) src-tauri/src/proxy/handlers.rs:757— src-tauri/src/proxy/handlers.rs:757-770 | src-tauri/src/proxy/handlers.rs:1916-1929 | src-tauri/src/proxy/handlers.rs:2293-2306 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:757` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) src-tauri/src/proxy/providers/codex.rs:23— src-tauri/src/proxy/providers/codex.rs:23-36 | src-tauri/src/proxy/providers/codex.rs:167-180 | src-tauri/src/proxy/providers/codex.rs:452-465 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:23` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) src-tauri/src/proxy/providers/streaming_responses.rs:2881— src-tauri/src/proxy/providers/streaming_responses.rs:2881-2894 | src-tauri/src/proxy/providers/streaming_responses.rs:3362-3375 | src-tauri/src/proxy/providers/streaming_responses.rs:4087-4100 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) src-tauri/src/services/coding_plan.rs:262— src-tauri/src/services/coding_plan.rs:262-275 | src-tauri/src/services/coding_plan.rs:620-633 | src-tauri/src/services/coding_plan.rs:960-973 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:262` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) src-tauri/src/database/schema.rs:601— src-tauri/src/database/schema.rs:601-614 | src-tauri/src/database/schema.rs:626-639 | src-tauri/src/database/schema.rs:686-700 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/database/schema.rs:601` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) src-tauri/src/mcp/codex.rs:239— src-tauri/src/mcp/codex.rs:239-252 | src-tauri/src/mcp/hermes.rs:303-316 | src-tauri/src/mcp/opencode.rs:247-260 — before extracting anything, compare `src-tauri/src/mcp/hermes.rs` and `src-tauri/src/mcp/opencode.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/codex.rs:239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) src-tauri/src/commands/misc.rs:2750— src-tauri/src/commands/misc.rs:2750-2759 | src-tauri/src/commands/misc.rs:2846-2855 | src-tauri/src/commands/misc.rs:2858-2867 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) src-tauri/src/proxy/providers/codex.rs:877— src-tauri/src/proxy/providers/codex.rs:877-886 | src-tauri/src/proxy/providers/codex.rs:889-898 | src-tauri/src/proxy/providers/codex.rs:925-934 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:877` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) src-tauri/src/proxy/providers/codex.rs:901— src-tauri/src/proxy/providers/codex.rs:901-910 | src-tauri/src/proxy/providers/codex.rs:970-979 | src-tauri/src/proxy/providers/codex.rs:987-996 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:901` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) src-tauri/src/proxy/providers/streaming_responses.rs:522— src-tauri/src/proxy/providers/streaming_responses.rs:522-531 | src-tauri/src/proxy/providers/streaming_responses.rs:547-556 | src-tauri/src/proxy/providers/streaming_responses.rs:717-726 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) src-tauri/src/services/s3.rs:376— src-tauri/src/services/s3.rs:376-385 | src-tauri/src/services/s3.rs:421-430 | src-tauri/src/services/s3.rs:492-501 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) src-tauri/src/mcp/agy.rs:109— src-tauri/src/mcp/agy.rs:109-118 | src-tauri/src/mcp/kimi.rs:86-95 | src-tauri/src/mcp/mcode.rs:71-80 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/agy.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) src-tauri/src/commands/misc.rs:1884— src-tauri/src/commands/misc.rs:1884-1890 | src-tauri/src/commands/misc.rs:3340-3346 | src-tauri/src/commands/misc.rs:3372-3378 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) src-tauri/src/mcp/codex.rs:129— src-tauri/src/mcp/codex.rs:129-135 | src-tauri/src/mcp/codex.rs:151-157 | src-tauri/src/mcp/codex.rs:202-208 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/codex.rs:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) src-tauri/src/proxy/forwarder.rs:3473— src-tauri/src/proxy/forwarder.rs:3473-3480 | src-tauri/src/proxy/forwarder.rs:3523-3529 | src-tauri/src/proxy/forwarder.rs:3551-3558 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/forwarder.rs:3473` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1888— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1888-1894 | src-tauri/src/proxy/providers/copilot_auth.rs:1410-1416 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:757-764 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1888` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/xai_oauth_auth.rs:756` calls `filter` and `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1887` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) src-tauri/src/proxy/providers/copilot_auth.rs:923— src-tauri/src/proxy/providers/copilot_auth.rs:923-929 | src-tauri/src/proxy/providers/copilot_auth.rs:1139-1145 | src-tauri/src/proxy/providers/copilot_auth.rs:1253-1259 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/copilot_auth.rs:1252` calls `fetch_and_cache_endpoint` and `src-tauri/src/proxy/providers/copilot_auth.rs:920` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) src-tauri/src/commands/hermes.rs:25— src-tauri/src/commands/hermes.rs:25-31 | src-tauri/src/commands/openclaw.rs:19-25 | src-tauri/src/commands/provider.rs:1144-1150 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/hermes.rs:25` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
R4 · Test Coverage· No test reaches this file · ×6
No test reaches this file src/components/DatabaseUpgrade.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/types/proxy.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/main.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/components/ui/sonner.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/tray-panel/main.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/lib/disableContextMenu.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
AC2 · Forms & labels· <fieldset> without a <legend> · ×5
<fieldset> without a <legend> src/components/providers/forms/CopilotProviderForm.tsx:915— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
<fieldset> without a <legend> src/components/providers/forms/KimiProviderForm.tsx:519— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
<fieldset> without a <legend> src/components/providers/forms/McodeProviderForm.tsx:301— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
<fieldset> without a <legend> REDACTED:1652— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
<fieldset> without a <legend> src/components/providers/forms/WorkBuddyProviderForm.tsx:481— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
RolloutParser::finish_call (cyclomatic 38) src-tauri/src/session_manager/providers/codex.rs:1572— RolloutParser::finish_call has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RolloutParser::response_item (cyclomatic 19) src-tauri/src/session_manager/providers/codex.rs:688— RolloutParser::response_item has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RolloutParser::process_line (cyclomatic 17) src-tauri/src/session_manager/providers/codex.rs:629— RolloutParser::process_line has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RolloutParser::event_msg (cyclomatic 16) src-tauri/src/session_manager/providers/codex.rs:739— RolloutParser::event_msg has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RolloutParser::on_item (cyclomatic 16) src-tauri/src/session_manager/providers/codex.rs:1337— RolloutParser::on_item has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Database::apply_schema_migrations_on_conn (cognitive 64) src-tauri/src/database/schema.rs:492— Database::apply_schema_migrations_on_conn has cognitive complexity 64 (threshold 15). Drivers by points: if/else 11 (37 pts), loops 8 (24 pts), match/switch 2 (3 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Database::get_daily_trends (cognitive 40) REDACTED:1315— Database::get_daily_trends has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (33 pts), loops 5 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Database::dump_sql (cognitive 31) REDACTED:703— Database::dump_sql has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Database::migrate_v5_to_v6 (cognitive 19) src-tauri/src/database/schema.rs:1322— Database::migrate_v5_to_v6 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Database::get_model_stats (cognitive 17) REDACTED:1944— Database::get_model_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TranscriptBuilder::push_assistant (cognitive 33) src-tauri/src/session_manager/providers/claude.rs:565— TranscriptBuilder::push_assistant has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 2 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TranscriptBuilder::tool_result_block (cognitive 28) src-tauri/src/session_manager/providers/claude.rs:785— TranscriptBuilder::tool_result_block has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 4 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TranscriptBuilder::backfill_call (cognitive 23) src-tauri/src/session_manager/providers/claude.rs:905— TranscriptBuilder::backfill_call has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TranscriptBuilder::push_user_texts (cognitive 19) src-tauri/src/session_manager/providers/claude.rs:717— TranscriptBuilder::push_user_texts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TranscriptBuilder::push_user (cognitive 17) src-tauri/src/session_manager/providers/claude.rs:655— TranscriptBuilder::push_user has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×5
Edited copy of a member (27 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:504— src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:504-530 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:510-536 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) src-tauri/src/services/env_manager.rs:76— src-tauri/src/services/env_manager.rs:76-102 | src-tauri/src/services/env_manager.rs:170-197 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) src-tauri/src/proxy/providers/claude.rs:111— src-tauri/src/proxy/providers/claude.rs:111-137 | src-tauri/src/proxy/providers/claude.rs:313-349 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) src-tauri/src/database/dao/failover.rs:23— src-tauri/src/database/dao/failover.rs:23-49 | src-tauri/src/database/dao/profiles.rs:32-60 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:852— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:852-883 | src-tauri/src/proxy/providers/transform_responses.rs:189-215 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×5
Edited copy of a member (22 corresponding lines) src-tauri/src/codex_history_migration.rs:767— src-tauri/src/codex_history_migration.rs:767-788 | src-tauri/src/codex_history_migration.rs:1293-1314 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) src-tauri/src/proxy/providers/transform.rs:399— src-tauri/src/proxy/providers/transform.rs:399-420 | src-tauri/src/proxy/providers/transform_responses.rs:2064-2096 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) src-tauri/src/session_manager/providers/claude.rs:1266— src-tauri/src/session_manager/providers/claude.rs:1266-1287 | src-tauri/src/session_manager/providers/gemini.rs:449-470 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) src-tauri/src/session_manager/terminal/mod.rs:34— src-tauri/src/session_manager/terminal/mod.rs:34-55 | src-tauri/src/session_manager/terminal/mod.rs:156-181 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:792— src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:792-813 | src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:1031-1057 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×5
Edited copy of a member (18 corresponding lines) src-tauri/src/codex_config.rs:975— src-tauri/src/codex_config.rs:975-992 | src-tauri/src/proxy/providers/codex.rs:1056-1073 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) src-tauri/src/proxy/providers/transform_codex_chat.rs:1851— src-tauri/src/proxy/providers/transform_codex_chat.rs:1851-1870 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1872-1889 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) src-tauri/src/omp_config.rs:849— src-tauri/src/omp_config.rs:849-867 | src-tauri/src/pi_config/mod.rs:260-277 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) src-tauri/src/jsonc_document.rs:561— src-tauri/src/jsonc_document.rs:561-578 | src-tauri/src/openclaw_config.rs:496-514 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) src-tauri/src/database/dao/profiles.rs:89— src-tauri/src/database/dao/profiles.rs:89-106 | src-tauri/src/database/dao/proxy.rs:671-694 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (18 lines × 2) src-tauri/src/proxy/forwarder.rs:1156— src-tauri/src/proxy/forwarder.rs:1156-1173 | src-tauri/src/proxy/forwarder.rs:1230-1248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/forwarder.rs:1156` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (18 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:2971— src-tauri/src/proxy/providers/streaming_responses.rs:2971-2988 | src-tauri/src/proxy/providers/streaming_responses.rs:4216-4233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:853— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:853-870 | src-tauri/src/proxy/providers/transform_responses.rs:190-207 — before extracting anything, compare `src-tauri/src/proxy/providers/transform_codex_anthropic.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) src-tauri/src/proxy/providers/transform_codex_chat.rs:879— src-tauri/src/proxy/providers/transform_codex_chat.rs:879-896 | src-tauri/src/proxy/providers/transform_codex_chat.rs:920-937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) REDACTED:1886— REDACTED:1886-1903 | REDACTED:2086-2103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1886` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1904` calls `get` and `REDACTED:2104` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) src-tauri/src/commands/s3_sync.rs:138— src-tauri/src/commands/s3_sync.rs:138-154 | src-tauri/src/commands/webdav_sync.rs:146-162 — before extracting anything, compare `src-tauri/src/commands/s3_sync.rs` and `src-tauri/src/commands/webdav_sync.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/s3_sync.rs:138` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17 lines × 2) src-tauri/src/proxy/handlers.rs:1037— src-tauri/src/proxy/handlers.rs:1037-1053 | src-tauri/src/proxy/handlers.rs:1422-1438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:1037` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) src-tauri/src/proxy/providers/codex.rs:22— src-tauri/src/proxy/providers/codex.rs:22-38 | src-tauri/src/proxy/providers/codex.rs:166-182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex.rs:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) src-tauri/src/services/agy_account/oauth.rs:158— src-tauri/src/services/agy_account/oauth.rs:158-174 | src-tauri/src/services/dsh_account.rs:583-599 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `stream` to `&mut tokio::net::TcpStream` in one and `&mut TcpStream` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 2) src-tauri/src/usage_script.rs:106— src-tauri/src/usage_script.rs:106-122 | src-tauri/src/usage_script.rs:200-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/usage_script.rs:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) src-tauri/src/proxy/hyper_client.rs:436— src-tauri/src/proxy/hyper_client.rs:436-446 | src-tauri/src/proxy/hyper_client.rs:449-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/hyper_client.rs:449` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3161— src-tauri/src/proxy/providers/streaming_responses.rs:3161-3172 | src-tauri/src/proxy/providers/streaming_responses.rs:3240-3250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/streaming_responses.rs:3160` calls `Some`, `get`, `and_then` and `src-tauri/src/proxy/providers/streaming_responses.rs:3239` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–12 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:4457— src-tauri/src/proxy/providers/streaming_responses.rs:4457-4467 | src-tauri/src/proxy/providers/streaming_responses.rs:4481-4492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:4481` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) src-tauri/src/services/session_usage.rs:1197— src-tauri/src/services/session_usage.rs:1197-1207 | src-tauri/src/services/session_usage_agy.rs:156-167 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage.rs:1197` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) src-tauri/src/session_manager/providers/codex.rs:1989— src-tauri/src/session_manager/providers/codex.rs:1989-1999 | src-tauri/src/session_manager/providers/openclaw.rs:157-168 — before extracting anything, compare `src-tauri/src/session_manager/providers/codex.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/codex.rs:1989` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
AC2 · Forms & labels· <Textarea> field component without a label · ×4
<Textarea> field component without a label src/components/providers/forms/LocalProxyRequestOverridesField.tsx:47— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label src/components/providers/forms/LocalProxyRequestOverridesField.tsx:70— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label src/components/providers/forms/OmoFormFields.tsx:707— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label src/components/providers/forms/OmoFormFields.tsx:1322— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
OmoFormFields.OmoFormFields::handleFillAllRecommended (cognitive 23) src/components/providers/forms/OmoFormFields.tsx:733— OmoFormFields.OmoFormFields::handleFillAllRecommended has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 3 other methods here (OmoFormFields.OmoFormFields::handleModelChange, OmoFormFields.OmoFormFields::handleAdvancedChange, OmoFormFields.OmoFormFields::renderCustomModelRow) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OmoFormFields.OmoFormFields::handleAdvancedChange (cognitive 20) src/components/providers/forms/OmoFormFields.tsx:589— OmoFormFields.OmoFormFields::handleAdvancedChange has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 4 (5 pts), boolean chains 4, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (OmoFormFields.OmoFormFields::handleModelChange, OmoFormFields.OmoFormFields::handleFillAllRecommended, OmoFormFields.OmoFormFields::renderCustomModelRow) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OmoFormFields.OmoFormFields::renderCustomModelRow (cognitive 18) src/components/providers/forms/OmoFormFields.tsx:973— OmoFormFields.OmoFormFields::renderCustomModelRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 13, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (OmoFormFields.OmoFormFields::handleModelChange, OmoFormFields.OmoFormFields::handleAdvancedChange, OmoFormFields.OmoFormFields::handleFillAllRecommended) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OmoFormFields.OmoFormFields::handleModelChange (cognitive 17) src/components/providers/forms/OmoFormFields.tsx:527— OmoFormFields.OmoFormFields::handleModelChange has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (OmoFormFields.OmoFormFields::handleAdvancedChange, OmoFormFields.OmoFormFields::handleFillAllRecommended, OmoFormFields.OmoFormFields::renderCustomModelRow) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
TooManyFields: AppSettings src-tauri/src/settings.rs:473— TooManyFields — 69 stored fields beside 5 methods. The bar is 30 stored fields; this is 39 over it, 2.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: TrayTexts src-tauri/src/tray.rs:89— TooManyFields — 52 stored fields beside 2 methods. The bar is 30 stored fields; this is 22 over it, 1.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: DeepLinkImportRequest src-tauri/src/deeplink/mod.rs:92— TooManyFields — 32 stored fields. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ProviderMeta src-tauri/src/provider.rs:518— TooManyFields — 31 stored fields beside 3 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (6 members, 50+ identical tokens) src-tauri/src/proxy/handlers.rs:339— src-tauri/src/proxy/handlers.rs:339-456 | src-tauri/src/proxy/handlers.rs:999-1075 | src-tauri/src/proxy/handlers.rs:1121-1267 | src-tauri/src/proxy/handlers.rs:1393-1459 | src-tauri/src/proxy/handlers.rs:1481-1610 | src-tauri/src/proxy/handlers.rs:2641-2725 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) src-tauri/src/proxy/providers/codex_chat_history.rs:440— src-tauri/src/proxy/providers/codex_chat_history.rs:440-466 | src-tauri/src/proxy/providers/codex_compaction.rs:356-390 | src-tauri/src/proxy/providers/responses_late_arguments.rs:200-240 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:767-859 | src-tauri/src/proxy/providers/streaming_gemini.rs:243-575 | src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:1104-1133 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) src-tauri/src/services/mcp.rs:680— src-tauri/src/services/mcp.rs:680-715 | src-tauri/src/services/mcp.rs:718-753 | src-tauri/src/services/mcp.rs:756-791 | src-tauri/src/services/mcp.rs:794-817 | src-tauri/src/services/mcp.rs:820-855 | src-tauri/src/services/mcp.rs:858-893 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:991— REDACTED:991-1107 | REDACTED:1156-1312 | REDACTED:1322-1654 | REDACTED:1665-1748 | REDACTED:1758-1941 | REDACTED:1951-2143 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×4
Edited copy of a member (21 corresponding lines) src-tauri/src/pi_config/mod.rs:380— src-tauri/src/pi_config/mod.rs:380-400 | src-tauri/src/services/pi_prompt_files.rs:302-322 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) src-tauri/src/session_manager/providers/hermes.rs:333— src-tauri/src/session_manager/providers/hermes.rs:333-353 | src-tauri/src/session_manager/providers/opencode.rs:231-252 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) src-tauri/src/services/provider/gemini_editor.rs:440— src-tauri/src/services/provider/gemini_editor.rs:440-460 | src-tauri/src/services/provider/grok_editor.rs:210-234 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) src-tauri/src/database/dao/proxy.rs:72— src-tauri/src/database/dao/proxy.rs:72-92 | src-tauri/src/database/dao/proxy.rs:379-406 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×4
Edited copy of a member (14 corresponding lines) src-tauri/src/services/provider/live.rs:71— src-tauri/src/services/provider/live.rs:71-84 | src-tauri/src/services/provider/live.rs:156-174 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) src-tauri/src/commands/import_export.rs:35— src-tauri/src/commands/import_export.rs:35-49 | src-tauri/src/commands/import_export.rs:82-95 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) src-tauri/src/hermes_config.rs:569— src-tauri/src/hermes_config.rs:569-582 | src-tauri/src/hermes_config.rs:586-599 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) src-tauri/src/deeplink/provider.rs:512— src-tauri/src/deeplink/provider.rs:512-529 | src-tauri/src/deeplink/provider.rs:531-544 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×4
Edited copies of one member (3 members, 8+ corresponding lines) src-tauri/src/hermes_config.rs:1147— src-tauri/src/hermes_config.rs:1147-1154 | src-tauri/src/services/claude_account/snapshot/store.rs:150-157 | src-tauri/src/services/pi_prompt_files.rs:129-138 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) src-tauri/src/claude_mcp.rs:80— src-tauri/src/claude_mcp.rs:80-87 | src-tauri/src/config.rs:364-372 | src-tauri/src/gemini_mcp.rs:14-21 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) src-tauri/src/claude_mcp.rs:89— src-tauri/src/claude_mcp.rs:89-96 | src-tauri/src/gemini_mcp.rs:23-30 | src-tauri/src/mcp/copilot.rs:65-75 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) src-tauri/src/claude_mcp.rs:115— src-tauri/src/claude_mcp.rs:115-122 | src-tauri/src/gemini_config.rs:129-139 | src-tauri/src/openclaw_config.rs:189-198 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×4
Edited copy of a member (4 corresponding lines) src-tauri/src/services/session_usage.rs:56— src-tauri/src/services/session_usage.rs:56-59 | src-tauri/src/services/sync_protocol.rs:67-70 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) src-tauri/src/services/provider/codex_client_catalog.rs:135— src-tauri/src/services/provider/codex_client_catalog.rs:135-138 | src-tauri/src/services/provider/codex_official_models.rs:154-157 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) src-tauri/src/database/mod.rs:241— src-tauri/src/database/mod.rs:241-244 | src-tauri/src/database/schema.rs:3894-3897 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) src-tauri/src/hermes_config.rs:929— src-tauri/src/hermes_config.rs:929-934 | src-tauri/src/openclaw_config.rs:725-728 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (20 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3032— src-tauri/src/proxy/providers/streaming_responses.rs:3032-3051 | src-tauri/src/proxy/providers/streaming_responses.rs:3699-3718 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3032` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) src-tauri/src/services/session_usage_copilot.rs:189— src-tauri/src/services/session_usage_copilot.rs:189-208 | src-tauri/src/services/session_usage_kimi.rs:98-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage_copilot.rs:189` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) src-tauri/src/database/schema.rs:642— src-tauri/src/database/schema.rs:642-661 | src-tauri/src/database/schema.rs:690-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/database/schema.rs:642` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/database/schema.rs:662` calls `set_user_version` and `src-tauri/src/database/schema.rs:713` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20 lines × 2) src-tauri/src/proxy/providers/transform_gemini.rs:953— src-tauri/src/proxy/providers/transform_gemini.rs:953-972 | src-tauri/src/proxy/providers/transform_gemini.rs:976-995 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform_gemini.rs:953` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) src-tauri/src/commands/misc.rs:3138— src-tauri/src/commands/misc.rs:3138-3150 | src-tauri/src/commands/misc.rs:3535-3548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:3138` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–14 lines × 2) src-tauri/src/proxy/handlers.rs:1328— src-tauri/src/proxy/handlers.rs:1328-1341 | src-tauri/src/proxy/handlers.rs:1637-1649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:1328` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–14 lines × 2) src-tauri/src/proxy/providers/streaming_gemini.rs:50— src-tauri/src/proxy/providers/streaming_gemini.rs:50-63 | src-tauri/src/proxy/providers/transform_gemini.rs:1513-1525 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_gemini.rs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–14 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:2847— src-tauri/src/proxy/providers/streaming_responses.rs:2847-2860 | src-tauri/src/proxy/providers/streaming_responses.rs:4638-4650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:2847` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/proxy/providers/streaming_responses.rs:2861` calls `Some` and `src-tauri/src/proxy/providers/streaming_responses.rs:4651` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) src-tauri/src/provider.rs:927— src-tauri/src/provider.rs:927-935 | src-tauri/src/provider.rs:991-999 | src-tauri/src/provider.rs:1026-1034 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/provider.rs:927` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) src-tauri/src/session_manager/providers/claude.rs:150— src-tauri/src/session_manager/providers/claude.rs:150-159 | src-tauri/src/session_manager/providers/codex.rs:1989-1997 | src-tauri/src/session_manager/providers/openclaw.rs:157-166 — before extracting anything, compare `src-tauri/src/session_manager/providers/claude.rs` and `src-tauri/src/session_manager/providers/codex.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/claude.rs:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 3) src-tauri/src/session_manager/providers/opencode.rs:589— src-tauri/src/session_manager/providers/opencode.rs:589-597 | src-tauri/src/session_manager/providers/opencode.rs:814-822 | src-tauri/src/session_manager/providers/opencode.rs:883-891 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/opencode.rs:589` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) src-tauri/src/session_manager/providers/claude.rs:161— src-tauri/src/session_manager/providers/claude.rs:161-169 | src-tauri/src/session_manager/providers/codex.rs:2008-2016 | src-tauri/src/session_manager/providers/openclaw.rs:176-184 — before extracting anything, compare `src-tauri/src/session_manager/providers/claude.rs` and `src-tauri/src/session_manager/providers/codex.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/claude.rs:161` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) src-tauri/src/services/provider/mod.rs:8879— src-tauri/src/services/provider/mod.rs:8879-8886 | src-tauri/src/services/provider/mod.rs:8904-8911 | src-tauri/src/services/provider/mod.rs:8928-8935 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/provider/mod.rs:8879` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) src-tauri/src/deeplink/codex_link.rs:249— src-tauri/src/deeplink/codex_link.rs:249-256 | src-tauri/src/live/project/codex.rs:216-223 | src-tauri/src/services/provider/codex_terminal.rs:419-426 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (8 lines × 3) src-tauri/src/proxy/providers/codex_oauth_auth.rs:2015— src-tauri/src/proxy/providers/codex_oauth_auth.rs:2015-2022 | src-tauri/src/proxy/providers/copilot_auth.rs:1495-1502 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:817-824 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:2015` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) src-tauri/src/session_manager/providers/opencode_blocks.rs:84— src-tauri/src/session_manager/providers/opencode_blocks.rs:84-91 | src-tauri/src/session_manager/providers/pi_blocks.rs:141-148 | src-tauri/src/session_manager/providers/pi_blocks.rs:327-334 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/opencode_blocks.rs:84` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) src-tauri/src/deeplink/provider.rs:1347— src-tauri/src/deeplink/provider.rs:1347-1352 | src-tauri/src/deeplink/provider.rs:1567-1572 | src-tauri/src/deeplink/provider.rs:1693-1701 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/deeplink/provider.rs:1347` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 3) src-tauri/src/deeplink/codex_link.rs:258— src-tauri/src/deeplink/codex_link.rs:258-263 | src-tauri/src/deeplink/grok_link.rs:195-200 | src-tauri/src/live/project/codex.rs:225-230 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:121— src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:121-126 | src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:131-136 | src-tauri/src/proxy/providers/transform_codex_responses_namespace.rs:182-187 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 3) src-tauri/src/deeplink/provider.rs:1361— src-tauri/src/deeplink/provider.rs:1361-1366 | src-tauri/src/deeplink/provider.rs:1450-1455 | src-tauri/src/deeplink/provider.rs:1591-1596 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/deeplink/provider.rs:1361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 2 locations) src/components/providers/forms/ClaudeFormFields.tsx:416— src/components/providers/forms/ClaudeFormFields.tsx:416 · src/components/providers/forms/ClaudeFormFields.tsx:452 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (34 lines × 2 locations) src/components/settings/WebdavSyncSection.tsx:1586— src/components/settings/WebdavSyncSection.tsx:1586 · src/components/settings/WebdavSyncSection.tsx:1747 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2 locations) src/components/universal/UniversalProviderFormModal.tsx:190— src/components/universal/UniversalProviderFormModal.tsx:190 · src/components/universal/UniversalProviderFormModal.tsx:249 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (34 lines × 2 locations) src/config/codexProviderPresets.ts:3135— src/config/codexProviderPresets.ts:3135 · src/config/codexProviderPresets.ts:3185 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
Focus outline removed inline src/components/providers/forms/OmoFormFields.tsx:164— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline src/components/usage/TablePagination.tsx:112— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline src/tray-panel/TrayPanel.tsx:456— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
ProviderForm.ProviderFormFull::performSubmit (cyclomatic 146) src/components/providers/forms/ProviderForm.tsx:1779— ProviderForm.ProviderFormFull::performSubmit has cyclomatic complexity 146 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull, ProviderForm.ProviderFormFull::handleSubmit, ProviderForm.ProviderFormFull::handlePresetChange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ProviderForm.ProviderFormFull::handleSubmit (cyclomatic 88) src/components/providers/forms/ProviderForm.tsx:1375— ProviderForm.ProviderFormFull::handleSubmit has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull, ProviderForm.ProviderFormFull::performSubmit, ProviderForm.ProviderFormFull::handlePresetChange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ProviderForm.ProviderFormFull::handlePresetChange (cyclomatic 25) src/components/providers/forms/ProviderForm.tsx:2298— ProviderForm.ProviderFormFull::handlePresetChange has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull, ProviderForm.ProviderFormFull::handleSubmit, ProviderForm.ProviderFormFull::performSubmit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Database::apply_schema_migrations_on_conn (cyclomatic 47) src-tauri/src/database/schema.rs:492— Database::apply_schema_migrations_on_conn has cyclomatic complexity 47 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Database::get_daily_trends (cyclomatic 21) REDACTED:1315— Database::get_daily_trends has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Database::dump_sql (cyclomatic 16) REDACTED:703— Database::dump_sql has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App::handleDuplicateProvider (cyclomatic 30) src/App.tsx:1209— App.App::handleDuplicateProvider has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (App.App, App.App::renderAppPageHeader, App.App::renderProviderList) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
App.App::renderAppPageHeader (cyclomatic 20) src/App.tsx:1517— App.App::renderAppPageHeader has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (App.App, App.App::handleDuplicateProvider, App.App::renderProviderList) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
App.App::renderProviderList (cyclomatic 19) src/App.tsx:1658— App.App::renderProviderList has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (App.App, App.App::handleDuplicateProvider, App.App::renderAppPageHeader) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CodexOAuthManager::adopt_account_refresh_token_under_lock (cyclomatic 26) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1250— CodexOAuthManager::adopt_account_refresh_token_under_lock has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CodexOAuthManager::add_account_internal (cyclomatic 19) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1691— CodexOAuthManager::add_account_internal has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CodexOAuthManager::resolve_valid_cached_token_under_lock (cyclomatic 16) src-tauri/src/proxy/providers/codex_oauth_auth.rs:894— CodexOAuthManager::resolve_valid_cached_token_under_lock has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BufferedCitationTextState::render_message_part (cyclomatic 26) src-tauri/src/proxy/providers/streaming_responses.rs:1653— BufferedCitationTextState::render_message_part has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BufferedCitationTextState::merge_part_indices (cyclomatic 24) src-tauri/src/proxy/providers/streaming_responses.rs:870— BufferedCitationTextState::merge_part_indices has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BufferedCitationTextState::finish_unkeyed_text (cyclomatic 18) src-tauri/src/proxy/providers/streaming_responses.rs:1116— BufferedCitationTextState::finish_unkeyed_text has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RequestForwarder::forward (cognitive 404) src-tauri/src/proxy/forwarder.rs:1543— RequestForwarder::forward has cognitive complexity 404 (threshold 15). Drivers by points: if/else 180 (297 pts), boolean chains 54, match/switch 14 (41 pts), loops 6 (12 pts) (nesting depth added 150). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RequestForwarder::forward_with_retry_inner (cognitive 145) src-tauri/src/proxy/forwarder.rs:915— RequestForwarder::forward_with_retry_inner has cognitive complexity 145 (threshold 15). Drivers by points: if/else 33 (108 pts), match/switch 7 (30 pts), boolean chains 6, loops 1 (nesting depth added 98). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RequestForwarder::validate_responses_stream_start (cognitive 25) src-tauri/src/proxy/forwarder.rs:3234— RequestForwarder::validate_responses_stream_start has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderForm.ProviderFormFull::performSubmit (cognitive 180) src/components/providers/forms/ProviderForm.tsx:1779— ProviderForm.ProviderFormFull::performSubmit has cognitive complexity 180 (threshold 15). Drivers by points: ternaries 38 (72 pts), if/else 37 (58 pts), boolean chains 46, error handling 2 (4 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull, ProviderForm.ProviderFormFull::handleSubmit, ProviderForm.ProviderFormFull::handlePresetChange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ProviderForm.ProviderFormFull::handleSubmit (cognitive 123) src/components/providers/forms/ProviderForm.tsx:1375— ProviderForm.ProviderFormFull::handleSubmit has cognitive complexity 123 (threshold 15). Drivers by points: if/else 47 (81 pts), boolean chains 29, ternaries 4 (11 pts), error handling 1 (2 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull, ProviderForm.ProviderFormFull::performSubmit, ProviderForm.ProviderFormFull::handlePresetChange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ProviderForm.ProviderFormFull::handlePresetChange (cognitive 39) src/components/providers/forms/ProviderForm.tsx:2298— ProviderForm.ProviderFormFull::handlePresetChange has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (21 pts), ternaries 9 (17 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull, ProviderForm.ProviderFormFull::handleSubmit, ProviderForm.ProviderFormFull::performSubmit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BufferedCitationTextState::render_message_part (cognitive 42) src-tauri/src/proxy/providers/streaming_responses.rs:1653— BufferedCitationTextState::render_message_part has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 5 (13 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BufferedCitationTextState::merge_part_indices (cognitive 30) src-tauri/src/proxy/providers/streaming_responses.rs:870— BufferedCitationTextState::merge_part_indices has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 7, loops 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BufferedCitationTextState::finish_unkeyed_text (cognitive 28) src-tauri/src/proxy/providers/streaming_responses.rs:1116— BufferedCitationTextState::finish_unkeyed_text has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexOAuthManager::adopt_account_refresh_token_under_lock (cognitive 37) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1250— CodexOAuthManager::adopt_account_refresh_token_under_lock has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 6 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexOAuthManager::add_account_internal (cognitive 24) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1691— CodexOAuthManager::add_account_internal has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CodexOAuthManager::resolve_valid_cached_token_under_lock (cognitive 19) src-tauri/src/proxy/providers/codex_oauth_auth.rs:894— CodexOAuthManager::resolve_valid_cached_token_under_lock has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (18 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
McpService::upsert_server (cognitive 36) src-tauri/src/services/mcp.rs:29— McpService::upsert_server has cognitive complexity 36 (threshold 15). Drivers by points: if/else 22, boolean chains 14. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
McpService::delete_server (cognitive 36) src-tauri/src/services/mcp.rs:167— McpService::delete_server has cognitive complexity 36 (threshold 15). Drivers by points: if/else 22 (36 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
McpService::toggle_app (cognitive 17) src-tauri/src/services/mcp.rs:272— McpService::toggle_app has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (17 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ChatToResponsesState::finalize_tools (cognitive 29) src-tauri/src/proxy/providers/streaming_codex_chat.rs:566— ChatToResponsesState::finalize_tools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatToResponsesState::handle_chat_chunk (cognitive 21) src-tauri/src/proxy/providers/streaming_codex_chat.rs:106— ChatToResponsesState::handle_chat_chunk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatToResponsesState::push_tool_call_delta (cognitive 17) src-tauri/src/proxy/providers/streaming_codex_chat.rs:293— ChatToResponsesState::push_tool_call_delta has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×3
Edited copy of a member (32 corresponding lines) src-tauri/src/jsonc_document.rs:283— src-tauri/src/jsonc_document.rs:283-314 | src-tauri/src/jsonc_document.rs:320-351 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) src-tauri/src/database/dao/proxy.rs:340— src-tauri/src/database/dao/proxy.rs:340-376 | src-tauri/src/database/dao/proxy.rs:631-662 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) src-tauri/src/proxy/providers/streaming_gemini.rs:46— src-tauri/src/proxy/providers/streaming_gemini.rs:46-81 | src-tauri/src/proxy/providers/transform_gemini.rs:1512-1543 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×3
Edited copy of a member (34 corresponding lines) src-tauri/src/jsonc_document.rs:203— src-tauri/src/jsonc_document.rs:203-238 | src-tauri/src/jsonc_document.rs:244-277 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) src-tauri/src/proxy/handlers.rs:1310— src-tauri/src/proxy/handlers.rs:1310-1345 | src-tauri/src/proxy/handlers.rs:1620-1653 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) src-tauri/src/session_manager/providers/claude.rs:54— src-tauri/src/session_manager/providers/claude.rs:54-87 | src-tauri/src/session_manager/providers/gemini.rs:472-508 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×3
Edited copy of a member (5 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:495— src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:495-499 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:694-701 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) src-tauri/src/commands/misc.rs:1935— src-tauri/src/commands/misc.rs:1935-1941 | src-tauri/src/services/skill.rs:3757-3761 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) src-tauri/src/jsonc_document.rs:181— src-tauri/src/jsonc_document.rs:181-185 | src-tauri/src/openclaw_config.rs:436-440 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (12–13 lines × 2) src-tauri/src/codex_config.rs:439— src-tauri/src/codex_config.rs:439-450 | src-tauri/src/codex_config.rs:467-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) src-tauri/src/commands/failover.rs:204— src-tauri/src/commands/failover.rs:204-215 | src-tauri/src/commands/failover.rs:239-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/failover.rs:204` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) src-tauri/src/proxy/handlers.rs:1936— src-tauri/src/proxy/handlers.rs:1936-1947 | src-tauri/src/proxy/handlers.rs:2100-2112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:1936` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–12 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1457— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1457-1466 | src-tauri/src/proxy/providers/copilot_auth.rs:674-685 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1457` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–12 lines × 2) src-tauri/src/services/skill.rs:983— src-tauri/src/services/skill.rs:983-992 | src-tauri/src/services/skill.rs:1694-1705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/skill.rs:983` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–12 lines × 2) src-tauri/src/session_manager/providers/claude.rs:207— src-tauri/src/session_manager/providers/claude.rs:207-218 | src-tauri/src/session_manager/providers/codex.rs:2048-2057 — before extracting anything, compare `src-tauri/src/session_manager/providers/claude.rs` and `src-tauri/src/session_manager/providers/codex.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/claude.rs:207` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1901— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1901-1910 | src-tauri/src/proxy/providers/copilot_auth.rs:1424-1434 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:1901` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) src-tauri/src/services/s3.rs:459— src-tauri/src/services/s3.rs:459-469 | src-tauri/src/services/webdav.rs:287-296 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 2) src-tauri/src/services/session_usage_dsh.rs:105— src-tauri/src/services/session_usage_dsh.rs:105-115 | src-tauri/src/services/session_usage_kimi.rs:28-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage_dsh.rs:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) src-tauri/src/commands/misc.rs:3339— src-tauri/src/commands/misc.rs:3339-3345 | src-tauri/src/commands/misc.rs:3370-3377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) src-tauri/src/session_manager/providers/claude.rs:183— src-tauri/src/session_manager/providers/claude.rs:183-189 | src-tauri/src/session_manager/providers/claude.rs:231-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/claude.rs:183` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) src-tauri/src/proxy/copilot_optimizer.rs:463— src-tauri/src/proxy/copilot_optimizer.rs:463-469 | src-tauri/src/proxy/copilot_optimizer.rs:522-529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/copilot_optimizer.rs:522` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 2) src-tauri/src/commands/misc.rs:220— src-tauri/src/commands/misc.rs:220-225 | src-tauri/src/commands/misc.rs:632-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `tools` to `Option<Vec<String>>` in one and `&[String]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6–7 lines × 2) src-tauri/src/database/dao/profiles.rs:46— src-tauri/src/database/dao/profiles.rs:46-52 | src-tauri/src/database/dao/profiles.rs:75-80 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/database/dao/profiles.rs:46` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–7 lines × 2) src-tauri/src/mcp/mcode.rs:52— src-tauri/src/mcp/mcode.rs:52-57 | src-tauri/src/mcp/pi.rs:221-227 — before extracting anything, compare `src-tauri/src/mcp/mcode.rs` and `src-tauri/src/mcp/pi.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/pi.rs:221` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 4) src-tauri/src/proxy/providers/streaming_responses.rs:2882— src-tauri/src/proxy/providers/streaming_responses.rs:2882-2890 | src-tauri/src/proxy/providers/streaming_responses.rs:3363-3371 | src-tauri/src/proxy/providers/streaming_responses.rs:4088-4096 | src-tauri/src/proxy/providers/streaming_responses.rs:4495-4500 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) src-tauri/src/mcp/kimi.rs:99— src-tauri/src/mcp/kimi.rs:99-104 | src-tauri/src/mcp/mcode.rs:84-89 | src-tauri/src/mcp/omp.rs:213-218 | src-tauri/src/mcp/pi.rs:287-292 — before extracting anything, compare `src-tauri/src/mcp/kimi.rs` and `src-tauri/src/mcp/mcode.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/kimi.rs:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/mcp/omp.rs:212` calls `native_enabled` and `src-tauri/src/mcp/pi.rs:286` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) src-tauri/src/app_config.rs:1126— src-tauri/src/app_config.rs:1126-1133 | src-tauri/src/proxy/providers/gemini.rs:99-104 | src-tauri/src/services/provider/mod.rs:8731-8737 | src-tauri/src/services/provider/mod.rs:8740-8745 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/app_config.rs:1126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (32 lines × 2 locations) src/components/AgyAccountQuotaFooter.tsx:7— src/components/AgyAccountQuotaFooter.tsx:7 · src/components/ClaudeAccountQuotaFooter.tsx:8 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (32 lines × 2 locations) src/components/providers/forms/OpenCodeFormFields.tsx:1133— src/components/providers/forms/OpenCodeFormFields.tsx:1133 · src/components/providers/forms/OpenCodeFormFields.tsx:1220 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (32 lines × 2 locations) src/config/piProviderPresets.ts:2968— src/config/piProviderPresets.ts:2968 · src/config/piProviderPresets.ts:3023 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
RequestForwarder::forward (cyclomatic 217) src-tauri/src/proxy/forwarder.rs:1543— RequestForwarder::forward has cyclomatic complexity 217 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RequestForwarder::forward_with_retry_inner (cyclomatic 45) src-tauri/src/proxy/forwarder.rs:915— RequestForwarder::forward_with_retry_inner has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit (cyclomatic 40) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:718— ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (ClaudeDesktopProviderForm.ClaudeDesktopProviderForm, ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels (cyclomatic 16) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:606— ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (ClaudeDesktopProviderForm.ClaudeDesktopProviderForm, ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
UsageScriptModal.UsageScriptModal::handleTest (cyclomatic 38) src/components/UsageScriptModal.tsx:617— UsageScriptModal.UsageScriptModal::handleTest has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (UsageScriptModal.UsageScriptModal, UsageScriptModal.UsageScriptModal::handleUsePreset) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
UsageScriptModal.UsageScriptModal::handleUsePreset (cyclomatic 18) src/components/UsageScriptModal.tsx:861— UsageScriptModal.UsageScriptModal::handleUsePreset has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (UsageScriptModal.UsageScriptModal, UsageScriptModal.UsageScriptModal::handleTest) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CodexConfigPatch::write_route (cyclomatic 24) src-tauri/src/live/project/codex.rs:759— CodexConfigPatch::write_route has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CodexConfigPatch::apply_to (cyclomatic 19) src-tauri/src/live/project/codex.rs:648— CodexConfigPatch::apply_to has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OmoFormFields.OmoFormFields::renderCustomModelRow (cyclomatic 20) src/components/providers/forms/OmoFormFields.tsx:973— OmoFormFields.OmoFormFields::renderCustomModelRow has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (OmoFormFields.OmoFormFields::handleFillAllRecommended) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OmoFormFields.OmoFormFields::handleFillAllRecommended (cyclomatic 17) src/components/providers/forms/OmoFormFields.tsx:733— OmoFormFields.OmoFormFields::handleFillAllRecommended has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (OmoFormFields.OmoFormFields::renderCustomModelRow) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
TranscriptBuilder::push_assistant (cyclomatic 17) src-tauri/src/session_manager/providers/claude.rs:565— TranscriptBuilder::push_assistant has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TranscriptBuilder::tool_result_block (cyclomatic 17) src-tauri/src/session_manager/providers/claude.rs:785— TranscriptBuilder::tool_result_block has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageScriptModal.UsageScriptModal::handleTest (cognitive 65) src/components/UsageScriptModal.tsx:617— UsageScriptModal.UsageScriptModal::handleTest has cognitive complexity 65 (threshold 15). Drivers by points: ternaries 14 (34 pts), if/else 14 (20 pts), boolean chains 10, error handling 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (UsageScriptModal.UsageScriptModal, UsageScriptModal.UsageScriptModal::handleUsePreset) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
UsageScriptModal.UsageScriptModal::handleUsePreset (cognitive 29) src/components/UsageScriptModal.tsx:861— UsageScriptModal.UsageScriptModal::handleUsePreset has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 8 (9 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (UsageScriptModal.UsageScriptModal, UsageScriptModal.UsageScriptModal::handleTest) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit (cognitive 51) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:718— ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 9 (16 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (ClaudeDesktopProviderForm.ClaudeDesktopProviderForm, ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels (cognitive 21) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:606— ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (ClaudeDesktopProviderForm.ClaudeDesktopProviderForm, ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CodexAdapter::extract_base_url (cognitive 30) src-tauri/src/proxy/providers/codex.rs:1168— CodexAdapter::extract_base_url has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (30 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CodexAdapter::extract_key (cognitive 18) src-tauri/src/proxy/providers/codex.rs:1097— CodexAdapter::extract_key has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (18 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexConfigPatch::apply_to (cognitive 27) src-tauri/src/live/project/codex.rs:648— CodexConfigPatch::apply_to has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 7 (9 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexConfigPatch::write_route (cognitive 27) src-tauri/src/live/project/codex.rs:759— CodexConfigPatch::write_route has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3, loops 2, match/switch 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkBuddyAccountManager::read_live (cognitive 19) src-tauri/src/services/workbuddy_account/mod.rs:789— WorkBuddyAccountManager::read_live has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 4 (6 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkBuddyAccountManager::switch_to (cognitive 18) src-tauri/src/services/workbuddy_account/mod.rs:481— WorkBuddyAccountManager::switch_to has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiAppConfig::load (cognitive 18) src-tauri/src/app_config.rs:766— MultiAppConfig::load has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 2 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MultiAppConfig::migrate_mcp_to_unified (cognitive 17) src-tauri/src/app_config.rs:1055— MultiAppConfig::migrate_mcp_to_unified has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) src-tauri/src/mcp/agy.rs:11— src-tauri/src/mcp/agy.rs:11-29 | src-tauri/src/mcp/kimi.rs:19-33 | src-tauri/src/mcp/mcode.rs:11-23 | src-tauri/src/mcp/pi.rs:65-77 | src-tauri/src/mcp/workbuddy.rs:25-43 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) src-tauri/src/proxy/handlers.rs:630— src-tauri/src/proxy/handlers.rs:630-939 | src-tauri/src/proxy/handlers.rs:1668-1818 | src-tauri/src/proxy/handlers.rs:1827-2058 | src-tauri/src/proxy/handlers.rs:2075-2222 | src-tauri/src/proxy/handlers.rs:2322-2386 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (70 corresponding lines) · ×2
Edited copy of a member (70 corresponding lines) src-tauri/src/live/patch/json.rs:47— src-tauri/src/live/patch/json.rs:47-120 | src-tauri/src/live/patch/toml.rs:33-102 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (70 corresponding lines) REDACTED:260— REDACTED:260-340 | src-tauri/src/services/subscription_grok.rs:62-131 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×2
Edited copy of a member (45 corresponding lines) src-tauri/src/services/coding_plan.rs:396— src-tauri/src/services/coding_plan.rs:396-440 | REDACTED:451-505 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (45 corresponding lines) src-tauri/src/provider.rs:891— src-tauri/src/provider.rs:891-935 | src-tauri/src/provider.rs:938-999 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) src-tauri/src/config.rs:168— src-tauri/src/config.rs:168-207 | src-tauri/src/config.rs:215-263 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (40 corresponding lines) src-tauri/src/commands/misc.rs:6616— src-tauri/src/commands/misc.rs:6616-6664 | src-tauri/src/session_manager/terminal/mod.rs:308-347 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×2
Edited copy of a member (35 corresponding lines) src-tauri/src/commands/auth.rs:622— src-tauri/src/commands/auth.rs:622-670 | src-tauri/src/commands/auth.rs:761-795 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) src-tauri/src/proxy/providers/transform_responses.rs:936— src-tauri/src/proxy/providers/transform_responses.rs:936-973 | src-tauri/src/proxy/providers/transform_responses.rs:1039-1073 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×2
Edited copy of a member (25 corresponding lines) src-tauri/src/proxy/providers/transform_responses.rs:347— src-tauri/src/proxy/providers/transform_responses.rs:347-371 | src-tauri/src/proxy/providers/transform_responses.rs:434-458 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) src-tauri/src/proxy/providers/transform_responses.rs:41— src-tauri/src/proxy/providers/transform_responses.rs:41-65 | src-tauri/src/proxy/providers/transform_responses.rs:67-97 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×2
Edited copy of a member (29 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:717— src-tauri/src/proxy/providers/codex_oauth_auth.rs:717-745 | src-tauri/src/proxy/providers/codex_oauth_auth.rs:751-786 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) src-tauri/src/proxy/media_sanitizer.rs:185— src-tauri/src/proxy/media_sanitizer.rs:185-213 | src-tauri/src/proxy/media_sanitizer.rs:400-429 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) src-tauri/src/openclaw_config.rs:735— src-tauri/src/openclaw_config.rs:735-749 | src-tauri/src/openclaw_config.rs:774-788 | src-tauri/src/openclaw_config.rs:819-829 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) src-tauri/src/commands/provider.rs:1095— src-tauri/src/commands/provider.rs:1095-1105 | src-tauri/src/commands/provider.rs:1112-1122 | src-tauri/src/commands/provider.rs:1129-1139 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×2
Edited copies of one member (4 members, 15+ corresponding lines) src-tauri/src/services/session_usage_copilot.rs:265— src-tauri/src/services/session_usage_copilot.rs:265-279 | src-tauri/src/services/session_usage_dsh.rs:633-648 | src-tauri/src/services/session_usage_kimi.rs:236-250 | src-tauri/src/services/session_usage_workbuddy.rs:195-210 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 15+ corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1925— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1925-1939 | src-tauri/src/proxy/providers/copilot_auth.rs:1303-1317 | src-tauri/src/proxy/providers/copilot_auth.rs:1458-1472 | src-tauri/src/proxy/switch_lock.rs:26-41 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (24 lines × 2) src-tauri/src/claude_desktop_config.rs:1108— src-tauri/src/claude_desktop_config.rs:1108-1131 | src-tauri/src/proxy/providers/claude.rs:249-272 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/claude_desktop_config.rs:1108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) src-tauri/src/proxy/providers/streaming_gemini.rs:367— src-tauri/src/proxy/providers/streaming_gemini.rs:367-390 | src-tauri/src/proxy/providers/streaming_gemini.rs:429-452 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_gemini.rs:367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) src-tauri/src/proxy/providers/streaming.rs:448— src-tauri/src/proxy/providers/streaming.rs:448-470 | src-tauri/src/proxy/providers/streaming.rs:635-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming.rs:448` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (23 lines × 2) src-tauri/src/commands/config.rs:221— src-tauri/src/commands/config.rs:221-243 | src-tauri/src/commands/config.rs:250-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) src-tauri/src/commands/misc.rs:6468— src-tauri/src/commands/misc.rs:6468-6489 | src-tauri/src/session_manager/terminal/mod.rs:124-145 — before extracting anything, compare `src-tauri/src/commands/misc.rs` and `src-tauri/src/session_manager/terminal/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (22 lines × 2) src-tauri/src/mcp/claude.rs:101— src-tauri/src/mcp/claude.rs:101-122 | src-tauri/src/mcp/gemini.rs:97-118 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/gemini.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/claude.rs:101` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) src-tauri/src/jsonc_document.rs:218— src-tauri/src/jsonc_document.rs:218-238 | src-tauri/src/jsonc_document.rs:257-277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/jsonc_document.rs:218` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `&Option<RtJSONObjectContext>` in one and `&Option<RtJSONArrayContext>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/jsonc_document.rs:216` calls `contains` and `src-tauri/src/jsonc_document.rs:256` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (21 lines × 2) src-tauri/src/hermes_config.rs:393— src-tauri/src/hermes_config.rs:393-413 | src-tauri/src/openclaw_config.rs:405-425 — before extracting anything, compare `src-tauri/src/hermes_config.rs` and `src-tauri/src/openclaw_config.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/hermes_config.rs:393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) src-tauri/src/claude_mcp.rs:337— src-tauri/src/claude_mcp.rs:337-352 | src-tauri/src/gemini_mcp.rs:87-103 — before extracting anything, compare `src-tauri/src/claude_mcp.rs` and `src-tauri/src/gemini_mcp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/claude_mcp.rs:337` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) src-tauri/src/proxy/response_processor.rs:535— src-tauri/src/proxy/response_processor.rs:535-551 | src-tauri/src/proxy/response_processor.rs:562-577 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/response_processor.rs:535` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/proxy/response_processor.rs:578` calls `default` and `src-tauri/src/proxy/response_processor.rs:552` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–15 lines × 3) src-tauri/src/proxy/handlers.rs:2033— src-tauri/src/proxy/handlers.rs:2033-2047 | src-tauri/src/proxy/handlers.rs:2198-2211 | src-tauri/src/proxy/handlers.rs:2363-2377 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:2033` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 3) src-tauri/src/session_manager/providers/claude.rs:264— src-tauri/src/session_manager/providers/claude.rs:264-278 | src-tauri/src/session_manager/providers/codex.rs:2080-2094 | src-tauri/src/session_manager/providers/openclaw.rs:244-257 — before extracting anything, compare `src-tauri/src/session_manager/providers/claude.rs` and `src-tauri/src/session_manager/providers/codex.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/claude.rs:264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) src-tauri/src/commands/misc.rs:6718— src-tauri/src/commands/misc.rs:6718-6732 | src-tauri/src/commands/misc.rs:7136-7149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:6718` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/commands/misc.rs:7151` calls `remove_file` and `src-tauri/src/commands/misc.rs:6734` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–15 lines × 2) src-tauri/src/session_manager/providers/grokbuild.rs:97— src-tauri/src/session_manager/providers/grokbuild.rs:97-111 | src-tauri/src/session_manager/providers/hermes.rs:878-891 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/grokbuild.rs:97` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–15 lines × 2) src-tauri/src/jsonc_document.rs:204— src-tauri/src/jsonc_document.rs:204-215 | src-tauri/src/jsonc_document.rs:245-259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/jsonc_document.rs:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `&Option<RtJSONObjectContext>` in one and `&Option<RtJSONArrayContext>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12–15 lines × 2) src-tauri/src/proxy/handlers.rs:761— src-tauri/src/proxy/handlers.rs:761-775 | src-tauri/src/proxy/handlers.rs:1920-1931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:761` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 3) src-tauri/src/services/coding_plan.rs:177— src-tauri/src/services/coding_plan.rs:177-188 | src-tauri/src/services/coding_plan.rs:565-576 | src-tauri/src/services/coding_plan.rs:649-660 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:177` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 3) src-tauri/src/services/s3.rs:335— src-tauri/src/services/s3.rs:335-346 | src-tauri/src/services/s3.rs:422-433 | src-tauri/src/services/s3.rs:493-504 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/s3.rs:335` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–11 lines × 2) src-tauri/src/commands/xai_oauth.rs:35— src-tauri/src/commands/xai_oauth.rs:35-45 | src-tauri/src/commands/xai_oauth.rs:111-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 2) src-tauri/src/services/skill.rs:2542— src-tauri/src/services/skill.rs:2542-2550 | src-tauri/src/services/skill.rs:5228-5238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/skill.rs:2542` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8–10 lines × 2) src-tauri/src/codex_history_migration.rs:768— src-tauri/src/codex_history_migration.rs:768-775 | src-tauri/src/codex_history_migration.rs:1294-1303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/codex_history_migration.rs:776` calls `get`, `as_str` and `src-tauri/src/codex_history_migration.rs:1304` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–10 lines × 2) src-tauri/src/deeplink/provider.rs:1048— src-tauri/src/deeplink/provider.rs:1048-1057 | src-tauri/src/deeplink/provider.rs:1133-1140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/deeplink/provider.rs:1048` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/deeplink/provider.rs:1061` calls `Some` and `src-tauri/src/deeplink/provider.rs:1143` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–10 lines × 2) src-tauri/src/commands/workspace.rs:69— src-tauri/src/commands/workspace.rs:69-78 | src-tauri/src/commands/workspace.rs:206-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/workspace.rs:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/commands/workspace.rs:203` calls `to_lowercase` and `src-tauri/src/commands/workspace.rs:65` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–10 lines × 2) src-tauri/src/lightweight.rs:52— src-tauri/src/lightweight.rs:52-60 | src-tauri/src/lightweight.rs:95-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) src-tauri/src/kimi_config.rs:369— src-tauri/src/kimi_config.rs:369-376 | src-tauri/src/kimi_config.rs:384-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/kimi_config.rs:369` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) src-tauri/src/services/claude_account/shared.rs:254— src-tauri/src/services/claude_account/shared.rs:254-262 | src-tauri/src/services/claude_account/shared.rs:264-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 4) src-tauri/src/proxy/handlers.rs:683— src-tauri/src/proxy/handlers.rs:683-691 | src-tauri/src/proxy/handlers.rs:1848-1855 | src-tauri/src/proxy/handlers.rs:2232-2238 | src-tauri/src/proxy/response_processor.rs:511-519 — before extracting anything, compare `src-tauri/src/proxy/handlers.rs` and `src-tauri/src/proxy/response_processor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) src-tauri/src/proxy/handlers.rs:1753— src-tauri/src/proxy/handlers.rs:1753-1759 | src-tauri/src/proxy/handlers.rs:1995-2001 | src-tauri/src/proxy/handlers.rs:2160-2166 | src-tauri/src/proxy/response_processor.rs:279-285 — before extracting anything, compare `src-tauri/src/proxy/handlers.rs` and `src-tauri/src/proxy/response_processor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 5) src-tauri/src/mcp/agy.rs:124— src-tauri/src/mcp/agy.rs:124-128 | src-tauri/src/mcp/kimi.rs:100-104 | src-tauri/src/mcp/mcode.rs:85-89 | src-tauri/src/mcp/omp.rs:214-218 | src-tauri/src/mcp/pi.rs:288-292 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/agy.rs:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/mcp/omp.rs:212` calls `native_enabled` and `src-tauri/src/mcp/pi.rs:286` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 5) src-tauri/src/mcp/agy.rs:12— src-tauri/src/mcp/agy.rs:12-16 | src-tauri/src/mcp/kimi.rs:20-24 | src-tauri/src/mcp/mcode.rs:12-16 | src-tauri/src/mcp/pi.rs:66-70 | src-tauri/src/mcp/workbuddy.rs:26-30 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/mcp/agy.rs:18` calls `trim`, `is_empty`, `Ok` and `src-tauri/src/mcp/kimi.rs:25` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
R10 · Code Duplication· Duplicated block with local edits (44 matched lines × 2 locations) · ×2
Duplicated block with local edits (44 matched lines × 2 locations) src/components/providers/forms/GeminiConfigSections.tsx:18— src/components/providers/forms/GeminiConfigSections.tsx:18 · src/components/providers/forms/GeminiConfigSections.tsx:97 — the two spans are one implementation copied and then locally edited — 235 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (44 matched lines × 2 locations) src/components/providers/forms/OpenClawFormFields.tsx:332— src/components/providers/forms/OpenClawFormFields.tsx:332 · REDACTED:1768 — the two spans are one implementation copied and then locally edited — 192 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (35 lines × 2 locations) src/components/UsageScriptModal.tsx:1276— src/components/UsageScriptModal.tsx:1276 · src/components/UsageScriptModal.tsx:1358 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (35 lines × 2 locations) src/components/UsageScriptModal.tsx:1397— src/components/UsageScriptModal.tsx:1397 · src/components/UsageScriptModal.tsx:1490 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (33 lines × 2 locations) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:752— src/components/providers/forms/ClaudeDesktopProviderForm.tsx:752 · src/components/providers/forms/ProviderForm.tsx:1588 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (33 lines × 2 locations) src/components/settings/WebdavSyncSection.tsx:516— src/components/settings/WebdavSyncSection.tsx:516 · src/components/settings/WebdavSyncSection.tsx:768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC2 · Forms & labels· <FolderInput> field component without a label · ×1
<FolderInput> field component without a label src/components/providers/forms/OmoFormFields.tsx:1204— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC3 · Page structure· Heading level jumps from h2 to h4 · ×1
Heading level jumps from h2 to h4 deplink.html:404— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Low contrast colour pair in CSS (3.6:1) deplink.html:174— `.btn.solid` sets color: #ffffff on background-color: #ea580c — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×1
Focus outline removed in CSS without a :focus replacement src/index.css:562— `html:not([data-keyboard]) :is(*:not(input, textarea, select, [contenteditable="true"])):focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
UnifiedSkillsPanel.UnifiedSkillsPanel (cyclomatic 220) src/components/skills/UnifiedSkillsPanel.tsx:129— UnifiedSkillsPanel.UnifiedSkillsPanel has cyclomatic complexity 220 (threshold 15). Of this number, 58 points are the body's own statements and 162 belong to 53 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CodexFormFields.CodexFormFields (cyclomatic 219) src/components/providers/forms/CodexFormFields.tsx:637— CodexFormFields.CodexFormFields has cyclomatic complexity 219 (threshold 15). Of this number, 127 points are the body's own statements and 92 belong to 36 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProviderForm.ProviderFormFull (cyclomatic 173) src/components/providers/forms/ProviderForm.tsx:379— ProviderForm.ProviderFormFull has cyclomatic complexity 173 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull::handleSubmit, ProviderForm.ProviderFormFull::performSubmit, ProviderForm.ProviderFormFull::handlePresetChange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SessionManagerPage.SessionManagerPage (cyclomatic 153) src/components/sessions/SessionManagerPage.tsx:152— SessionManagerPage.SessionManagerPage has cyclomatic complexity 153 (threshold 15). Of this number, 45 points are the body's own statements and 108 belong to 51 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClaudeFormFields.ClaudeFormFields (cyclomatic 136) src/components/providers/forms/ClaudeFormFields.tsx:196— ClaudeFormFields.ClaudeFormFields has cyclomatic complexity 136 (threshold 15). Of this number, 95 points are the body's own statements and 41 belong to 22 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UnifiedMcpPanel.UnifiedMcpPanel (cyclomatic 133) src/components/mcp/UnifiedMcpPanel.tsx:148— UnifiedMcpPanel.UnifiedMcpPanel has cyclomatic complexity 133 (threshold 15). Of this number, 42 points are the body's own statements and 91 belong to 27 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderCard.ProviderCard (cyclomatic 126) src/components/providers/ProviderCard.tsx:220— ProviderCard.ProviderCard has cyclomatic complexity 126 (threshold 15). Of this number, 119 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AddProviderDialog.AddProviderDialog (cyclomatic 124) src/components/providers/AddProviderDialog.tsx:58— AddProviderDialog.AddProviderDialog has cyclomatic complexity 124 (threshold 15). Of this number, 33 points are the body's own statements and 91 belong to 13 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WebdavSyncSection.WebdavSyncSection (cyclomatic 124) src/components/settings/WebdavSyncSection.tsx:236— WebdavSyncSection.WebdavSyncSection has cyclomatic complexity 124 (threshold 15). Of this number, 46 points are the body's own statements and 78 belong to 34 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProviderList.ProviderList (cyclomatic 116) src/components/providers/ProviderList.tsx:111— ProviderList.ProviderList has cyclomatic complexity 116 (threshold 15). Of this number, 53 points are the body's own statements and 63 belong to 17 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TrayPanel.TrayPanel (cyclomatic 111) src/tray-panel/TrayPanel.tsx:523— TrayPanel.TrayPanel has cyclomatic complexity 111 (threshold 15). Of this number, 16 points are the body's own statements and 95 belong to 23 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
McpFormModal.McpFormModal (cyclomatic 109) src/components/mcp/McpFormModal.tsx:127— McpFormModal.McpFormModal has cyclomatic complexity 109 (threshold 15). Of this number, 42 points are the body's own statements and 67 belong to 24 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CopilotProviderForm.CopilotProviderForm (cyclomatic 103) src/components/providers/forms/CopilotProviderForm.tsx:283— CopilotProviderForm.CopilotProviderForm has cyclomatic complexity 103 (threshold 15). Of this number, 50 points are the body's own statements and 53 belong to 22 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionReader.SessionReader (cyclomatic 101) src/components/sessions/reader/SessionReader.tsx:161— SessionReader.SessionReader has cyclomatic complexity 101 (threshold 15). Of this number, 40 points are the body's own statements and 61 belong to 25 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PromptPanel.StandardPromptPanel (cyclomatic 93) src/components/prompts/PromptPanel.tsx:37— PromptPanel.StandardPromptPanel has cyclomatic complexity 93 (threshold 15). Of this number, 26 points are the body's own statements and 67 belong to 24 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
KimiProviderForm.KimiProviderForm (cyclomatic 89) src/components/providers/forms/KimiProviderForm.tsx:111— KimiProviderForm.KimiProviderForm has cyclomatic complexity 89 (threshold 15). Of this number, 42 points are the body's own statements and 47 belong to 23 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DeepLinkImportDialog.DeepLinkImportDialog (cyclomatic 87) src/components/DeepLinkImportDialog.tsx:86— DeepLinkImportDialog.DeepLinkImportDialog has cyclomatic complexity 87 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (DeepLinkImportDialog.DeepLinkImportDialog::handleImport) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SkillsPage.SkillsPage (cyclomatic 78) src/components/skills/SkillsPage.tsx:167— SkillsPage.SkillsPage has cyclomatic complexity 78 (threshold 15). Of this number, 31 points are the body's own statements and 47 belong to 14 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PiPromptPanel.PiPromptPanel (cyclomatic 77) src/components/prompts/PiPromptPanel.tsx:54— PiPromptPanel.PiPromptPanel has cyclomatic complexity 77 (threshold 15). Of this number, 41 points are the body's own statements and 36 belong to 19 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkBuddyProviderForm.WorkBuddyProviderForm (cyclomatic 77) src/components/providers/forms/WorkBuddyProviderForm.tsx:129— WorkBuddyProviderForm.WorkBuddyProviderForm has cyclomatic complexity 77 (threshold 15). Of this number, 36 points are the body's own statements and 41 belong to 21 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageScriptModal.UsageScriptModal (cyclomatic 75) src/components/UsageScriptModal.tsx:253— UsageScriptModal.UsageScriptModal has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (UsageScriptModal.UsageScriptModal::handleTest, UsageScriptModal.UsageScriptModal::handleUsePreset) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SwitchModePanel.SwitchModePanel (cyclomatic 74) src/components/providers/mode/SwitchModePanel.tsx:102— SwitchModePanel.SwitchModePanel has cyclomatic complexity 74 (threshold 15). Of this number, 52 points are the body's own statements and 22 belong to 14 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UniversalProviderFormModal.UniversalProviderFormModal (cyclomatic 74) src/components/universal/UniversalProviderFormModal.tsx:30— UniversalProviderFormModal.UniversalProviderFormModal has cyclomatic complexity 74 (threshold 15). Of this number, 29 points are the body's own statements and 45 belong to 11 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
deplink.html.parseDeepLink (cyclomatic 66) deplink.html:1973— deplink.html.parseDeepLink has cyclomatic complexity 66 (threshold 15). Of this number, 47 points are the body's own statements and 19 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditProviderDialog.EditProviderDialog (cyclomatic 66) src/components/providers/EditProviderDialog.tsx:67— EditProviderDialog.EditProviderDialog has cyclomatic complexity 66 (threshold 15). Most of this is not in the body itself: 15 of the 66 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 139, 292, 103, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CodexOAuthSection.CodexOAuthSection (cyclomatic 66) src/components/providers/forms/CodexOAuthSection.tsx:78— CodexOAuthSection.CodexOAuthSection has cyclomatic complexity 66 (threshold 15). Of this number, 53 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OpenCodeFormFields.OpenCodeFormFields (cyclomatic 65) src/components/providers/forms/OpenCodeFormFields.tsx:312— OpenCodeFormFields.OpenCodeFormFields has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 4 of the 65 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 907, handleModelExtraFieldKeyChange, handleExtraOptionKeyChange, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
deplink.html.generateLink (cyclomatic 60) deplink.html:1468— deplink.html.generateLink has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AppsPage.ToolRow (cyclomatic 58) src/components/apps/AppsPage.tsx:736— AppsPage.ToolRow has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
presentation.buildAdditiveSections (cyclomatic 56) src/components/providers/presentation.ts:800— presentation.buildAdditiveSections has cyclomatic complexity 56 (threshold 15). Of this number, 53 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
McodeProviderForm.McodeProviderForm (cyclomatic 54) src/components/providers/forms/McodeProviderForm.tsx:83— McodeProviderForm.McodeProviderForm has cyclomatic complexity 54 (threshold 15). Of this number, 41 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionItem.SessionItem (cyclomatic 53) src/components/sessions/SessionItem.tsx:85— SessionItem.SessionItem has cyclomatic complexity 53 (threshold 15). Of this number, 51 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UsageDashboard.UsageDashboard (cyclomatic 52) src/components/usage/UsageDashboard.tsx:253— UsageDashboard.UsageDashboard has cyclomatic complexity 52 (threshold 15). Of this number, 26 points are the body's own statements and 26 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
turns.buildTurn (cyclomatic 49) src/components/sessions/reader/turns.ts:298— turns.buildTurn has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 10 of the 49 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 368, a function literal at line 344, blocksOf, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ManagedAccountsGroup.ManagedAccountsGroup (cyclomatic 48) src/components/settings/auth/ManagedAccountsGroup.tsx:118— ManagedAccountsGroup.ManagedAccountsGroup has cyclomatic complexity 48 (threshold 15). Of this number, 34 points are the body's own statements and 14 belong to 8 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RequestLogTable.RequestLogTable::renderRow (cyclomatic 45) src/components/usage/RequestLogTable.tsx:371— RequestLogTable.RequestLogTable::renderRow has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AppsPage.AppsPage (cyclomatic 44) src/components/apps/AppsPage.tsx:184— AppsPage.AppsPage has cyclomatic complexity 44 (threshold 15). Of this number, 16 points are the body's own statements and 28 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DailyMemoryPanel.DailyMemoryPanel (cyclomatic 44) src/components/workspace/DailyMemoryPanel.tsx:43— DailyMemoryPanel.DailyMemoryPanel has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 12 of the 44 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 153, 258, 210, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CopilotAuthSection.CopilotAuthSection (cyclomatic 43) src/components/providers/forms/CopilotAuthSection.tsx:69— CopilotAuthSection.CopilotAuthSection has cyclomatic complexity 43 (threshold 15). Of this number, 26 points are the body's own statements and 17 belong to 8 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionMarkdown.renderNode (cyclomatic 43) src/components/sessions/reader/SessionMarkdown.tsx:932— SessionMarkdown.renderNode has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
UsageDateRangePicker.UsageDateRangePicker (cyclomatic 43) src/components/usage/UsageDateRangePicker.tsx:114— UsageDateRangePicker.UsageDateRangePicker has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 5 of the 43 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 495, renderField, handleDatePick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
presentation.buildSwitchSectionsByView (cyclomatic 42) src/components/providers/presentation.ts:196— presentation.buildSwitchSectionsByView has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 14 of the 42 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 369, a function literal at line 261, a function literal at line 485, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
XaiOAuthSection.XaiOAuthSection (cyclomatic 42) src/components/providers/forms/XaiOAuthSection.tsx:55— XaiOAuthSection.XaiOAuthSection has cyclomatic complexity 42 (threshold 15). Of this number, 31 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClaudeDesktopProviderForm.ClaudeDesktopProviderForm (cyclomatic 42) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:254— ClaudeDesktopProviderForm.ClaudeDesktopProviderForm has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels, ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
PiProviderForm.PiProviderForm (cyclomatic 42) REDACTED:507— PiProviderForm.PiProviderForm has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (PiProviderForm.PiProviderForm::submit) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SettingsPage.SettingsPage (cyclomatic 42) src/components/settings/SettingsPage.tsx:83— SettingsPage.SettingsPage has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 4 of the 42 points are its own statements and the rest belongs to 14 function items inside it that branch (renderSection, a function literal at line 146, a function literal at line 189, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RoutingSection.RoutingSection (cyclomatic 42) src/components/settings/sections/RoutingSection.tsx:93— RoutingSection.RoutingSection has cyclomatic complexity 42 (threshold 15). Of this number, 20 points are the body's own statements and 22 belong to 8 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelsDevAutoSyncPanel.AutoSyncDialog (cyclomatic 42) src/components/usage/ModelsDevAutoSyncPanel.tsx:70— ModelsDevAutoSyncPanel.AutoSyncDialog has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 10 of the 42 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 123, a function literal at line 336, a function literal at line 92, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
deepLinkConfigPreview.parseDeepLinkConfigPreview (cyclomatic 42) src/utils/deepLinkConfigPreview.ts:44— deepLinkConfigPreview.parseDeepLinkConfigPreview has cyclomatic complexity 42 (threshold 15). Of this number, 41 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageDisplaySection.UsageDisplaySection (cyclomatic 41) src/components/usage/UsageDisplaySection.tsx:59— UsageDisplaySection.UsageDisplaySection has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 14 of the 41 points are its own statements and the rest belongs to 13 function items inside it that branch (refreshRates, changeRateSource, changeCurrency, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AgentsDefaultsPanel.AgentsDefaultsPanel (cyclomatic 39) src/components/openclaw/AgentsDefaultsPanel.tsx:28— AgentsDefaultsPanel.AgentsDefaultsPanel has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 13 of the 39 points are its own statements and the rest belongs to 9 function items inside it that branch (handleSave, getFallbackOptions, a function literal at line 45, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useManagedAuth.useManagedAuth (cyclomatic 39) src/components/providers/forms/hooks/useManagedAuth.ts:24— useManagedAuth.useManagedAuth has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 4 of the 39 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 182, 145, 329, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useOmoModelSource.useOmoModelSource.omoModelBuild (cyclomatic 39) src/components/providers/forms/hooks/useOmoModelSource.ts:117— useOmoModelSource.useOmoModelSource.omoModelBuild has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useToolManagement.useToolManagement.executeRun (cyclomatic 38) src/components/apps/useToolManagement.ts:739— useToolManagement.useToolManagement.executeRun has cyclomatic complexity 38 (threshold 15). Of this number, 17 points are the body's own statements and 21 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PromptFormPanel.PromptFormPanel (cyclomatic 38) src/components/prompts/PromptFormPanel.tsx:53— PromptFormPanel.PromptFormPanel has cyclomatic complexity 38 (threshold 15). Of this number, 22 points are the body's own statements and 16 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionStepDetails.BlockText (cyclomatic 36) src/components/sessions/reader/SessionStepDetails.tsx:73— SessionStepDetails.BlockText has cyclomatic complexity 36 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DatabaseUpgrade.DatabaseUpgrade (cyclomatic 35) src/components/DatabaseUpgrade.tsx:49— DatabaseUpgrade.DatabaseUpgrade has cyclomatic complexity 35 (threshold 15). Of this number, 28 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
JsonEditor.JsonEditor (cyclomatic 35) src/components/JsonEditor.tsx:88— JsonEditor.JsonEditor has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 113, a function literal at line 150, handleFormat, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AboutSection.AboutSection (cyclomatic 35) src/components/settings/AboutSection.tsx:48— AboutSection.AboutSection has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 134, 71, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CommonConfigEditor.CommonConfigEditor (cyclomatic 34) src/components/providers/forms/CommonConfigEditor.tsx:48— CommonConfigEditor.CommonConfigEditor has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 120, 87, 194, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ModeDialog.EnterBody (cyclomatic 34) src/components/providers/mode/ModeDialog.tsx:131— ModeDialog.EnterBody has cyclomatic complexity 34 (threshold 15). Of this number, 28 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App (cyclomatic 33) src/App.tsx:228— App.App has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 3 other methods here (App.App::handleDuplicateProvider, App.App::renderAppPageHeader, App.App::renderProviderList) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
useProviderCategory.useProviderCategory (cyclomatic 33) src/components/providers/forms/hooks/useProviderCategory.ts:22— useProviderCategory.useProviderCategory has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 33). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
SessionDiff.parseDiff (cyclomatic 33) src/components/sessions/reader/SessionDiff.tsx:26— SessionDiff.parseDiff has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 4 of the 33 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 41, pushFile). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
errorUtils.translateMcpBackendError (cyclomatic 33) REDACTED:88— errorUtils.translateMcpBackendError has cyclomatic complexity 33 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mutations.useAddProviderMutation (cyclomatic 33) src/lib/query/mutations.ts:24— mutations.useAddProviderMutation has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 29, 157, 112, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OpenTerminalDialog.OpenTerminalDialog (cyclomatic 32) src/components/providers/OpenTerminalDialog.tsx:228— OpenTerminalDialog.OpenTerminalDialog has cyclomatic complexity 32 (threshold 15). Of this number, 19 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PiProviderForm.PiProviderForm::submit (cyclomatic 32) REDACTED:1358— PiProviderForm.PiProviderForm::submit has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (PiProviderForm.PiProviderForm) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BackupListSection.BackupListSection (cyclomatic 32) src/components/settings/BackupListSection.tsx:63— BackupListSection.BackupListSection has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 7 of the 32 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 310, handleRestore, handleConfirmRename, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WorkBuddyAccountSection.WorkBuddyAccountSection (cyclomatic 30) src/components/settings/auth/WorkBuddyAccountSection.tsx:58— WorkBuddyAccountSection.WorkBuddyAccountSection has cyclomatic complexity 30 (threshold 15). Of this number, 16 points are the body's own statements and 14 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelsDevPickerDialog.ModelsDevPickerDialog (cyclomatic 30) src/components/usage/ModelsDevPickerDialog.tsx:46— ModelsDevPickerDialog.ModelsDevPickerDialog has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 10 of the 30 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 92, a function literal at line 246, a function literal at line 75, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
McpService::upsert_server (cyclomatic 29) src-tauri/src/services/mcp.rs:29— McpService::upsert_server has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
IconPicker.IconPicker (cyclomatic 29) src/components/IconPicker.tsx:60— IconPicker.IconPicker has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 7 function items inside it that branch (handleFileChange, handleNameConfirm, handleDeleteConfirm, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.getInitialLanguage (cyclomatic 29) src/i18n/index.ts:27— index.getInitialLanguage has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
textNormalization.scanTomlQuotes (cyclomatic 29) src/utils/textNormalization.ts:41— textNormalization.scanTomlQuotes has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 2 function items inside it that branch (scan, scan::isCloser). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useBaseUrlState.useBaseUrlState (cyclomatic 27) src/components/providers/forms/hooks/useBaseUrlState.ts:38— useBaseUrlState.useBaseUrlState has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 69, 100, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
HermesFormFields.HermesFormFields (cyclomatic 27) src/components/providers/forms/HermesFormFields.tsx:85— HermesFormFields.HermesFormFields has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 10 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 210, 332, 498, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Sidebar.NavItem (cyclomatic 27) src/components/shell/Sidebar.tsx:531— Sidebar.NavItem has cyclomatic complexity 27 (threshold 15). Of this number, 20 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useSettings.useSettings.saveSettings (cyclomatic 27) src/hooks/useSettings.ts:347— useSettings.useSettings.saveSettings has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TokenUsage::from_claude_stream_events (cyclomatic 26) src-tauri/src/proxy/usage/parser.rs:160— TokenUsage::from_claude_stream_events has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FetchedModelPicker.FetchedModelPickerBody (cyclomatic 26) src/components/providers/forms/FetchedModelPicker.tsx:130— FetchedModelPicker.FetchedModelPickerBody has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 174, matches, renderRow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
QuotaLines.QuotaLines (cyclomatic 26) src/components/quota/QuotaLines.tsx:211— QuotaLines.QuotaLines has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RequestDetailPanel.useDetailSections (cyclomatic 26) src/components/usage/RequestDetailPanel.tsx:86— RequestDetailPanel.useDetailSections has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProxyError::into_response (cyclomatic 25) src-tauri/src/proxy/error.rs:91— ProxyError::into_response has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SecretDetector::detect_with_active (cyclomatic 25) src-tauri/src/proxy/privacy_filter/secrets.rs:522— SecretDetector::detect_with_active has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PiNativePromptResources.PiPromptTemplateEditor (cyclomatic 25) src/components/prompts/PiNativePromptResources.tsx:515— PiNativePromptResources.PiPromptTemplateEditor has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deeplinkRisk.classifyEndpoint (cyclomatic 25) REDACTED:149— deeplinkRisk.classifyEndpoint has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
routingReason.getRoutingReason (cyclomatic 25) src/utils/routingReason.ts:16— routingReason.getRoutingReason has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
tomlUtils.normalizeServerConfig (cyclomatic 25) src/utils/tomlUtils.ts:101— tomlUtils.normalizeServerConfig has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProfileService::apply (cyclomatic 24) src-tauri/src/services/profile.rs:343— ProfileService::apply has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
McpConfirmation.McpConfirmation (cyclomatic 24) src/components/deeplink/McpConfirmation.tsx:14— McpConfirmation.McpConfirmation has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 37, a function literal at line 21, Row, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
KimiAccountLogin.KimiAccountLogin (cyclomatic 24) src/components/providers/KimiAccountLogin.tsx:24— KimiAccountLogin.KimiAccountLogin has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProviderPresetSelector.PresetPicker (cyclomatic 24) src/components/providers/forms/ProviderPresetSelector.tsx:548— ProviderPresetSelector.PresetPicker has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useCodexConfigState.mapCodexCatalogModelForForm (cyclomatic 24) src/components/providers/forms/hooks/useCodexConfigState.ts:41— useCodexConfigState.mapCodexCatalogModelForForm has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenClawFormFields.OpenClawFormFields (cyclomatic 24) src/components/providers/forms/OpenClawFormFields.tsx:59— OpenClawFormFields.OpenClawFormFields has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 196, a function literal at line 355, a function literal at line 83, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WorkBuddyOfficialSection.WorkBuddyOfficialSection (cyclomatic 24) src/components/providers/forms/WorkBuddyOfficialSection.tsx:38— WorkBuddyOfficialSection.WorkBuddyOfficialSection has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SessionMarkdown.collectVisibleTextPieces (cyclomatic 24) src/components/sessions/reader/SessionMarkdown.tsx:366— SessionMarkdown.collectVisibleTextPieces has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionStepDetails.SessionStepDetails (cyclomatic 24) src/components/sessions/reader/SessionStepDetails.tsx:350— SessionStepDetails.SessionStepDetails has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ManagedAccountsGroup.AccountRow (cyclomatic 24) src/components/settings/auth/ManagedAccountsGroup.tsx:589— ManagedAccountsGroup.AccountRow has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
frontendLogger.normalizeForSerialization (cyclomatic 24) src/lib/frontendLogger.ts:106— frontendLogger.normalizeForSerialization has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderType::from_app_type_and_config (cyclomatic 23) src-tauri/src/proxy/providers/mod.rs:143— ProviderType::from_app_type_and_config has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderIcon.ProviderIcon (cyclomatic 23) REDACTED:44— ProviderIcon.ProviderIcon has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 94, 54, 66, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillsStorageSheet.SkillsStorageSheet (cyclomatic 23) src/components/skills/SkillsStorageSheet.tsx:52— SkillsStorageSheet.SkillsStorageSheet has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 6 function items inside it that branch (doMigrate, handleMove, handleOpenFolder, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UsageTrendChart.UsageTrendChart (cyclomatic 23) src/components/usage/UsageTrendChart.tsx:280— UsageTrendChart.UsageTrendChart has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageHeatmap.UsageHeatmap (cyclomatic 23) src/components/usage/UsageHeatmap.tsx:247— UsageHeatmap.UsageHeatmap has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useDirectorySettings.useDirectorySettings (cyclomatic 23) src/hooks/useDirectorySettings.ts:140— useDirectorySettings.useDirectorySettings has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 193, 300, 330, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useProviderActions.useProviderActions.switchProvider (cyclomatic 23) src/hooks/useProviderActions.ts:172— useProviderActions.useProviderActions.switchProvider has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StreamedTextState::missing_suffix (cyclomatic 22) src-tauri/src/proxy/providers/streaming_responses.rs:567— StreamedTextState::missing_suffix has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FullScreenPanel.FullScreenPanel (cyclomatic 22) src/components/common/FullScreenPanel.tsx:73— FullScreenPanel.FullScreenPanel has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AppMatrix.MatrixColumnHeader (cyclomatic 22) src/components/mcp/AppMatrix.tsx:212— AppMatrix.MatrixColumnHeader has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ClaudeOfficialSection.ClaudeOfficialSection (cyclomatic 22) src/components/providers/forms/ClaudeOfficialSection.tsx:159— ClaudeOfficialSection.ClaudeOfficialSection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 191, confirmRemove). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SessionOutline.SessionOutline (cyclomatic 22) src/components/sessions/reader/SessionOutline.tsx:46— SessionOutline.SessionOutline has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 108, 78, 61, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionReaderHeader.SessionReaderHeader (cyclomatic 22) src/components/sessions/reader/SessionReaderHeader.tsx:89— SessionReaderHeader.SessionReaderHeader has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionReaderHeader.SessionReaderToolbar (cyclomatic 22) src/components/sessions/reader/SessionReaderHeader.tsx:546— SessionReaderHeader.SessionReaderToolbar has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
providerConfigUtils.setCodexBaseUrl (cyclomatic 22) REDACTED:1300— providerConfigUtils.setCodexBaseUrl has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionFinalReply.SessionFinalReply (cyclomatic 21) src/components/sessions/reader/SessionFinalReply.tsx:67— SessionFinalReply.SessionFinalReply has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Sidebar.MainDirectory (cyclomatic 21) src/components/shell/Sidebar.tsx:210— Sidebar.MainDirectory has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 3 function items inside it that branch (todayValue, isGlobalSelected, a function literal at line 312). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UsageTab.UsageTab (cyclomatic 21) src/tray-panel/UsageTab.tsx:195— UsageTab.UsageTab has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providerConfigUtils.extractProviderBaseUrl (cyclomatic 21) REDACTED:1166— providerConfigUtils.extractProviderBaseUrl has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
JsonPatch::apply_to (cyclomatic 20) src-tauri/src/live/patch/json.rs:47— JsonPatch::apply_to has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ToolUninstallConfirmDialog.ToolUninstallConfirmDialog (cyclomatic 20) src/components/apps/ToolUninstallConfirmDialog.tsx:28— ToolUninstallConfirmDialog.ToolUninstallConfirmDialog has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ManualUninstallDialog.ManualUninstallDialog (cyclomatic 20) src/components/apps/ManualUninstallDialog.tsx:36— ManualUninstallDialog.ManualUninstallDialog has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 167, environmentForTool, environmentLabelForTool, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PiNativePromptResources.PiPromptTemplates (cyclomatic 20) src/components/prompts/PiNativePromptResources.tsx:771— PiNativePromptResources.PiPromptTemplates has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 902, 834, 818, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProviderEmptyState.ProviderEmptyState (cyclomatic 20) src/components/providers/ProviderEmptyState.tsx:17— ProviderEmptyState.ProviderEmptyState has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UnifiedSkillsPanel.InstalledRow (cyclomatic 20) src/components/skills/UnifiedSkillsPanel.tsx:1805— UnifiedSkillsPanel.InstalledRow has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useDragSort.useDragSort.sortedProviders (cyclomatic 20) src/hooks/useDragSort.ts:21— useDragSort.useDragSort.sortedProviders has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CodexChatHistoryStore::enrich_request (cyclomatic 19) src-tauri/src/proxy/providers/codex_chat_history.rs:107— CodexChatHistoryStore::enrich_request has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageScriptModal.isOfficialSubscriptionProvider (cyclomatic 19) src/components/UsageScriptModal.tsx:207— UsageScriptModal.isOfficialSubscriptionProvider has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PiNativePromptResources.PiSystemPromptFiles (cyclomatic 19) src/components/prompts/PiNativePromptResources.tsx:336— PiNativePromptResources.PiSystemPromptFiles has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 402, 360). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProviderCard.isOfficialProvider (cyclomatic 19) src/components/providers/ProviderCard.tsx:145— ProviderCard.isOfficialProvider has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useGeminiConfigState.useGeminiConfigState (cyclomatic 19) src/components/providers/forms/hooks/useGeminiConfigState.ts:14— useGeminiConfigState.useGeminiConfigState has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 106, 79). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useOmoModelSource.useOmoModelSource (cyclomatic 19) src/components/providers/forms/hooks/useOmoModelSource.ts:47— useOmoModelSource.useOmoModelSource has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 264, 302, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
StackSubagentFields.StackSubagentFields (cyclomatic 19) src/components/providers/mode/StackSubagentFields.tsx:69— StackSubagentFields.StackSubagentFields has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
QuotaLines.SplitQuotaColumn (cyclomatic 19) src/components/quota/QuotaLines.tsx:478— QuotaLines.SplitQuotaColumn has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 537, 505, 518). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AuthCenterPanel.AuthCenterPanel (cyclomatic 19) src/components/settings/AuthCenterPanel.tsx:81— AuthCenterPanel.AuthCenterPanel has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 97, 141, 173). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BackupStorageSection.BackupStorageSection (cyclomatic 19) src/components/settings/BackupStorageSection.tsx:33— BackupStorageSection.BackupStorageSection has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (handleDelete, a function literal at line 108, handleReveal, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
GlobalProxySettings.GlobalProxySettings (cyclomatic 19) src/components/settings/GlobalProxySettings.tsx:73— GlobalProxySettings.GlobalProxySettings has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Sidebar.AppNavItem (cyclomatic 19) src/components/shell/Sidebar.tsx:410— Sidebar.AppNavItem has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillImportDialog.SkillImportDialog (cyclomatic 19) src/components/skills/SkillImportDialog.tsx:32— SkillImportDialog.SkillImportDialog has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 48, foundLabel, a function literal at line 89, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
format.formatTokensShort (cyclomatic 19) src/components/usage/format.ts:509— format.formatTokensShort has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelsDevAutoSyncPanel.ModelsDevAutoSyncPanel (cyclomatic 19) src/components/usage/ModelsDevAutoSyncPanel.tsx:447— ModelsDevAutoSyncPanel.ModelsDevAutoSyncPanel has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
windowActivity.initializeWindowActivity (cyclomatic 19) src/lib/windowActivity.ts:46— windowActivity.initializeWindowActivity has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 67, 111, 54, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RequestIndex::observe (cyclomatic 18) src-tauri/src/kimi_session.rs:65— RequestIndex::observe has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DotenvPatch::apply (cyclomatic 18) src-tauri/src/live/patch/dotenv.rs:29— DotenvPatch::apply has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Provider::resolve_usage_credentials (cyclomatic 18) src-tauri/src/provider.rs:150— Provider::resolve_usage_credentials has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SubscriptionQuotaFooter.SubscriptionQuotaView (cyclomatic 18) src/components/SubscriptionQuotaFooter.tsx:231— SubscriptionQuotaFooter.SubscriptionQuotaView has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageFooter.UsageFooter (cyclomatic 18) src/components/UsageFooter.tsx:97— UsageFooter.UsageFooter has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PromptCopyDialog.PromptCopyDialog (cyclomatic 18) src/components/prompts/PromptCopyDialog.tsx:30— PromptCopyDialog.PromptCopyDialog has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 98, 55, 76, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ManagedAccountRemoveDialog.ManagedAccountRemoveDialog (cyclomatic 18) src/components/providers/forms/ManagedAccountRemoveDialog.tsx:38— ManagedAccountRemoveDialog.ManagedAccountRemoveDialog has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useModelState.parseModelsFromConfig (cyclomatic 18) src/components/providers/forms/hooks/useModelState.ts:47— useModelState.parseModelsFromConfig has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GeminiFormFields.GeminiFormFields (cyclomatic 18) src/components/providers/forms/GeminiFormFields.tsx:54— GeminiFormFields.GeminiFormFields has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CopilotProviderForm.fromNativeText (cyclomatic 18) src/components/providers/forms/CopilotProviderForm.tsx:230— CopilotProviderForm.fromNativeText has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PricingConfigPanel.PricingConfigPanel (cyclomatic 18) src/components/usage/PricingConfigPanel.tsx:348— PricingConfigPanel.PricingConfigPanel has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageHero.UsageHero (cyclomatic 18) src/components/usage/UsageHero.tsx:207— UsageHero.UsageHero has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
usePromptActions.usePromptActions.toggleEnabled (cyclomatic 18) src/hooks/usePromptActions.ts:190— usePromptActions.usePromptActions.toggleEnabled has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useSettings.useSettings.autoSaveSettings (cyclomatic 18) src/hooks/useSettings.ts:206— useSettings.useSettings.autoSaveSettings has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providerCapabilities.providerNeedsRouting (cyclomatic 18) src/utils/providerCapabilities.ts:178— providerCapabilities.providerNeedsRouting has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
providerConfigUtils.getTomlMultilineStringLines (cyclomatic 18) REDACTED:340— providerConfigUtils.getTomlMultilineStringLines has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 342). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ClaudeOfficialSection.ClaudeAccountSelect (cyclomatic 17) src/components/providers/forms/ClaudeOfficialSection.tsx:356— ClaudeOfficialSection.ClaudeAccountSelect has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProviderForm.normalizeCodexCatalogModelsForSave (cyclomatic 17) src/components/providers/forms/ProviderForm.tsx:184— ProviderForm.normalizeCodexCatalogModelsForSave has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
toolSummary.formatStepTitle (cyclomatic 17) src/components/sessions/reader/toolSummary.ts:231— toolSummary.formatStepTitle has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionEventRow.describeEvent (cyclomatic 17) src/components/sessions/reader/SessionEventRow.tsx:34— SessionEventRow.describeEvent has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
theme-provider.ThemeProvider (cyclomatic 17) src/components/theme-provider.tsx:51— theme-provider.ThemeProvider has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 8 function items inside it that branch (getInitialTheme, a function literal at line 79, a function literal at line 92, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TablePagination.TablePagination (cyclomatic 17) src/components/usage/TablePagination.tsx:35— TablePagination.TablePagination has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
modelsDevPricing.flattenModels (cyclomatic 17) src/lib/modelsDevPricing.ts:64— modelsDevPricing.flattenModels has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providerConfigUtils.extractCodexExperimentalBearerToken (cyclomatic 17) REDACTED:1022— providerConfigUtils.extractCodexExperimentalBearerToken has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MultiAppConfig::migrate_mcp_to_unified (cyclomatic 16) src-tauri/src/app_config.rs:1055— MultiAppConfig::migrate_mcp_to_unified has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: AppType::from_str (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
TomlPatch::apply_to (cyclomatic 16) src-tauri/src/live/patch/toml.rs:33— TomlPatch::apply_to has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DeepLinkImportDialog.DeepLinkImportDialog::handleImport (cyclomatic 16) src/components/DeepLinkImportDialog.tsx:245— DeepLinkImportDialog.DeepLinkImportDialog::handleImport has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (DeepLinkImportDialog.DeepLinkImportDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
WhatsNewDialog.WhatsNewNotice (cyclomatic 16) src/components/WhatsNewDialog.tsx:160— WhatsNewDialog.WhatsNewNotice has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AppCountBar.AppCountBar (cyclomatic 16) src/components/common/AppCountBar.tsx:19— AppCountBar.AppCountBar has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 43). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
HermesMemoryPanel.MemoryTabPane (cyclomatic 16) src/components/hermes/HermesMemoryPanel.tsx:111— HermesMemoryPanel.MemoryTabPane has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useOpencodeFormState.useOpencodeFormState (cyclomatic 16) src/components/providers/forms/hooks/useOpencodeFormState.ts:40— useOpencodeFormState.useOpencodeFormState has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 77, 53, 63, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GrokBuildProviderForm.GrokBuildProviderForm::handleSubmit (cyclomatic 16) src/components/providers/forms/GrokBuildProviderForm.tsx:328— GrokBuildProviderForm.GrokBuildProviderForm::handleSubmit has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PiProviderForm.fillPiModelDraft (cyclomatic 16) REDACTED:361— PiProviderForm.fillPiModelDraft has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
utils.highlightTextRanges (cyclomatic 16) src/components/sessions/utils.ts:343— utils.highlightTextRanges has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 350, 361). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionDiff.SessionDiff (cyclomatic 16) src/components/sessions/reader/SessionDiff.tsx:195— SessionDiff.SessionDiff has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 217, 203). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RepoManagerPanel.RepoManagerPanel (cyclomatic 16) src/components/skills/RepoManagerPanel.tsx:81— RepoManagerPanel.RepoManagerPanel has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 219, handleAdd, handleOpenRepo, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
format.getLocaleFromLanguage (cyclomatic 16) src/components/usage/format.ts:457— format.getLocaleFromLanguage has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PricingEditModal.PricingEditModal (cyclomatic 16) src/components/usage/PricingEditModal.tsx:23— PricingEditModal.PricingEditModal has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
copilotConfig.legacyByokConfig (cyclomatic 16) src/config/copilotConfig.ts:171— copilotConfig.legacyByokConfig has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
kimiProviderPresets.toKimiModel (cyclomatic 16) src/config/kimiProviderPresets.ts:103— kimiProviderPresets.toKimiModel has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useProxyStatus.useProxyStatus (cyclomatic 16) src/hooks/useProxyStatus.ts:20— useProxyStatus.useProxyStatus has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 128, 168, 46, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model-fetch.showFetchModelsError (cyclomatic 16) src/lib/api/model-fetch.ts:133— model-fetch.showFetchModelsError has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
version.comparePre (cyclomatic 16) src/lib/version.ts:60— version.comparePre has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TrayPanel.QuotaBlock (cyclomatic 16) src/tray-panel/TrayPanel.tsx:163— TrayPanel.QuotaBlock has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providerCapabilities.resolveCodexOfficialIdentity (cyclomatic 16) src/utils/providerCapabilities.ts:47— providerCapabilities.resolveCodexOfficialIdentity has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
providerConfigUtils.getApiKeyFromConfig (cyclomatic 16) REDACTED:32— providerConfigUtils.getApiKeyFromConfig has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providerConfigUtils.setApiKeyInConfig (cyclomatic 16) REDACTED:171— providerConfigUtils.setApiKeyInConfig has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TodoComment src-tauri/src/session_manager/providers/blocks.rs:327— /// todo:条目数。 — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
ProviderCard.ProviderCard (cognitive 249) src/components/providers/ProviderCard.tsx:220— ProviderCard.ProviderCard has cognitive complexity 249 (threshold 15). Drivers by points: ternaries 54 (197 pts), boolean chains 48, if/else 4 (nesting depth added 143). Of this number, 241 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CodexFormFields.CodexFormFields (cognitive 186) src/components/providers/forms/CodexFormFields.tsx:637— CodexFormFields.CodexFormFields has cognitive complexity 186 (threshold 15). Drivers by points: boolean chains 87, if/else 45 (56 pts), ternaries 30 (37 pts), loops 6 (nesting depth added 18). Of this number, 85 points are the body's own statements and 101 belong to 36 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
UnifiedMcpPanel.UnifiedMcpPanel (cognitive 180) src/components/mcp/UnifiedMcpPanel.tsx:148— UnifiedMcpPanel.UnifiedMcpPanel has cognitive complexity 180 (threshold 15). Drivers by points: ternaries 23 (69 pts), if/else 37 (47 pts), boolean chains 38, loops 11 (16 pts), error handling 8 (10 pts) (nesting depth added 63). Of this number, 31 points are the body's own statements and 149 belong to 27 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderForm.ProviderFormFull (cognitive 175) src/components/providers/forms/ProviderForm.tsx:379— ProviderForm.ProviderFormFull has cognitive complexity 175 (threshold 15). Drivers by points: ternaries 95 (207 pts), if/else 135 (202 pts), boolean chains 198, error handling 8 (11 pts) (nesting depth added 182). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (ProviderForm.ProviderFormFull::handleSubmit, ProviderForm.ProviderFormFull::performSubmit, ProviderForm.ProviderFormFull::handlePresetChange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AddProviderDialog.AddProviderDialog (cognitive 155) src/components/providers/AddProviderDialog.tsx:58— AddProviderDialog.AddProviderDialog has cognitive complexity 155 (threshold 15). Drivers by points: if/else 46 (99 pts), boolean chains 34, ternaries 18 (20 pts), error handling 2 (nesting depth added 55). Of this number, 23 points are the body's own statements and 132 belong to 13 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
presentation.buildAdditiveSections (cognitive 133) src/components/providers/presentation.ts:800— presentation.buildAdditiveSections has cognitive complexity 133 (threshold 15). Drivers by points: ternaries 23 (67 pts), if/else 23 (54 pts), boolean chains 11, loops 1 (nesting depth added 75). Of this number, 125 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WebdavSyncSection.WebdavSyncSection (cognitive 118) src/components/settings/WebdavSyncSection.tsx:236— WebdavSyncSection.WebdavSyncSection has cognitive complexity 118 (threshold 15). Drivers by points: if/else 50 (51 pts), boolean chains 45, error handling 16, ternaries 6 (nesting depth added 1). Of this number, 37 points are the body's own statements and 81 belong to 34 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TrayPanel.TrayPanel (cognitive 118) src/tray-panel/TrayPanel.tsx:523— TrayPanel.TrayPanel has cognitive complexity 118 (threshold 15). Drivers by points: if/else 47 (53 pts), ternaries 22 (33 pts), boolean chains 30, error handling 2 (nesting depth added 17). Most of this is not in the body itself: 12 of the 118 points are its own statements and the rest belongs to 23 function items inside it that branch (a function literal at line 686, a function literal at line 910, a function literal at line 607, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
deplink.html.generateLink (cognitive 116) deplink.html:1468— deplink.html.generateLink has cognitive complexity 116 (threshold 15). Drivers by points: if/else 48 (91 pts), error handling 6 (17 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillsPage.SkillsPage (cognitive 112) src/components/skills/SkillsPage.tsx:167— SkillsPage.SkillsPage has cognitive complexity 112 (threshold 15). Drivers by points: ternaries 24 (61 pts), boolean chains 26, if/else 19 (22 pts), loops 2, error handling 1 (nesting depth added 40). Of this number, 27 points are the body's own statements and 85 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderList.ProviderList (cognitive 107) src/components/providers/ProviderList.tsx:111— ProviderList.ProviderList has cognitive complexity 107 (threshold 15). Drivers by points: boolean chains 43, ternaries 24 (33 pts), if/else 27 (30 pts), match/switch 1 (nesting depth added 12). Of this number, 52 points are the body's own statements and 55 belong to 17 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
useOmoModelSource.useOmoModelSource.omoModelBuild (cognitive 104) src/components/providers/forms/hooks/useOmoModelSource.ts:117— useOmoModelSource.useOmoModelSource.omoModelBuild has cognitive complexity 104 (threshold 15). Drivers by points: if/else 17 (69 pts), boolean chains 12, loops 4 (10 pts), ternaries 3 (10 pts), error handling 1 (3 pts) (nesting depth added 67). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TokenUsage::from_claude_stream_events (cognitive 102) src-tauri/src/proxy/usage/parser.rs:160— TokenUsage::from_claude_stream_events has cognitive complexity 102 (threshold 15). Drivers by points: if/else 20 (95 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PiPromptPanel.PiPromptPanel (cognitive 102) src/components/prompts/PiPromptPanel.tsx:54— PiPromptPanel.PiPromptPanel has cognitive complexity 102 (threshold 15). Drivers by points: ternaries 28 (45 pts), if/else 21 (33 pts), boolean chains 17, error handling 3 (4 pts), loops 2 (3 pts) (nesting depth added 31). Of this number, 48 points are the body's own statements and 54 belong to 19 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClaudeFormFields.ClaudeFormFields (cognitive 96) src/components/providers/forms/ClaudeFormFields.tsx:196— ClaudeFormFields.ClaudeFormFields has cognitive complexity 96 (threshold 15). Drivers by points: boolean chains 41, ternaries 14 (29 pts), if/else 26 (nesting depth added 15). Of this number, 63 points are the body's own statements and 33 belong to 22 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deplink.html.parseDeepLink (cognitive 94) deplink.html:1973— deplink.html.parseDeepLink has cognitive complexity 94 (threshold 15). Drivers by points: if/else 40 (57 pts), boolean chains 15, ternaries 5 (9 pts), error handling 4 (8 pts), loops 2 (5 pts) (nesting depth added 28). Of this number, 67 points are the body's own statements and 27 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PromptPanel.StandardPromptPanel (cognitive 93) src/components/prompts/PromptPanel.tsx:37— PromptPanel.StandardPromptPanel has cognitive complexity 93 (threshold 15). Drivers by points: if/else 38 (40 pts), ternaries 16 (23 pts), boolean chains 21, error handling 5 (6 pts), loops 2 (3 pts) (nesting depth added 11). Of this number, 25 points are the body's own statements and 68 belong to 24 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SessionReader.SessionReader (cognitive 93) src/components/sessions/reader/SessionReader.tsx:161— SessionReader.SessionReader has cognitive complexity 93 (threshold 15). Drivers by points: boolean chains 35, ternaries 21 (28 pts), if/else 22 (24 pts), error handling 4, loops 1, match/switch 1 (nesting depth added 9). Of this number, 37 points are the body's own statements and 56 belong to 25 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CopilotProviderForm.CopilotProviderForm (cognitive 90) src/components/providers/forms/CopilotProviderForm.tsx:283— CopilotProviderForm.CopilotProviderForm has cognitive complexity 90 (threshold 15). Drivers by points: boolean chains 37, ternaries 29 (35 pts), if/else 16 (17 pts), loops 1 (nesting depth added 7). Of this number, 36 points are the body's own statements and 54 belong to 22 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KimiProviderForm.KimiProviderForm (cognitive 87) src/components/providers/forms/KimiProviderForm.tsx:111— KimiProviderForm.KimiProviderForm has cognitive complexity 87 (threshold 15). Drivers by points: boolean chains 35, ternaries 18 (24 pts), if/else 18 (23 pts), loops 4, error handling 1 (nesting depth added 11). Of this number, 36 points are the body's own statements and 51 belong to 23 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WorkBuddyProviderForm.WorkBuddyProviderForm (cognitive 82) src/components/providers/forms/WorkBuddyProviderForm.tsx:129— WorkBuddyProviderForm.WorkBuddyProviderForm has cognitive complexity 82 (threshold 15). Drivers by points: ternaries 22 (36 pts), boolean chains 31, if/else 13, error handling 1, loops 1 (nesting depth added 14). Of this number, 37 points are the body's own statements and 45 belong to 21 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
turns.buildTurn (cognitive 80) src/components/sessions/reader/turns.ts:298— turns.buildTurn has cognitive complexity 80 (threshold 15). Drivers by points: if/else 24 (58 pts), ternaries 3 (9 pts), boolean chains 8, loops 3, match/switch 1 (2 pts) (nesting depth added 41). Most of this is not in the body itself: 13 of the 80 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 368, a function literal at line 344, blocksOf, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
EditProviderDialog.EditProviderDialog (cognitive 76) src/components/providers/EditProviderDialog.tsx:67— EditProviderDialog.EditProviderDialog has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (39 pts), boolean chains 17, ternaries 12 (14 pts), error handling 3 (6 pts) (nesting depth added 19). Most of this is not in the body itself: 15 of the 76 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 139, 292, 103, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
presentation.buildSwitchSectionsByView (cognitive 74) src/components/providers/presentation.ts:196— presentation.buildSwitchSectionsByView has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 19 (35 pts), if/else 17 (34 pts), boolean chains 5 (nesting depth added 33). Of this number, 20 points are the body's own statements and 54 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenCodeFormFields.OpenCodeFormFields (cognitive 70) src/components/providers/forms/OpenCodeFormFields.tsx:312— OpenCodeFormFields.OpenCodeFormFields has cognitive complexity 70 (threshold 15). Drivers by points: if/else 30 (35 pts), boolean chains 20, loops 7 (8 pts), ternaries 5, error handling 2 (nesting depth added 6). Most of this is not in the body itself: 3 of the 70 points are its own statements and the rest belongs to 20 function items inside it that branch (handleModelExtraFieldKeyChange, handleModelLimitChange, handleExtraOptionKeyChange, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SwitchModePanel.SwitchModePanel (cognitive 70) src/components/providers/mode/SwitchModePanel.tsx:102— SwitchModePanel.SwitchModePanel has cognitive complexity 70 (threshold 15). Drivers by points: boolean chains 27, ternaries 16 (25 pts), if/else 13, error handling 4, loops 1 (nesting depth added 9). Of this number, 46 points are the body's own statements and 24 belong to 14 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
UniversalProviderFormModal.UniversalProviderFormModal (cognitive 67) src/components/universal/UniversalProviderFormModal.tsx:30— UniversalProviderFormModal.UniversalProviderFormModal has cognitive complexity 67 (threshold 15). Drivers by points: boolean chains 48, if/else 12, ternaries 7. Of this number, 24 points are the body's own statements and 43 belong to 11 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
deepLinkConfigPreview.parseDeepLinkConfigPreview (cognitive 62) src/utils/deepLinkConfigPreview.ts:44— deepLinkConfigPreview.parseDeepLinkConfigPreview has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 10 (20 pts), boolean chains 10, loops 1 (3 pts), error handling 1 (nesting depth added 23). Of this number, 60 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
McodeProviderForm.McodeProviderForm (cognitive 61) src/components/providers/forms/McodeProviderForm.tsx:83— McodeProviderForm.McodeProviderForm has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 18 (30 pts), boolean chains 20, if/else 7 (8 pts), error handling 2 (3 pts) (nesting depth added 14). Of this number, 42 points are the body's own statements and 19 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProfileService::apply (cognitive 60) src-tauri/src/services/profile.rs:343— ProfileService::apply has cognitive complexity 60 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 5 (13 pts), match/switch 2 (8 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppsPage.ToolRow (cognitive 59) src/components/apps/AppsPage.tsx:736— AppsPage.ToolRow has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 22 (34 pts), boolean chains 25 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeepLinkImportDialog.DeepLinkImportDialog (cognitive 58) src/components/DeepLinkImportDialog.tsx:86— DeepLinkImportDialog.DeepLinkImportDialog has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 60, if/else 26 (30 pts), ternaries 10 (14 pts), error handling 4 (5 pts), match/switch 2, loops 1 (nesting depth added 9). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (DeepLinkImportDialog.DeepLinkImportDialog::handleImport) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
useToolManagement.useToolManagement.executeRun (cognitive 54) src/components/apps/useToolManagement.ts:739— useToolManagement.useToolManagement.executeRun has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (28 pts), ternaries 7 (13 pts), boolean chains 12, error handling 1 (nesting depth added 15). Of this number, 23 points are the body's own statements and 31 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
McpFormModal.McpFormModal (cognitive 54) src/components/mcp/McpFormModal.tsx:127— McpFormModal.McpFormModal has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 42 (76 pts), boolean chains 30, if/else 27 (30 pts), error handling 2 (3 pts), loops 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (McpFormModal.McpFormModal::submitSingle) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
UsageDashboard.UsageDashboard (cognitive 53) src/components/usage/UsageDashboard.tsx:253— UsageDashboard.UsageDashboard has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 19 (21 pts), boolean chains 17, if/else 11, error handling 3, loops 1 (nesting depth added 2). Of this number, 26 points are the body's own statements and 27 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DailyMemoryPanel.DailyMemoryPanel (cognitive 53) src/components/workspace/DailyMemoryPanel.tsx:43— DailyMemoryPanel.DailyMemoryPanel has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (21 pts), ternaries 7 (14 pts), boolean chains 13, error handling 5 (nesting depth added 9). Of this number, 18 points are the body's own statements and 35 belong to 16 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelsDevAutoSyncPanel.AutoSyncDialog (cognitive 52) src/components/usage/ModelsDevAutoSyncPanel.tsx:70— ModelsDevAutoSyncPanel.AutoSyncDialog has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 10 (15 pts), boolean chains 12, loops 6 (8 pts), error handling 1 (nesting depth added 16). Most of this is not in the body itself: 10 of the 52 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 92, a function literal at line 336, a function literal at line 107, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UsageScriptModal.UsageScriptModal (cognitive 51) src/components/UsageScriptModal.tsx:253— UsageScriptModal.UsageScriptModal has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 98, if/else 60 (71 pts), ternaries 28 (66 pts), error handling 4 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (UsageScriptModal.UsageScriptModal::handleTest, UsageScriptModal.UsageScriptModal::handleUsePreset) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CommonConfigEditor.CommonConfigEditor (cognitive 51) src/components/providers/forms/CommonConfigEditor.tsx:48— CommonConfigEditor.CommonConfigEditor has cognitive complexity 51 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 8, error handling 3, loops 1, match/switch 1 (nesting depth added 18). None of this is in the body itself: all 51 points belong to 5 function literals inside it that branch (lines 120, 87, 194, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RequestLogTable.RequestLogTable::renderRow (cognitive 51) src/components/usage/RequestLogTable.tsx:371— RequestLogTable.RequestLogTable::renderRow has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 23 (34 pts), boolean chains 17 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppsPage.AppsPage (cognitive 50) src/components/apps/AppsPage.tsx:184— AppsPage.AppsPage has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 12 (22 pts), boolean chains 16, if/else 11, loops 1 (nesting depth added 10). Most of this is not in the body itself: 13 of the 50 points are its own statements and the rest belongs to 10 function items inside it that branch (renderRow, rowInstalled, handleDragEnd, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CodexOAuthSection.CodexOAuthSection (cognitive 50) src/components/providers/forms/CodexOAuthSection.tsx:78— CodexOAuthSection.CodexOAuthSection has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 31, ternaries 10 (13 pts), if/else 6 (nesting depth added 3). Of this number, 38 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SessionItem.SessionItem (cognitive 48) src/components/sessions/SessionItem.tsx:85— SessionItem.SessionItem has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 28, ternaries 13 (17 pts), if/else 2 (3 pts) (nesting depth added 5). Of this number, 45 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useManagedAuth.useManagedAuth (cognitive 47) src/components/providers/forms/hooks/useManagedAuth.ts:24— useManagedAuth.useManagedAuth has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (24 pts), ternaries 11 (15 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 9). Most of this is not in the body itself: 4 of the 47 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 182, 145, 329, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionMarkdown.collectVisibleTextPieces (cognitive 46) src/components/sessions/reader/SessionMarkdown.tsx:366— SessionMarkdown.collectVisibleTextPieces has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (29 pts), ternaries 2 (9 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexChatHistoryStore::enrich_request (cognitive 45) src-tauri/src/proxy/providers/codex_chat_history.rs:107— CodexChatHistoryStore::enrich_request has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 2 (6 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AboutSection.AboutSection (cognitive 45) src/components/settings/AboutSection.tsx:48— AboutSection.AboutSection has cognitive complexity 45 (threshold 15). Drivers by points: error handling 7 (12 pts), ternaries 8 (12 pts), if/else 8 (11 pts), boolean chains 10 (nesting depth added 12). Of this number, 16 points are the body's own statements and 29 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModeDialog.EnterBody (cognitive 44) src/components/providers/mode/ModeDialog.tsx:131— ModeDialog.EnterBody has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 15 (29 pts), boolean chains 12, if/else 2, error handling 1 (nesting depth added 14). Of this number, 38 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderType::from_app_type_and_config (cognitive 43) src-tauri/src/proxy/providers/mod.rs:143— ProviderType::from_app_type_and_config has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (39 pts), match/switch 2 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UsageDateRangePicker.UsageDateRangePicker (cognitive 43) src/components/usage/UsageDateRangePicker.tsx:114— UsageDateRangePicker.UsageDateRangePicker has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 15, ternaries 9 (10 pts) (nesting depth added 3). Most of this is not in the body itself: 3 of the 43 points are its own statements and the rest belongs to 13 function items inside it that branch (handleDatePick, renderField, a function literal at line 495, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SecretDetector::detect_with_active (cognitive 42) src-tauri/src/proxy/privacy_filter/secrets.rs:522— SecretDetector::detect_with_active has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PromptFormPanel.PromptFormPanel (cognitive 42) src/components/prompts/PromptFormPanel.tsx:53— PromptFormPanel.PromptFormPanel has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 19 (24 pts), boolean chains 10, if/else 7, error handling 1 (nesting depth added 5). Of this number, 25 points are the body's own statements and 17 belong to 5 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tomlUtils.normalizeServerConfig (cognitive 41) src/utils/tomlUtils.ts:101— tomlUtils.normalizeServerConfig has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 4 (10 pts), boolean chains 9 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentsDefaultsPanel.AgentsDefaultsPanel (cognitive 40) src/components/openclaw/AgentsDefaultsPanel.tsx:28— AgentsDefaultsPanel.AgentsDefaultsPanel has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18, boolean chains 12, ternaries 8 (9 pts), error handling 1 (nesting depth added 1). Most of this is not in the body itself: 9 of the 40 points are its own statements and the rest belongs to 9 function items inside it that branch (handleSave, a function literal at line 45, getFallbackOptions, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RoutingSection.RoutingSection (cognitive 40) src/components/settings/sections/RoutingSection.tsx:93— RoutingSection.RoutingSection has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 16 (17 pts), boolean chains 13, if/else 7, error handling 3 (nesting depth added 1). Of this number, 19 points are the body's own statements and 21 belong to 8 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
XaiOAuthSection.XaiOAuthSection (cognitive 39) src/components/providers/forms/XaiOAuthSection.tsx:55— XaiOAuthSection.XaiOAuthSection has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 12 (22 pts), boolean chains 12, if/else 5 (nesting depth added 10). Of this number, 28 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useDragSort.useDragSort.sortedProviders (cognitive 39) src/hooks/useDragSort.ts:21— useDragSort.useDragSort.sortedProviders has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 7 (28 pts), boolean chains 7, if/else 4 (nesting depth added 21). Of this number, 33 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
providerConfigUtils.setCodexBaseUrl (cognitive 39) REDACTED:1300— providerConfigUtils.setCodexBaseUrl has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 3 (9 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StreamedTextState::missing_suffix (cognitive 38) src-tauri/src/proxy/providers/streaming_responses.rs:567— StreamedTextState::missing_suffix has cognitive complexity 38 (threshold 15). Drivers by points: if/else 25 (35 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AuthCenterPanel.AuthCenterPanel (cognitive 38) src/components/settings/AuthCenterPanel.tsx:81— AuthCenterPanel.AuthCenterPanel has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 7 (28 pts), boolean chains 5, if/else 4, loops 1 (nesting depth added 21). Most of this is not in the body itself: 2 of the 38 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 97, 141, 173). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BackupListSection.BackupListSection (cognitive 38) src/components/settings/BackupListSection.tsx:63— BackupListSection.BackupListSection has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (11 pts), ternaries 7 (10 pts), error handling 4 (nesting depth added 9). Most of this is not in the body itself: 7 of the 38 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 310, handleRestore, handleConfirmRename, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
JsonEditor.JsonEditor (cognitive 37) src/components/JsonEditor.tsx:88— JsonEditor.JsonEditor has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 12 (15 pts), boolean chains 5, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 6 of the 37 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 113, a function literal at line 150, handleFormat, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CopilotAuthSection.CopilotAuthSection (cognitive 37) src/components/providers/forms/CopilotAuthSection.tsx:69— CopilotAuthSection.CopilotAuthSection has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 16, ternaries 10 (13 pts), if/else 8 (nesting depth added 3). Of this number, 24 points are the body's own statements and 13 belong to 8 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PiProviderForm.PiProviderForm::submit (cognitive 37) REDACTED:1358— PiProviderForm.PiProviderForm::submit has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 9, ternaries 4 (6 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PiProviderForm.PiProviderForm) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SessionManagerPage.SessionManagerPage (cognitive 37) src/components/sessions/SessionManagerPage.tsx:152— SessionManagerPage.SessionManagerPage has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 43 (51 pts), boolean chains 50, if/else 40 (43 pts), error handling 7 (9 pts) (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (SessionManagerPage.SessionManagerPage::handleDeleteConfirm) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ModelsDevPickerDialog.ModelsDevPickerDialog (cognitive 37) src/components/usage/ModelsDevPickerDialog.tsx:46— ModelsDevPickerDialog.ModelsDevPickerDialog has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 10 (21 pts), boolean chains 8, if/else 5 (6 pts), error handling 1, loops 1 (nesting depth added 12). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 75, a function literal at line 92, a function literal at line 246, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
RequestIndex::observe (cognitive 36) src-tauri/src/kimi_session.rs:65— RequestIndex::observe has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useProviderCategory.useProviderCategory (cognitive 36) src/components/providers/forms/hooks/useProviderCategory.ts:22— useProviderCategory.useProviderCategory has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 13, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to one function literal inside it that branches (line 33). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
UnifiedSkillsPanel.UnifiedSkillsPanel (cognitive 36) src/components/skills/UnifiedSkillsPanel.tsx:129— UnifiedSkillsPanel.UnifiedSkillsPanel has cognitive complexity 36 (threshold 15). Drivers by points: if/else 78 (89 pts), boolean chains 55, ternaries 36 (49 pts), error handling 16 (18 pts), loops 10 (11 pts) (nesting depth added 27). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (UnifiedSkillsPanel.UnifiedSkillsPanel::uninstallIds) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
RequestDetailPanel.useDetailSections (cognitive 36) src/components/usage/RequestDetailPanel.tsx:86— RequestDetailPanel.useDetailSections has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 7 (13 pts), boolean chains 6 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ManagedAccountsGroup.ManagedAccountsGroup (cognitive 35) src/components/settings/auth/ManagedAccountsGroup.tsx:118— ManagedAccountsGroup.ManagedAccountsGroup has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 24, if/else 6, ternaries 3, error handling 2. Of this number, 22 points are the body's own statements and 13 belong to 8 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkBuddyAccountSection.WorkBuddyAccountSection (cognitive 35) src/components/settings/auth/WorkBuddyAccountSection.tsx:58— WorkBuddyAccountSection.WorkBuddyAccountSection has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (17 pts), if/else 11, boolean chains 7 (nesting depth added 7). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 181, a function literal at line 228, a function literal at line 104, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
QuotaLines.QuotaLines (cognitive 34) src/components/quota/QuotaLines.tsx:211— QuotaLines.QuotaLines has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 12 (23 pts), boolean chains 6, if/else 5 (nesting depth added 11). Of this number, 30 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageDisplaySection.UsageDisplaySection (cognitive 34) src/components/usage/UsageDisplaySection.tsx:59— UsageDisplaySection.UsageDisplaySection has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 11, ternaries 4, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 13 function items inside it that branch (refreshRates, changeRateSource, changeCurrency, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
usePromptActions.usePromptActions.toggleEnabled (cognitive 34) src/hooks/usePromptActions.ts:190— usePromptActions.usePromptActions.toggleEnabled has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 5 (11 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelsDevPricing.flattenModels (cognitive 34) src/lib/modelsDevPricing.ts:64— modelsDevPricing.flattenModels has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 4 (11 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 18). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GrokBuildProviderForm.GrokBuildProviderForm (cognitive 33) src/components/providers/forms/GrokBuildProviderForm.tsx:73— GrokBuildProviderForm.GrokBuildProviderForm has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 13, if/else 13, ternaries 7. Most of this is not in the body itself: 8 of the 33 points are its own statements and the rest belongs to 7 function items inside it that branch (handleSubmit, handlePresetChange, handleRawConfigChange, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SessionDiff.parseDiff (cognitive 33) src/components/sessions/reader/SessionDiff.tsx:26— SessionDiff.parseDiff has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 5 of the 33 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 41, pushFile). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UsageTab.UsageTab (cognitive 33) src/tray-panel/UsageTab.tsx:195— UsageTab.UsageTab has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (25 pts), boolean chains 4, if/else 2 (4 pts) (nesting depth added 14). Of this number, 21 points are the body's own statements and 12 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PiProviderForm.PiProviderForm (cognitive 32) REDACTED:507— PiProviderForm.PiProviderForm has cognitive complexity 32 (threshold 15). Drivers by points: if/else 80 (88 pts), boolean chains 73, ternaries 40 (48 pts), error handling 2 (3 pts), loops 1 (nesting depth added 17). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (PiProviderForm.PiProviderForm::submit) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mutations.useAddProviderMutation (cognitive 32) src/lib/query/mutations.ts:24— mutations.useAddProviderMutation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 6, ternaries 1 (3 pts), error handling 1 (nesting depth added 8). None of this is in the body itself: all 32 points belong to 4 function literals inside it that branch (lines 29, 112, 157, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
JsonPatch::apply_to (cognitive 31) src-tauri/src/live/patch/json.rs:47— JsonPatch::apply_to has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 7 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.App (cognitive 31) src/App.tsx:228— App.App has cognitive complexity 31 (threshold 15). Drivers by points: if/else 89 (101 pts), boolean chains 74, ternaries 43 (62 pts), error handling 19 (24 pts), loops 4, match/switch 2 (nesting depth added 36). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (App.App::handleDuplicateProvider) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
IconPicker.IconPicker (cognitive 31) src/components/IconPicker.tsx:60— IconPicker.IconPicker has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, ternaries 4 (5 pts), error handling 3, match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 7 function items inside it that branch (handleFileChange, handleNameConfirm, handleDeleteConfirm, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
FetchedModelPicker.FetchedModelPickerBody (cognitive 31) src/components/providers/forms/FetchedModelPicker.tsx:130— FetchedModelPicker.FetchedModelPickerBody has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 11, ternaries 2 (3 pts), loops 2 (nesting depth added 7). Most of this is not in the body itself: 6 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 174, a function literal at line 201, matches, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
frontendLogger.normalizeForSerialization (cognitive 31) src/lib/frontendLogger.ts:106— frontendLogger.normalizeForSerialization has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providerConfigUtils.writeCodexAgentsLine (cognitive 31) REDACTED:1561— providerConfigUtils.writeCodexAgentsLine has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 2 (4 pts), error handling 2, loops 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCodexConfigState.mapCodexCatalogModelForForm (cognitive 30) src/components/providers/forms/hooks/useCodexConfigState.ts:41— useCodexConfigState.mapCodexCatalogModelForForm has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 20 (27 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SettingsPage.SettingsPage (cognitive 29) src/components/settings/SettingsPage.tsx:83— SettingsPage.SettingsPage has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 10, if/else 10, error handling 4, ternaries 2 (3 pts), loops 1, match/switch 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 146, renderSection, a function literal at line 276, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useSettings.useSettings.saveSettings (cognitive 29) src/hooks/useSettings.ts:347— useSettings.useSettings.saveSettings has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (14 pts), error handling 5 (7 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
App.App::handleDuplicateProvider (cognitive 28) src/App.tsx:1209— App.App::handleDuplicateProvider has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 2 (5 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (App.App) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
providerConfigUtils.getTomlMultilineStringLines (cognitive 28) REDACTED:340— providerConfigUtils.getTomlMultilineStringLines has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 14). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 342). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
DatabaseUpgrade.DatabaseUpgrade (cognitive 27) src/components/DatabaseUpgrade.tsx:49— DatabaseUpgrade.DatabaseUpgrade has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (6 pts), ternaries 3 (4 pts), error handling 2 (nesting depth added 2). Of this number, 17 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
McpConfirmation.McpConfirmation (cognitive 27) src/components/deeplink/McpConfirmation.tsx:14— McpConfirmation.McpConfirmation has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (11 pts), loops 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 37, a function literal at line 21, Row, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PiNativePromptResources.PiSystemPromptFiles (cognitive 27) src/components/prompts/PiNativePromptResources.tsx:336— PiNativePromptResources.PiSystemPromptFiles has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 14 (23 pts), boolean chains 4 (nesting depth added 9). None of this is in the body itself: all 27 points belong to 2 function literals inside it that branch (lines 402, 360). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PiNativePromptResources.PiPromptTemplateEditor (cognitive 27) src/components/prompts/PiNativePromptResources.tsx:515— PiNativePromptResources.PiPromptTemplateEditor has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 8, if/else 2 (nesting depth added 5). Of this number, 24 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HermesFormFields.HermesFormFields (cognitive 27) src/components/providers/forms/HermesFormFields.tsx:85— HermesFormFields.HermesFormFields has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 9, boolean chains 7, loops 1 (nesting depth added 1). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 210, 332, 498, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Sidebar.NavItem (cognitive 27) src/components/shell/Sidebar.tsx:531— Sidebar.NavItem has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 14 (18 pts), boolean chains 8, if/else 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
UsageTrendChart.UsageTrendChart (cognitive 27) src/components/usage/UsageTrendChart.tsx:280— UsageTrendChart.UsageTrendChart has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 12 (19 pts), if/else 5, boolean chains 3 (nesting depth added 7). Of this number, 15 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KimiAccountLogin.KimiAccountLogin (cognitive 26) src/components/providers/KimiAccountLogin.tsx:24— KimiAccountLogin.KimiAccountLogin has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 14 (17 pts), if/else 5, boolean chains 4 (nesting depth added 3). Of this number, 14 points are the body's own statements and 12 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ProviderPresetSelector.PresetPicker (cognitive 26) src/components/providers/forms/ProviderPresetSelector.tsx:548— ProviderPresetSelector.PresetPicker has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, ternaries 6 (10 pts), if/else 4, loops 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useBaseUrlState.useBaseUrlState (cognitive 26) src/components/providers/forms/hooks/useBaseUrlState.ts:38— useBaseUrlState.useBaseUrlState has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, boolean chains 7, ternaries 5, error handling 2. None of this is in the body itself: all 26 points belong to 6 function literals inside it that branch (lines 69, 100, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ClaudeDesktopProviderForm.ClaudeDesktopProviderForm (cognitive 26) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:254— ClaudeDesktopProviderForm.ClaudeDesktopProviderForm has cognitive complexity 26 (threshold 15). Drivers by points: if/else 40 (57 pts), boolean chains 51, ternaries 25 (33 pts), error handling 2, loops 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleFetchManagedModels, ClaudeDesktopProviderForm.ClaudeDesktopProviderForm::handleSubmit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ClaudeOfficialSection.ClaudeOfficialSection (cognitive 26) src/components/providers/forms/ClaudeOfficialSection.tsx:159— ClaudeOfficialSection.ClaudeOfficialSection has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 7 (9 pts), boolean chains 4 (nesting depth added 5). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 191, confirmRemove). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SessionStepDetails.BlockText (cognitive 26) src/components/sessions/reader/SessionStepDetails.tsx:73— SessionStepDetails.BlockText has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 17, ternaries 5, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useDirectorySettings.useDirectorySettings (cognitive 26) src/hooks/useDirectorySettings.ts:140— useDirectorySettings.useDirectorySettings has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (9 pts), loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). None of this is in the body itself: all 26 points belong to 4 function literals inside it that branch (lines 193, 300, 330, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
DotenvPatch::apply (cognitive 25) src-tauri/src/live/patch/dotenv.rs:29— DotenvPatch::apply has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5, loops 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OmoFormFields.mergeCustomModelsIntoStore (cognitive 25) src/components/providers/forms/OmoFormFields.tsx:265— OmoFormFields.mergeCustomModelsIntoStore has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, ternaries 1 (3 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderForm.normalizeCodexCatalogModelsForSave (cognitive 25) src/components/providers/forms/ProviderForm.tsx:184— ProviderForm.normalizeCodexCatalogModelsForSave has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 6, if/else 1 (2 pts), loops 1 (nesting depth added 9). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionMarkdown.renderNode (cognitive 25) src/components/sessions/reader/SessionMarkdown.tsx:932— SessionMarkdown.renderNode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 5 (10 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sidebar.AppNavItem (cognitive 25) src/components/shell/Sidebar.tsx:410— Sidebar.AppNavItem has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (20 pts), boolean chains 4, if/else 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
windowActivity.initializeWindowActivity (cognitive 25) src/lib/windowActivity.ts:46— windowActivity.initializeWindowActivity has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, error handling 3 (5 pts), ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 67, 111, 102, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
routingReason.getRoutingReason (cognitive 25) src/utils/routingReason.ts:16— routingReason.getRoutingReason has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, if/else 10 (11 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TomlPatch::apply_to (cognitive 24) src-tauri/src/live/patch/toml.rs:33— TomlPatch::apply_to has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 6 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillImportDialog.SkillImportDialog (cognitive 24) src/components/skills/SkillImportDialog.tsx:32— SkillImportDialog.SkillImportDialog has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 4). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 48, a function literal at line 89, foundLabel, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useSettings.useSettings.autoSaveSettings (cognitive 24) src/hooks/useSettings.ts:206— useSettings.useSettings.autoSaveSettings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 5 (7 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.getInitialLanguage (cognitive 24) src/i18n/index.ts:27— index.getInitialLanguage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 8, error handling 1 (2 pts), ternaries 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GrokConfigPatch::apply_to (cognitive 23) src-tauri/src/live/project/grok.rs:229— GrokConfigPatch::apply_to has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicToResponsesState::close_block (cognitive 23) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:338— AnthropicToResponsesState::close_block has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgyAccountManager::read_live (cognitive 23) src-tauri/src/services/agy_account/mod.rs:514— AgyAccountManager::read_live has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OutputInfo::from_contents (cognitive 23) src-tauri/src/session_manager/providers/codex.rs:539— OutputInfo::from_contents has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SubscriptionQuotaFooter.SubscriptionQuotaView (cognitive 23) src/components/SubscriptionQuotaFooter.tsx:231— SubscriptionQuotaFooter.SubscriptionQuotaView has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (8 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useGeminiConfigState.useGeminiConfigState (cognitive 23) src/components/providers/forms/hooks/useGeminiConfigState.ts:14— useGeminiConfigState.useGeminiConfigState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 23 points belong to 2 function literals inside it that branch (lines 106, 79). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PricingConfigPanel.PricingConfigPanel (cognitive 23) src/components/usage/PricingConfigPanel.tsx:348— PricingConfigPanel.PricingConfigPanel has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 6, if/else 6 (nesting depth added 6). Of this number, 14 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useProviderActions.useProviderActions.switchProvider (cognitive 23) src/hooks/useProviderActions.ts:172— useProviderActions.useProviderActions.switchProvider has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 3 (4 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
version.comparePre (cognitive 23) src/lib/version.ts:60— version.comparePre has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ItemIds::rewrite_event (cognitive 22) src-tauri/src/proxy/providers/copilot_responses.rs:32— ItemIds::rewrite_event has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PromptService::enable_prompt (cognitive 22) src-tauri/src/services/prompt.rs:146— PromptService::enable_prompt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderIcon.ProviderIcon (cognitive 22) REDACTED:44— ProviderIcon.ProviderIcon has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 3). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 94, 54, 66, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ManualUninstallDialog.ManualUninstallDialog (cognitive 22) src/components/apps/ManualUninstallDialog.tsx:36— ManualUninstallDialog.ManualUninstallDialog has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 6, if/else 3, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 4 function items inside it that branch (environmentLabelForTool, environmentForTool, a function literal at line 167, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
AppMatrix.MatrixColumnHeader (cognitive 22) src/components/mcp/AppMatrix.tsx:212— AppMatrix.MatrixColumnHeader has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, ternaries 8 (9 pts), if/else 2 (nesting depth added 1). Of this number, 19 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OpenClawFormFields.OpenClawFormFields (cognitive 22) src/components/providers/forms/OpenClawFormFields.tsx:59— OpenClawFormFields.OpenClawFormFields has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9, ternaries 6 (7 pts), boolean chains 5, loops 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 196, a function literal at line 355, a function literal at line 83, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WorkBuddyOfficialSection.WorkBuddyOfficialSection (cognitive 22) src/components/providers/forms/WorkBuddyOfficialSection.tsx:38— WorkBuddyOfficialSection.WorkBuddyOfficialSection has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, ternaries 8 (9 pts), if/else 3 (nesting depth added 1). Of this number, 15 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
format.formatTokensShort (cognitive 22) src/components/usage/format.ts:509— format.formatTokensShort has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useOpenClawModelOptions.useOpenClawModelOptions.options (cognitive 21) src/components/openclaw/hooks/useOpenClawModelOptions.ts:16— useOpenClawModelOptions.useOpenClawModelOptions.options has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenTerminalDialog.OpenTerminalDialog (cognitive 21) src/components/providers/OpenTerminalDialog.tsx:228— OpenTerminalDialog.OpenTerminalDialog has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 4, error handling 2. Of this number, 11 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Sidebar.MainDirectory (cognitive 21) src/components/shell/Sidebar.tsx:210— Sidebar.MainDirectory has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 4, match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 3 function items inside it that branch (todayValue, isGlobalSelected, a function literal at line 312). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillsStorageSheet.SkillsStorageSheet (cognitive 21) src/components/skills/SkillsStorageSheet.tsx:52— SkillsStorageSheet.SkillsStorageSheet has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 3, error handling 2. Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (doMigrate, handleMove, handleOpenFolder, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
providerConfigUtils.setApiKeyInConfig (cognitive 21) REDACTED:171— providerConfigUtils.setApiKeyInConfig has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ModelMapping::map_model (cognitive 20) src-tauri/src/proxy/model_mapper.rs:69— ModelMapping::map_model has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (20 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderRouter::select_providers_with_current (cognitive 20) src-tauri/src/proxy/provider_router.rs:73— ProviderRouter::select_providers_with_current has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeepLinkImportDialog.DeepLinkImportDialog::handleImport (cognitive 20) src/components/DeepLinkImportDialog.tsx:245— DeepLinkImportDialog.DeepLinkImportDialog::handleImport has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (DeepLinkImportDialog.DeepLinkImportDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ToolUninstallConfirmDialog.ToolUninstallConfirmDialog (cognitive 20) src/components/apps/ToolUninstallConfirmDialog.tsx:28— ToolUninstallConfirmDialog.ToolUninstallConfirmDialog has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, if/else 3, ternaries 2 (3 pts) (nesting depth added 1). Of this number, 13 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UsageHeatmap.UsageHeatmap (cognitive 20) src/components/usage/UsageHeatmap.tsx:247— UsageHeatmap.UsageHeatmap has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 6, if/else 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 383, showTooltip, a function literal at line 280, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
modelMetadata.indexModelsDev (cognitive 20) src/lib/modelMetadata.ts:174— modelMetadata.indexModelsDev has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PiTranscript::tool_result_message (cognitive 19) src-tauri/src/session_manager/providers/pi_blocks.rs:203— PiTranscript::tool_result_message has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageFooter.UsageFooter (cognitive 19) src/components/UsageFooter.tsx:97— UsageFooter.UsageFooter has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 2 (3 pts) (nesting depth added 2). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
UsageScriptModal.isOfficialSubscriptionProvider (cognitive 19) src/components/UsageScriptModal.tsx:207— UsageScriptModal.isOfficialSubscriptionProvider has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 5, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProviderCard.isOfficialProvider (cognitive 19) src/components/providers/ProviderCard.tsx:145— ProviderCard.isOfficialProvider has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useOmoModelSource.useOmoModelSource (cognitive 19) src/components/providers/forms/hooks/useOmoModelSource.ts:47— useOmoModelSource.useOmoModelSource has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 264, 302, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
modelMetadataFill.piCompletionsThinking (cognitive 19) src/components/providers/forms/modelMetadataFill.ts:214— modelMetadataFill.piCompletionsThinking has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (17 pts), boolean chains 2 (nesting depth added 10). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
QuotaLines.SplitQuotaColumn (cognitive 19) src/components/quota/QuotaLines.tsx:478— QuotaLines.SplitQuotaColumn has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 537, 505, 518). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ManagedAccountsGroup.AccountRow (cognitive 19) src/components/settings/auth/ManagedAccountsGroup.tsx:589— ManagedAccountsGroup.AccountRow has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 18, ternaries 1. Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RepoManagerPanel.RepoManagerPanel (cognitive 19) src/components/skills/RepoManagerPanel.tsx:81— RepoManagerPanel.RepoManagerPanel has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 6, error handling 2, if/else 2 (nesting depth added 4). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 219, handleAdd, handleOpenRepo, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UnifiedSkillsPanel.InstalledRow (cognitive 19) src/components/skills/UnifiedSkillsPanel.tsx:1805— UnifiedSkillsPanel.InstalledRow has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, ternaries 5 (6 pts), if/else 1 (nesting depth added 1). Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PromptCopyDialog.PromptCopyDialog (cognitive 18) src/components/prompts/PromptCopyDialog.tsx:30— PromptCopyDialog.PromptCopyDialog has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 3 (nesting depth added 1). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 98, 55, 76, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workbuddyQuota.workbuddyExpiryLine (cognitive 18) src/components/providers/workbuddyQuota.ts:141— workbuddyQuota.workbuddyExpiryLine has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 4 (6 pts), boolean chains 3, loops 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ClaudeStackModelsField.normalizeClaudeStackModels (cognitive 18) src/components/providers/forms/ClaudeStackModelsField.tsx:38— ClaudeStackModelsField.normalizeClaudeStackModels has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionStepDetails.SessionStepDetails (cognitive 18) src/components/sessions/reader/SessionStepDetails.tsx:350— SessionStepDetails.SessionStepDetails has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, ternaries 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BackupStorageSection.BackupStorageSection (cognitive 18) src/components/settings/BackupStorageSection.tsx:33— BackupStorageSection.BackupStorageSection has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, ternaries 4 (5 pts), error handling 2, if/else 1 (nesting depth added 1). Of this number, 9 points are the body's own statements and 9 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelsDevAutoSyncPanel.ModelsDevAutoSyncPanel (cognitive 18) src/components/usage/ModelsDevAutoSyncPanel.tsx:447— ModelsDevAutoSyncPanel.ModelsDevAutoSyncPanel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5, ternaries 5, boolean chains 4, error handling 4. Of this number, 11 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
errorUtils.extractErrorMessage (cognitive 18) REDACTED:6— errorUtils.extractErrorMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
piPromptTemplate.findFrontmatterField (cognitive 18) src/lib/piPromptTemplate.ts:55— piPromptTemplate.findFrontmatterField has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 5, ternaries 2 (5 pts), if/else 2 (4 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providerConfigUtils.getApiKeyFromConfig (cognitive 18) REDACTED:32— providerConfigUtils.getApiKeyFromConfig has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6, boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
textNormalization.scanTomlQuotes (cognitive 18) src/utils/textNormalization.ts:41— textNormalization.scanTomlQuotes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (21 pts), ternaries 4 (9 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (textNormalization.scanTomlQuotes::scan) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
KeywordGate::active_rules (cognitive 17) src-tauri/src/proxy/privacy_filter/secrets.rs:321— KeywordGate::active_rules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (6 pts) (nesting depth added 6). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageLogger::log_request (cognitive 17) src-tauri/src/proxy/usage/logger.rs:114— UsageLogger::log_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HermesMemoryPanel.MemoryTabPane (cognitive 17) src/components/hermes/HermesMemoryPanel.tsx:111— HermesMemoryPanel.MemoryTabPane has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 3, if/else 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
mcpDraft.specOf (cognitive 17) src/components/mcp/mcpDraft.ts:102— mcpDraft.specOf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PiNativePromptResources.PiPromptTemplates (cognitive 17) src/components/prompts/PiNativePromptResources.tsx:771— PiNativePromptResources.PiPromptTemplates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 3 (4 pts) (nesting depth added 1). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 834, 902, 985, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useModelState.parseModelsFromConfig (cognitive 17) src/components/providers/forms/hooks/useModelState.ts:47— useModelState.parseModelsFromConfig has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12, boolean chains 4, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StructuredOptionsEditor.StructuredOptionsEditor (cognitive 17) src/components/providers/forms/StructuredOptionsEditor.tsx:89— StructuredOptionsEditor.StructuredOptionsEditor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (renameOption, commitDraft, a function literal at line 236, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CopilotProviderForm.fromNativeText (cognitive 17) src/components/providers/forms/CopilotProviderForm.tsx:230— CopilotProviderForm.fromNativeText has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
StackSubagentFields.StackSubagentFields (cognitive 17) src/components/providers/mode/StackSubagentFields.tsx:69— StackSubagentFields.StackSubagentFields has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, if/else 3. Of this number, 11 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UsageHero.UsageHero (cognitive 17) src/components/usage/UsageHero.tsx:207— UsageHero.UsageHero has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 14 (16 pts), boolean chains 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
requestOverrides.parseHeaderOverrideJson (cognitive 17) src/lib/requestOverrides.ts:112— requestOverrides.parseHeaderOverrideJson has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providerMetaUtils.mergeProviderMeta (cognitive 17) src/utils/providerMetaUtils.ts:10— providerMetaUtils.mergeProviderMeta has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (7 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
textNormalization.scanTomlQuotes::scan (cognitive 17) src/utils/textNormalization.ts:74— textNormalization.scanTomlQuotes::scan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (textNormalization.scanTomlQuotes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ClaudeProjection::of (cognitive 16) src-tauri/src/live/project/claude.rs:34— ClaudeProjection::of has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Snapshot::from_headers (cognitive 16) src-tauri/src/proxy/codex_quota_protection.rs:129— Snapshot::from_headers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CopilotAuthManager::load_from_disk_sync (cognitive 16) src-tauri/src/proxy/providers/copilot_auth.rs:1622— CopilotAuthManager::load_from_disk_sync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FullScreenPanel.FullScreenPanel (cognitive 16) src/components/common/FullScreenPanel.tsx:73— FullScreenPanel.FullScreenPanel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 116, 96, 110, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
EnvWarningBanner.EnvWarningBanner (cognitive 16) src/components/env/EnvWarningBanner.tsx:25— EnvWarningBanner.EnvWarningBanner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (getSourceDescription, toggleSelection, toggleSelectAll, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
McpFormModal.McpFormModal::submitSingle (cognitive 16) src/components/mcp/McpFormModal.tsx:437— McpFormModal.McpFormModal::submitSingle has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 4 (6 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (McpFormModal.McpFormModal) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
opencodeFormUtils.mergeOpencodeExtraOptionRows (cognitive 16) src/components/providers/forms/helpers/opencodeFormUtils.ts:397— opencodeFormUtils.mergeOpencodeExtraOptionRows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, loops 3, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PiProviderForm.fillPiModelDraft (cognitive 16) REDACTED:361— PiProviderForm.fillPiModelDraft has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
toolSummary.formatStepTitle (cognitive 16) src/components/sessions/reader/toolSummary.ts:231— toolSummary.formatStepTitle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionFinalReply.SessionFinalReply (cognitive 16) src/components/sessions/reader/SessionFinalReply.tsx:67— SessionFinalReply.SessionFinalReply has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 2, ternaries 2. Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SessionOutline.SessionOutline (cognitive 16) src/components/sessions/reader/SessionOutline.tsx:46— SessionOutline.SessionOutline has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 3, ternaries 3. None of this is in the body itself: all 16 points belong to 4 function literals inside it that branch (lines 108, 78, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionManagerPage.SessionManagerPage::handleDeleteConfirm (cognitive 16) src/components/sessions/SessionManagerPage.tsx:568— SessionManagerPage.SessionManagerPage::handleDeleteConfirm has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (SessionManagerPage.SessionManagerPage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
GlobalProxySettings.GlobalProxySettings (cognitive 16) src/components/settings/GlobalProxySettings.tsx:73— GlobalProxySettings.GlobalProxySettings has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4, ternaries 4. Of this number, 11 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UnifiedSkillsPanel.UnifiedSkillsPanel::uninstallIds (cognitive 16) src/components/skills/UnifiedSkillsPanel.tsx:547— UnifiedSkillsPanel.UnifiedSkillsPanel::uninstallIds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (UnifiedSkillsPanel.UnifiedSkillsPanel) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
theme-provider.ThemeProvider (cognitive 16) src/components/theme-provider.tsx:51— theme-provider.ThemeProvider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 2, error handling 1, ternaries 1. None of this is in the body itself: all 16 points belong to 8 function items inside it that branch (getInitialTheme, a function literal at line 79, a function literal at line 115, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PricingEditModal.PricingEditModal (cognitive 16) src/components/usage/PricingEditModal.tsx:23— PricingEditModal.PricingEditModal has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (7 pts), boolean chains 4, if/else 2 (3 pts), error handling 1, loops 1 (nesting depth added 2). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
kimiProviderPresets.toKimiModel (cognitive 16) src/config/kimiProviderPresets.ts:103— kimiProviderPresets.toKimiModel has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (5 pts), ternaries 5 (nesting depth added 1). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
errorUtils.translateMcpBackendError (cognitive 16) REDACTED:88— errorUtils.translateMcpBackendError has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
managedAccountUsage.findManagedAccountUsers (cognitive 16) src/lib/managedAccountUsage.ts:78— managedAccountUsage.findManagedAccountUsers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TrayPanel.QuotaBlock (cognitive 16) src/tray-panel/TrayPanel.tsx:163— TrayPanel.QuotaBlock has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 4, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 194, 177). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
providerCapabilities.providerNeedsRouting (cognitive 16) src/utils/providerCapabilities.ts:178— providerCapabilities.providerNeedsRouting has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
providerConfigUtils.setCodexWireApi (cognitive 16) REDACTED:796— providerConfigUtils.setCodexWireApi has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providerConfigUtils.extractCodexExperimentalBearerToken (cognitive 16) REDACTED:1022— providerConfigUtils.extractCodexExperimentalBearerToken has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4, error handling 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tomlUtils.extractIdFromToml (cognitive 16) src/utils/tomlUtils.ts:189— tomlUtils.extractIdFromToml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Near-duplicate member family (3 members, 51 shared lines) · ×1
Near-duplicate member family (3 members, 51 shared lines) src-tauri/src/services/coding_plan.rs:164— src-tauri/src/services/coding_plan.rs:164-275 | src-tauri/src/services/coding_plan.rs:544-633 | src-tauri/src/services/coding_plan.rs:898-973 — These 3 members are variants of one another: a block of 51 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 33 shared lines) · ×1
Near-duplicate member family (3 members, 33 shared lines) src-tauri/src/session_manager/providers/claude.rs:146— src-tauri/src/session_manager/providers/claude.rs:146-285 | src-tauri/src/session_manager/providers/codex.rs:1980-2101 | src-tauri/src/session_manager/providers/openclaw.rs:150-264 — These 3 members are variants of one another: a block of 33 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) src-tauri/src/mcp/agy.rs:107— src-tauri/src/mcp/agy.rs:107-157 | src-tauri/src/mcp/copilot.rs:258-304 | src-tauri/src/mcp/kimi.rs:84-133 | src-tauri/src/mcp/mcode.rs:69-118 | src-tauri/src/mcp/omp.rs:200-244 | src-tauri/src/mcp/pi.rs:251-321 | src-tauri/src/mcp/workbuddy.rs:108-165 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Edited copy of a member (115 corresponding lines) · ×1
Edited copy of a member (115 corresponding lines) src-tauri/src/services/session_usage_codex.rs:2638— src-tauri/src/services/session_usage_codex.rs:2638-2752 | src-tauri/src/services/session_usage_gemini.rs:247-369 — These two members are one piece of code written twice and then edited apart: 115 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (78 corresponding lines) · ×1
Edited copy of a member (78 corresponding lines) src-tauri/src/services/skill.rs:4311— src-tauri/src/services/skill.rs:4311-4397 | src-tauri/src/services/skill.rs:4877-4954 — These two members are one piece of code written twice and then edited apart: 78 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (74 corresponding lines) · ×1
Edited copy of a member (74 corresponding lines) src-tauri/src/services/session_usage_copilot.rs:182— src-tauri/src/services/session_usage_copilot.rs:182-262 | src-tauri/src/services/session_usage_workbuddy.rs:120-193 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 54+ corresponding lines) · ×1
Edited copies of one member (3 members, 54+ corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1999— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1999-2052 | src-tauri/src/proxy/providers/copilot_auth.rs:1479-1532 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:805-864 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 54 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (63 corresponding lines) · ×1
Edited copy of a member (63 corresponding lines) src-tauri/src/claude_desktop_config.rs:1103— src-tauri/src/claude_desktop_config.rs:1103-1165 | src-tauri/src/proxy/providers/claude.rs:243-311 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) src-tauri/src/services/provider/live.rs:1442— src-tauri/src/services/provider/live.rs:1442-1523 | src-tauri/src/services/provider/live.rs:1530-1591 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×1
Edited copy of a member (50 corresponding lines) src-tauri/src/proxy/providers/copilot_auth.rs:1138— src-tauri/src/proxy/providers/copilot_auth.rs:1138-1192 | src-tauri/src/proxy/providers/copilot_auth.rs:1252-1301 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (76 corresponding lines) · ×1
Edited copy of a member (76 corresponding lines) src-tauri/src/deeplink/parser.rs:248— src-tauri/src/deeplink/parser.rs:248-323 | src-tauri/src/deeplink/parser.rs:330-408 — These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) src-tauri/src/jsonc_document.rs:360— src-tauri/src/jsonc_document.rs:360-398 | src-tauri/src/jsonc_document.rs:406-443 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:889— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:889-936 | src-tauri/src/proxy/providers/transform_responses.rs:217-253 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 38+ corresponding lines) · ×1
Edited copies of one member (6 members, 38+ corresponding lines) src-tauri/src/services/balance.rs:75— src-tauri/src/services/balance.rs:75-112 | src-tauri/src/services/balance.rs:157-209 | src-tauri/src/services/balance.rs:293-330 | src-tauri/src/services/balance.rs:369-406 | src-tauri/src/services/balance.rs:449-495 | src-tauri/src/services/coding_plan.rs:1787-1831 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (54 corresponding lines) · ×1
Edited copy of a member (54 corresponding lines) src-tauri/src/proxy/handlers.rs:3419— src-tauri/src/proxy/handlers.rs:3419-3472 | src-tauri/src/proxy/response_processor.rs:670-728 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) REDACTED:598— REDACTED:598-642 | src-tauri/src/services/config.rs:37-80 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×1
Edited copy of a member (31 corresponding lines) src-tauri/src/hermes_config.rs:383— src-tauri/src/hermes_config.rs:383-413 | src-tauri/src/openclaw_config.rs:395-425 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) src-tauri/src/services/provider/icon.rs:134— src-tauri/src/services/provider/icon.rs:134-176 | src-tauri/src/services/provider/icon.rs:180-215 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) src-tauri/src/commands/s3_sync.rs:128— src-tauri/src/commands/s3_sync.rs:128-160 | src-tauri/src/commands/webdav_sync.rs:136-168 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) src-tauri/src/services/s3_sync.rs:41— src-tauri/src/services/s3_sync.rs:41-79 | src-tauri/src/services/webdav_sync.rs:62-102 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) src-tauri/src/session_manager/terminal/mod.rs:183— src-tauri/src/session_manager/terminal/mod.rs:183-215 | src-tauri/src/session_manager/terminal/mod.rs:349-376 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×1
Edited copy of a member (48 corresponding lines) src-tauri/src/lib.rs:2308— src-tauri/src/lib.rs:2308-2355 | src-tauri/src/lib.rs:2363-2420 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×1
Edited copies of one member (3 members, 12+ corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1899— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1899-1910 | src-tauri/src/proxy/providers/copilot_auth.rs:1421-1434 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:775-787 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×1
Edited copies of one member (3 members, 20+ corresponding lines) src-tauri/src/app_config.rs:42— src-tauri/src/app_config.rs:42-61 | src-tauri/src/app_config.rs:187-206 | src-tauri/src/settings.rs:95-114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×1
Edited copies of one member (3 members, 16+ corresponding lines) src-tauri/src/pi_config/mod.rs:121— src-tauri/src/pi_config/mod.rs:121-141 | src-tauri/src/pi_config/mod.rs:147-168 | src-tauri/src/pi_config/mod.rs:173-188 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×1
Edited copies of one member (3 members, 13+ corresponding lines) src-tauri/src/commands/provider.rs:60— src-tauri/src/commands/provider.rs:60-72 | src-tauri/src/commands/provider.rs:81-98 | src-tauri/src/commands/provider.rs:221-233 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 14+ corresponding lines) · ×1
Edited copies of one member (4 members, 14+ corresponding lines) src-tauri/src/services/session_usage.rs:983— src-tauri/src/services/session_usage.rs:983-1006 | src-tauri/src/services/session_usage.rs:1056-1069 | src-tauri/src/services/session_usage.rs:1079-1101 | src-tauri/src/services/session_usage_dsh.rs:309-331 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 20+ corresponding lines) · ×1
Edited copies of one member (4 members, 20+ corresponding lines) REDACTED:236— REDACTED:236-255 | REDACTED:731-751 | REDACTED:1295-1314 | src-tauri/src/services/subscription_grok.rs:40-59 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 9+ corresponding lines) · ×1
Edited copies of one member (6 members, 9+ corresponding lines) src-tauri/src/commands/provider.rs:28— src-tauri/src/commands/provider.rs:28-37 | src-tauri/src/commands/provider.rs:43-51 | src-tauri/src/commands/provider.rs:143-153 | src-tauri/src/commands/provider.rs:160-170 | src-tauri/src/commands/provider.rs:177-187 | src-tauri/src/commands/proxy.rs:149-157 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×1
Edited copies of one member (3 members, 10+ corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1885— src-tauri/src/proxy/providers/codex_oauth_auth.rs:1885-1894 | src-tauri/src/proxy/providers/copilot_auth.rs:1407-1416 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:753-764 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×1
Edited copies of one member (3 members, 9+ corresponding lines) src-tauri/src/services/agy_account/mod.rs:568— src-tauri/src/services/agy_account/mod.rs:568-578 | src-tauri/src/services/claude_account/mod.rs:149-157 | src-tauri/src/services/workbuddy_account/mod.rs:914-923 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 8+ corresponding lines) · ×1
Edited copies of one member (5 members, 8+ corresponding lines) src-tauri/src/commands/pi.rs:27— src-tauri/src/commands/pi.rs:27-34 | src-tauri/src/commands/provider.rs:954-961 | src-tauri/src/commands/provider.rs:969-976 | src-tauri/src/commands/provider.rs:984-991 | src-tauri/src/commands/provider.rs:999-1006 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 7+ corresponding lines) · ×1
Edited copies of one member (5 members, 7+ corresponding lines) src-tauri/src/copilot_config.rs:803— src-tauri/src/copilot_config.rs:803-809 | src-tauri/src/dsh_config.rs:132-138 | src-tauri/src/dsh_config.rs:369-378 | src-tauri/src/opencode_config.rs:18-24 | src-tauri/src/services/omo.rs:328-334 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) src-tauri/src/database/dao/proxy.rs:418— src-tauri/src/database/dao/proxy.rs:418-428 | src-tauri/src/database/dao/proxy.rs:719-727 | src-tauri/src/database/mod.rs:332-338 | src-tauri/src/database/mod.rs:341-347 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 15+ corresponding lines) · ×1
Edited copies of one member (6 members, 15+ corresponding lines) src-tauri/src/services/coding_plan.rs:121— src-tauri/src/services/coding_plan.rs:121-135 | src-tauri/src/services/coding_plan.rs:442-456 | src-tauri/src/services/coding_plan.rs:1041-1055 | src-tauri/src/services/coding_plan.rs:1653-1667 | src-tauri/src/services/kimi_oauth/account.rs:379-393 | REDACTED:106-120 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) src-tauri/src/session_manager/providers/claude.rs:300— src-tauri/src/session_manager/providers/claude.rs:300-309 | src-tauri/src/session_manager/providers/codex.rs:2189-2198 | src-tauri/src/session_manager/providers/grokbuild.rs:182-191 | src-tauri/src/session_manager/providers/opencode.rs:905-914 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) src-tauri/src/opencode_config.rs:91— src-tauri/src/opencode_config.rs:91-105 | src-tauri/src/session_manager/providers/opencode.rs:19-28 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×1
Edited copies of one member (4 members, 12+ corresponding lines) src-tauri/src/database/dao/proxy.rs:120— src-tauri/src/database/dao/proxy.rs:120-137 | src-tauri/src/database/dao/proxy.rs:584-596 | src-tauri/src/database/dao/proxy.rs:703-716 | src-tauri/src/database/dao/proxy.rs:753-764 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 5+ corresponding lines) · ×1
Edited copies of one member (4 members, 5+ corresponding lines) src-tauri/src/mcp/agy.rs:56— src-tauri/src/mcp/agy.rs:56-60 | src-tauri/src/mcp/kimi.rs:44-48 | src-tauri/src/mcp/mcode.rs:34-38 | src-tauri/src/mcp/workbuddy.rs:53-57 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 4+ corresponding lines) · ×1
Edited copies of one member (6 members, 4+ corresponding lines) src-tauri/src/hermes_config.rs:105— src-tauri/src/hermes_config.rs:105-108 | src-tauri/src/openclaw_config.rs:59-62 | src-tauri/src/opencode_config.rs:13-16 | src-tauri/src/services/omo.rs:108-111 | src-tauri/src/services/provider/codex_client_catalog.rs:259-262 | src-tauri/src/services/provider/codex_official_models.rs:386-389 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×1
Edited copies of one member (3 members, 6+ corresponding lines) src-tauri/src/commands/omp.rs:26— src-tauri/src/commands/omp.rs:26-31 | src-tauri/src/commands/pi.rs:14-19 | src-tauri/src/commands/provider.rs:1056-1061 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (56 lines × 2) src-tauri/src/proxy/handlers.rs:1162— src-tauri/src/proxy/handlers.rs:1162-1217 | src-tauri/src/proxy/handlers.rs:1519-1574 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/handlers.rs:1158` calls `is_compaction_request` and `src-tauri/src/proxy/handlers.rs:1518` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (41–46 lines × 2) src-tauri/src/proxy/handlers.rs:3432— src-tauri/src/proxy/handlers.rs:3432-3472 | src-tauri/src/proxy/response_processor.rs:683-728 — before extracting anything, compare `src-tauri/src/proxy/handlers.rs` and `src-tauri/src/proxy/response_processor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:3432` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (45 lines × 2) src-tauri/src/app_config.rs:87— src-tauri/src/app_config.rs:87-131 | src-tauri/src/app_config.rs:232-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (43 lines × 2) src-tauri/src/proxy/handlers.rs:1885— src-tauri/src/proxy/handlers.rs:1885-1927 | src-tauri/src/proxy/handlers.rs:2262-2304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:1885` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (41–42 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:2713— src-tauri/src/proxy/providers/streaming_responses.rs:2713-2753 | src-tauri/src/proxy/providers/streaming_responses.rs:2769-2810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:2713` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (39–41 lines × 2) src-tauri/src/proxy/handlers.rs:1227— src-tauri/src/proxy/handlers.rs:1227-1267 | src-tauri/src/proxy/handlers.rs:1572-1610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:1227` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (41 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:2012— src-tauri/src/proxy/providers/codex_oauth_auth.rs:2012-2052 | src-tauri/src/proxy/providers/copilot_auth.rs:1492-1532 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_oauth_auth.rs:2012` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (40 lines × 3) src-tauri/src/proxy/handlers.rs:1750— src-tauri/src/proxy/handlers.rs:1750-1789 | src-tauri/src/proxy/handlers.rs:1992-2031 | src-tauri/src/proxy/handlers.rs:2157-2196 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (38–40 lines × 2) src-tauri/src/proxy/providers/transform_codex_chat.rs:1071— src-tauri/src/proxy/providers/transform_codex_chat.rs:1071-1110 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1112-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (34–35 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3711— src-tauri/src/proxy/providers/streaming_responses.rs:3711-3744 | src-tauri/src/proxy/providers/streaming_responses.rs:4315-4349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3711` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (31–32 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3079— src-tauri/src/proxy/providers/streaming_responses.rs:3079-3109 | src-tauri/src/proxy/providers/streaming_responses.rs:4353-4384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3079` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (26–28 lines × 2) src-tauri/src/config.rs:169— src-tauri/src/config.rs:169-196 | src-tauri/src/config.rs:216-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (24–26 lines × 2) src-tauri/src/lib.rs:2330— src-tauri/src/lib.rs:2330-2355 | src-tauri/src/lib.rs:2397-2420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/lib.rs:2330` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/lib.rs:2396` calls `display` and `src-tauri/src/lib.rs:2329` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26 lines × 2) REDACTED:1348— REDACTED:1348-1373 | REDACTED:1462-1487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1348` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24–25 lines × 3) src-tauri/src/proxy/handlers.rs:711— src-tauri/src/proxy/handlers.rs:711-734 | src-tauri/src/proxy/handlers.rs:1875-1899 | src-tauri/src/proxy/handlers.rs:2252-2276 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:711` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 2) src-tauri/src/services/s3.rs:336— src-tauri/src/services/s3.rs:336-360 | src-tauri/src/services/s3.rs:494-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/s3.rs:336` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (22–24 lines × 2) src-tauri/src/commands/misc.rs:6317— src-tauri/src/commands/misc.rs:6317-6340 | src-tauri/src/commands/misc.rs:7063-7084 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:6317` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/commands/misc.rs:6313` calls `to_path_buf` and `src-tauri/src/commands/misc.rs:7061` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (35–41 lines × 2) src-tauri/src/commands/misc.rs:6671— src-tauri/src/commands/misc.rs:6671-6711 | src-tauri/src/commands/misc.rs:7096-7130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:6671` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–22 lines × 2) src-tauri/src/proxy/forwarder.rs:1326— src-tauri/src/proxy/forwarder.rs:1326-1347 | src-tauri/src/proxy/forwarder.rs:1411-1431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/forwarder.rs:1326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–22 lines × 2) src-tauri/src/proxy/handlers.rs:1850— src-tauri/src/proxy/handlers.rs:1850-1871 | src-tauri/src/proxy/handlers.rs:2234-2248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:1850` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–22 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3666— src-tauri/src/proxy/providers/streaming_responses.rs:3666-3687 | src-tauri/src/proxy/providers/streaming_responses.rs:4257-4274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:3666` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21 lines × 6) src-tauri/src/services/balance.rs:82— src-tauri/src/services/balance.rs:82-102 | src-tauri/src/services/balance.rs:164-184 | src-tauri/src/services/balance.rs:229-249 | src-tauri/src/services/balance.rs:300-320 | src-tauri/src/services/balance.rs:376-396 | src-tauri/src/services/balance.rs:465-485 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/balance.rs:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–21 lines × 3) src-tauri/src/proxy/providers/streaming_responses.rs:3015— src-tauri/src/proxy/providers/streaming_responses.rs:3015-3031 | src-tauri/src/proxy/providers/streaming_responses.rs:3667-3687 | src-tauri/src/proxy/providers/streaming_responses.rs:4258-4274 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–21 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:39— src-tauri/src/session_manager/providers/hermes.rs:39-58 | src-tauri/src/session_manager/providers/opencode.rs:107-127 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `src-tauri/src/session_manager/providers/opencode.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/hermes.rs:39` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 3) src-tauri/src/mcp/claude.rs:19— src-tauri/src/mcp/claude.rs:19-38 | src-tauri/src/mcp/codex.rs:24-43 | src-tauri/src/mcp/gemini.rs:19-38 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/codex.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18–19 lines × 5) REDACTED:1047— REDACTED:1047-1065 | REDACTED:1195-1212 | REDACTED:1549-1567 | REDACTED:1711-1728 | REDACTED:2002-2019 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–19 lines × 5) REDACTED:1042— REDACTED:1042-1060 | REDACTED:1544-1562 | REDACTED:1707-1723 | REDACTED:1799-1816 | REDACTED:1997-2014 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1042` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) src-tauri/src/mcp/claude.rs:97— src-tauri/src/mcp/claude.rs:97-115 | src-tauri/src/mcp/codex.rs:257-275 | src-tauri/src/mcp/gemini.rs:93-111 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/codex.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/claude.rs:97` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 3) REDACTED:1012— REDACTED:1012-1030 | REDACTED:1674-1691 | REDACTED:1970-1987 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–18 lines × 3) src-tauri/src/proxy/handlers.rs:351— src-tauri/src/proxy/handlers.rs:351-367 | src-tauri/src/proxy/handlers.rs:1134-1150 | src-tauri/src/proxy/handlers.rs:1494-1511 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/handlers.rs:1132` calls `decode_codex_request_body` and `src-tauri/src/proxy/handlers.rs:349` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–18 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:186— src-tauri/src/proxy/providers/streaming_responses.rs:186-200 | src-tauri/src/proxy/providers/streaming_responses.rs:215-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/streaming_responses.rs:186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–18 lines × 2) src-tauri/src/proxy/providers/streaming_responses.rs:3406— src-tauri/src/proxy/providers/streaming_responses.rs:3406-3423 | src-tauri/src/proxy/providers/streaming_responses.rs:3471-3484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 4) REDACTED:1009— REDACTED:1009-1025 | REDACTED:1671-1686 | REDACTED:1774-1789 | REDACTED:1967-1982 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1009` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 3) src-tauri/src/proxy/providers/streaming_responses.rs:3041— src-tauri/src/proxy/providers/streaming_responses.rs:3041-3057 | src-tauri/src/proxy/providers/streaming_responses.rs:3708-3724 | src-tauri/src/proxy/providers/streaming_responses.rs:4312-4328 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–17 lines × 3) src-tauri/src/services/coding_plan.rs:183— src-tauri/src/services/coding_plan.rs:183-199 | src-tauri/src/services/coding_plan.rs:571-587 | src-tauri/src/services/coding_plan.rs:925-940 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:183` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 3) src-tauri/src/services/session_usage_codex.rs:2694— src-tauri/src/services/session_usage_codex.rs:2694-2708 | src-tauri/src/services/session_usage_gemini.rs:297-311 | REDACTED:496-512 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage_codex.rs:2694` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–17 lines × 2) src-tauri/src/services/skill.rs:4375— src-tauri/src/services/skill.rs:4375-4391 | src-tauri/src/services/skill.rs:4934-4948 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/skill.rs:4375` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–20 lines × 2) REDACTED:68— REDACTED:68-87 | REDACTED:1262-1280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 4) src-tauri/src/mcp/claude.rs:97— src-tauri/src/mcp/claude.rs:97-112 | src-tauri/src/mcp/codex.rs:257-272 | src-tauri/src/mcp/gemini.rs:93-108 | src-tauri/src/mcp/opencode.rs:265-280 — before extracting anything, compare `src-tauri/src/mcp/claude.rs` and `src-tauri/src/mcp/codex.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/claude.rs:97` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14–16 lines × 4) REDACTED:992— REDACTED:992-1007 | REDACTED:1157-1170 | REDACTED:1759-1772 | REDACTED:1952-1965 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15–16 lines × 3) src-tauri/src/proxy/providers/claude.rs:781— src-tauri/src/proxy/providers/claude.rs:781-795 | src-tauri/src/proxy/providers/codex.rs:1184-1199 | src-tauri/src/proxy/providers/gemini.rs:174-188 — before extracting anything, compare `src-tauri/src/proxy/providers/claude.rs` and `src-tauri/src/proxy/providers/codex.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 3) src-tauri/src/proxy/providers/streaming_responses.rs:2621— src-tauri/src/proxy/providers/streaming_responses.rs:2621-2636 | src-tauri/src/proxy/providers/streaming_responses.rs:2896-2911 | src-tauri/src/proxy/providers/streaming_responses.rs:3111-3126 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15–16 lines × 2) src-tauri/src/proxy/providers/streaming_codex_chat.rs:388— src-tauri/src/proxy/providers/streaming_codex_chat.rs:388-403 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:624-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/streaming_codex_chat.rs:621` calls `is_empty` and `src-tauri/src/proxy/providers/streaming_codex_chat.rs:387` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–15 lines × 11) src-tauri/src/services/balance.rs:95— src-tauri/src/services/balance.rs:95-109 | src-tauri/src/services/balance.rs:177-191 | src-tauri/src/services/balance.rs:242-256 | src-tauri/src/services/balance.rs:313-327 | src-tauri/src/services/balance.rs:389-403 | src-tauri/src/services/balance.rs:478-492 | src-tauri/src/services/coding_plan.rs:198-212 | src-tauri/src/services/coding_plan.rs:586-600 | src-tauri/src/services/coding_plan.rs:670-684 | src-tauri/src/services/coding_plan.rs:939-951 | src-tauri/src/services/coding_plan.rs:1812-1826 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/services/balance.rs:111` calls `Ok`, `parse_deepseek_balance` and `src-tauri/src/services/coding_plan.rs:214` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–15 lines × 6) src-tauri/src/proxy/providers/streaming.rs:286— src-tauri/src/proxy/providers/streaming.rs:286-300 | src-tauri/src/proxy/providers/streaming.rs:420-434 | src-tauri/src/proxy/providers/streaming.rs:445-459 | src-tauri/src/proxy/providers/streaming.rs:632-646 | src-tauri/src/proxy/providers/streaming.rs:752-764 | src-tauri/src/proxy/providers/streaming.rs:783-795 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/proxy/providers/streaming.rs:461` calls `Some`, `take` and `src-tauri/src/proxy/providers/streaming.rs:765` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 6) src-tauri/src/proxy/handlers.rs:388— src-tauri/src/proxy/handlers.rs:388-401 | src-tauri/src/proxy/handlers.rs:1042-1054 | src-tauri/src/proxy/handlers.rs:1170-1182 | src-tauri/src/proxy/handlers.rs:1427-1439 | src-tauri/src/proxy/handlers.rs:1527-1539 | src-tauri/src/proxy/handlers.rs:2691-2704 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:388` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 6) src-tauri/src/proxy/providers/streaming_responses.rs:2560— src-tauri/src/proxy/providers/streaming_responses.rs:2560-2572 | src-tauri/src/proxy/providers/streaming_responses.rs:2972-2984 | src-tauri/src/proxy/providers/streaming_responses.rs:3585-3597 | src-tauri/src/proxy/providers/streaming_responses.rs:4217-4229 | src-tauri/src/proxy/providers/streaming_responses.rs:4520-4532 | src-tauri/src/proxy/providers/streaming_responses.rs:4675-4687 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) src-tauri/src/proxy/providers/claude.rs:701— src-tauri/src/proxy/providers/claude.rs:701-713 | src-tauri/src/proxy/providers/codex.rs:1113-1125 | src-tauri/src/proxy/providers/gemini.rs:134-146 — before extracting anything, compare `src-tauri/src/proxy/providers/claude.rs` and `src-tauri/src/proxy/providers/codex.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/claude.rs:701` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 6) REDACTED:1008— REDACTED:1008-1019 | REDACTED:1347-1358 | REDACTED:1461-1472 | REDACTED:1670-1681 | REDACTED:1773-1784 | REDACTED:1966-1977 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–12 lines × 4) src-tauri/src/proxy/providers/streaming_responses.rs:3407— src-tauri/src/proxy/providers/streaming_responses.rs:3407-3418 | src-tauri/src/proxy/providers/streaming_responses.rs:3472-3480 | src-tauri/src/proxy/providers/streaming_responses.rs:4413-4421 | src-tauri/src/proxy/providers/streaming_responses.rs:4472-4480 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–12 lines × 3) src-tauri/src/proxy/forwarder.rs:3118— src-tauri/src/proxy/forwarder.rs:3118-3129 | src-tauri/src/proxy/forwarder.rs:3184-3193 | src-tauri/src/proxy/forwarder.rs:3211-3220 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–11 lines × 13) src-tauri/src/services/balance.rs:83— src-tauri/src/services/balance.rs:83-92 | src-tauri/src/services/balance.rs:165-174 | src-tauri/src/services/balance.rs:230-239 | src-tauri/src/services/balance.rs:301-310 | src-tauri/src/services/balance.rs:377-386 | src-tauri/src/services/balance.rs:466-475 | src-tauri/src/services/coding_plan.rs:173-182 | src-tauri/src/services/coding_plan.rs:404-413 | src-tauri/src/services/coding_plan.rs:561-570 | src-tauri/src/services/coding_plan.rs:645-654 | src-tauri/src/services/coding_plan.rs:1799-1808 | REDACTED:460-470 | src-tauri/src/services/subscription_grok.rs:640-650 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/balance.rs:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/services/subscription_grok.rs:638` calls `body` and `src-tauri/src/services/coding_plan.rs:402` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 5) src-tauri/src/proxy/providers/codex_compaction.rs:361— src-tauri/src/proxy/providers/codex_compaction.rs:361-370 | src-tauri/src/proxy/providers/responses_late_arguments.rs:205-214 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:773-783 | src-tauri/src/proxy/providers/streaming_gemini.rs:258-268 | src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:1108-1117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/codex_compaction.rs:361` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/codex_compaction.rs:359` calls `default` and `src-tauri/src/proxy/providers/transform_codex_responses_xai_sanitize.rs:1106` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–11 lines × 4) src-tauri/src/lib.rs:348— src-tauri/src/lib.rs:348-355 | src-tauri/src/lib.rs:467-477 | src-tauri/src/lib.rs:2123-2130 | src-tauri/src/tray.rs:3059-3066 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/lib.rs:348` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) src-tauri/src/proxy/handlers.rs:1000— src-tauri/src/proxy/handlers.rs:1000-1010 | src-tauri/src/proxy/handlers.rs:1122-1132 | src-tauri/src/proxy/handlers.rs:1394-1404 | src-tauri/src/proxy/handlers.rs:1482-1492 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–11 lines × 3) src-tauri/src/commands/config.rs:274— src-tauri/src/commands/config.rs:274-284 | src-tauri/src/commands/config.rs:327-337 | src-tauri/src/commands/skill.rs:252-260 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/config.rs:274` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) src-tauri/src/services/session_usage.rs:1306— src-tauri/src/services/session_usage.rs:1306-1316 | src-tauri/src/services/session_usage_codex.rs:2640-2650 | src-tauri/src/services/session_usage_gemini.rs:251-261 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/session_usage.rs:1306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/services/session_usage.rs:1305` calls `as_ref` and `src-tauri/src/services/session_usage_codex.rs:2639` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19 lines × 2) src-tauri/src/openclaw_config.rs:753— src-tauri/src/openclaw_config.rs:753-771 | src-tauri/src/openclaw_config.rs:794-812 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8–11 lines × 2) src-tauri/src/proxy/providers/transform.rs:451— src-tauri/src/proxy/providers/transform.rs:451-458 | src-tauri/src/proxy/providers/transform_gemini.rs:936-946 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform.rs:451` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 8) src-tauri/src/services/coding_plan.rs:172— src-tauri/src/services/coding_plan.rs:172-181 | src-tauri/src/services/coding_plan.rs:403-412 | src-tauri/src/services/coding_plan.rs:560-569 | src-tauri/src/services/coding_plan.rs:644-653 | src-tauri/src/services/coding_plan.rs:907-916 | src-tauri/src/services/coding_plan.rs:1798-1807 | REDACTED:459-468 | src-tauri/src/services/subscription_grok.rs:639-648 — before extracting anything, compare `src-tauri/src/services/coding_plan.rs` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/coding_plan.rs:172` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/services/subscription_grok.rs:638` calls `body` and `src-tauri/src/services/coding_plan.rs:402` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–10 lines × 4) src-tauri/src/proxy/handlers.rs:920— src-tauri/src/proxy/handlers.rs:920-929 | src-tauri/src/proxy/handlers.rs:2039-2047 | src-tauri/src/proxy/handlers.rs:2203-2211 | src-tauri/src/proxy/handlers.rs:2369-2377 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:920` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/handlers.rs:2038` calls `builder`, `status` and `src-tauri/src/proxy/handlers.rs:918` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 4) src-tauri/src/proxy/handlers.rs:1802— src-tauri/src/proxy/handlers.rs:1802-1811 | src-tauri/src/proxy/handlers.rs:2036-2045 | src-tauri/src/proxy/handlers.rs:2200-2209 | src-tauri/src/proxy/handlers.rs:2366-2375 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–10 lines × 3) src-tauri/src/proxy/handlers.rs:682— src-tauri/src/proxy/handlers.rs:682-691 | src-tauri/src/proxy/handlers.rs:1847-1855 | src-tauri/src/proxy/handlers.rs:2231-2238 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:682` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) src-tauri/src/claude_mcp.rs:179— src-tauri/src/claude_mcp.rs:179-195 | src-tauri/src/mcp/validation.rs:10-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/claude_mcp.rs:179` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spec` to `Value` in one and `&Value` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 14) src-tauri/src/services/balance.rs:83— src-tauri/src/services/balance.rs:83-91 | src-tauri/src/services/balance.rs:165-173 | src-tauri/src/services/balance.rs:230-238 | src-tauri/src/services/balance.rs:301-309 | src-tauri/src/services/balance.rs:377-385 | src-tauri/src/services/balance.rs:466-474 | src-tauri/src/services/coding_plan.rs:173-181 | src-tauri/src/services/coding_plan.rs:404-412 | src-tauri/src/services/coding_plan.rs:561-569 | src-tauri/src/services/coding_plan.rs:645-653 | src-tauri/src/services/coding_plan.rs:908-916 | src-tauri/src/services/coding_plan.rs:1799-1807 | REDACTED:460-468 | src-tauri/src/services/subscription_grok.rs:640-648 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/balance.rs:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/services/subscription_grok.rs:638` calls `body` and `src-tauri/src/services/coding_plan.rs:402` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 5) src-tauri/src/proxy/handlers.rs:716— src-tauri/src/proxy/handlers.rs:716-723 | src-tauri/src/proxy/handlers.rs:1880-1888 | src-tauri/src/proxy/handlers.rs:2257-2265 | src-tauri/src/proxy/response_processor.rs:536-544 | src-tauri/src/proxy/response_processor.rs:563-570 — before extracting anything, compare `src-tauri/src/proxy/handlers.rs` and `src-tauri/src/proxy/response_processor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/handlers.rs:716` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 3) src-tauri/src/proxy/providers/codex_oauth_auth.rs:2024— src-tauri/src/proxy/providers/codex_oauth_auth.rs:2024-2032 | src-tauri/src/proxy/providers/copilot_auth.rs:1504-1512 | src-tauri/src/proxy/providers/xai_oauth_auth.rs:826-833 — before extracting anything, compare `src-tauri/src/proxy/providers/codex_oauth_auth.rs` and `src-tauri/src/proxy/providers/copilot_auth.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–9 lines × 3) src-tauri/src/proxy/providers/transform.rs:453— src-tauri/src/proxy/providers/transform.rs:453-458 | src-tauri/src/proxy/providers/transform_gemini.rs:938-946 | src-tauri/src/proxy/providers/transform_responses.rs:2374-2379 — before extracting anything, compare `src-tauri/src/proxy/providers/transform.rs` and `src-tauri/src/proxy/providers/transform_responses.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/transform.rs:453` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) src-tauri/src/proxy/handlers.rs:1728— src-tauri/src/proxy/handlers.rs:1728-1735 | src-tauri/src/proxy/handlers.rs:1934-1941 | src-tauri/src/proxy/handlers.rs:2098-2105 | src-tauri/src/proxy/handlers.rs:2323-2330 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (2–8 lines × 4) src-tauri/src/mcp/hermes.rs:91— src-tauri/src/mcp/hermes.rs:91-97 | src-tauri/src/mcp/hermes.rs:148-149 | src-tauri/src/mcp/opencode.rs:89-91 | src-tauri/src/mcp/opencode.rs:164-171 — before extracting anything, compare `src-tauri/src/mcp/hermes.rs` and `src-tauri/src/mcp/opencode.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/hermes.rs:91` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/mcp/hermes.rs:91` calls `is_object`, `as_object`, `is_empty` and `src-tauri/src/mcp/hermes.rs:148` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5–7 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:552— src-tauri/src/proxy/providers/transform_codex_anthropic.rs:552-556 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:588-594 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 12) src-tauri/src/services/balance.rs:102— src-tauri/src/services/balance.rs:102-107 | src-tauri/src/services/balance.rs:184-189 | src-tauri/src/services/balance.rs:249-254 | src-tauri/src/services/balance.rs:320-325 | src-tauri/src/services/balance.rs:396-401 | src-tauri/src/services/balance.rs:485-490 | src-tauri/src/services/coding_plan.rs:205-210 | src-tauri/src/services/coding_plan.rs:426-431 | src-tauri/src/services/coding_plan.rs:593-598 | src-tauri/src/services/coding_plan.rs:677-682 | src-tauri/src/services/coding_plan.rs:944-949 | src-tauri/src/services/coding_plan.rs:1819-1824 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/balance.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 6) src-tauri/src/services/mcp.rs:687— src-tauri/src/services/mcp.rs:687-693 | src-tauri/src/services/mcp.rs:725-731 | src-tauri/src/services/mcp.rs:763-769 | src-tauri/src/services/mcp.rs:797-802 | src-tauri/src/services/mcp.rs:827-833 | src-tauri/src/services/mcp.rs:865-871 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/mcp.rs:687` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 4) src-tauri/src/mcp/agy.rs:175— src-tauri/src/mcp/agy.rs:175-183 | src-tauri/src/mcp/kimi.rs:150-158 | src-tauri/src/mcp/mcode.rs:130-138 | src-tauri/src/mcp/pi.rs:347-355 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/agy.rs:175` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–5 lines × 3) src-tauri/src/commands/misc.rs:6256— src-tauri/src/commands/misc.rs:6256-6258 | src-tauri/src/commands/misc.rs:7056-7060 | src-tauri/src/commands/misc.rs:7092-7096 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/commands/misc.rs:7056` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 6) src-tauri/src/mcp/agy.rs:159— src-tauri/src/mcp/agy.rs:159-165 | src-tauri/src/mcp/copilot.rs:306-312 | src-tauri/src/mcp/kimi.rs:135-141 | src-tauri/src/mcp/mcode.rs:120-126 | src-tauri/src/mcp/pi.rs:323-329 | src-tauri/src/mcp/workbuddy.rs:168-174 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (48 lines × 2) REDACTED:1824— REDACTED:1824-1879 | REDACTED:2032-2079 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1824` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 5) src-tauri/src/proxy/forwarder.rs:1098— src-tauri/src/proxy/forwarder.rs:1098-1119 | src-tauri/src/proxy/forwarder.rs:1163-1182 | src-tauri/src/proxy/forwarder.rs:1238-1257 | src-tauri/src/proxy/forwarder.rs:1337-1356 | src-tauri/src/proxy/forwarder.rs:1421-1440 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/forwarder.rs:1098` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 7) src-tauri/src/mcp/agy.rs:144— src-tauri/src/mcp/agy.rs:144-157 | src-tauri/src/mcp/copilot.rs:291-304 | src-tauri/src/mcp/kimi.rs:120-133 | src-tauri/src/mcp/mcode.rs:105-118 | src-tauri/src/mcp/omp.rs:234-244 | src-tauri/src/mcp/pi.rs:308-321 | src-tauri/src/mcp/workbuddy.rs:152-165 — before extracting anything, compare `src-tauri/src/mcp/agy.rs` and `src-tauri/src/mcp/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp/agy.rs:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 15) src-tauri/src/services/balance.rs:84— src-tauri/src/services/balance.rs:84-92 | src-tauri/src/services/balance.rs:166-174 | src-tauri/src/services/balance.rs:231-239 | src-tauri/src/services/balance.rs:302-310 | src-tauri/src/services/balance.rs:378-386 | src-tauri/src/services/balance.rs:467-475 | src-tauri/src/services/coding_plan.rs:174-182 | src-tauri/src/services/coding_plan.rs:405-413 | src-tauri/src/services/coding_plan.rs:562-570 | src-tauri/src/services/coding_plan.rs:646-654 | src-tauri/src/services/coding_plan.rs:1800-1808 | REDACTED:461-470 | REDACTED:1475-1485 | REDACTED:1534-1544 | src-tauri/src/services/subscription_grok.rs:641-650 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/balance.rs:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1531` calls `json` and `src-tauri/src/services/coding_plan.rs:171` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 5) src-tauri/src/proxy/providers/claude.rs:651— src-tauri/src/proxy/providers/claude.rs:651-658 | src-tauri/src/proxy/providers/claude.rs:660-668 | src-tauri/src/proxy/providers/claude.rs:670-678 | src-tauri/src/proxy/providers/claude.rs:680-688 | src-tauri/src/proxy/providers/claude.rs:690-699 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/proxy/providers/claude.rs:651` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (5 lines × 13) src-tauri/src/services/balance.rs:102— src-tauri/src/services/balance.rs:102-106 | src-tauri/src/services/balance.rs:184-188 | src-tauri/src/services/balance.rs:249-253 | src-tauri/src/services/balance.rs:320-324 | src-tauri/src/services/balance.rs:396-400 | src-tauri/src/services/balance.rs:485-489 | src-tauri/src/services/coding_plan.rs:205-209 | src-tauri/src/services/coding_plan.rs:426-430 | src-tauri/src/services/coding_plan.rs:593-597 | src-tauri/src/services/coding_plan.rs:677-681 | src-tauri/src/services/coding_plan.rs:944-948 | src-tauri/src/services/coding_plan.rs:1819-1823 | REDACTED:484-493 — before extracting anything, compare `src-tauri/src/services/balance.rs` and `src-tauri/src/services/coding_plan.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/services/balance.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
End-of-life runtime: Rust 1.95 rust-toolchain.toml:1— rust-toolchain.toml declares Rust 1.95 as this project's toolchain file, and Rust 1.95, superseded by 1.96 on 2026-05-28 (the Rust project patches only the current stable). An unsupported runtime receives no security patches, so every vulnerability disclosed in it since 2026-05-28 is present and unfixable without moving off it. This is a migration rather than an upgrade: there is no newer release of a runtime that has ended.
Low cohesion: MultiAppConfig (LCOM4 4) src-tauri/src/app_config.rs:711— MultiAppConfig's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the repository root runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
Duplication concentrated across 15 sibling directories (63 clone groups) src/components/mcp/UnifiedMcpPanel.tsx:447— 63 duplicated blocks under src/components/ have copies in at least two of the sibling directories apps, hermes, mcp, openclaw, profiles, prompts (+9 more sibling(s) not listed) — 30 of them are reported below, and 33 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 63 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 63 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 63 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 6 sibling directories (15 clone groups) src/config/appConfig.tsx:202— 15 duplicated blocks under src/ have copies in at least two of the sibling directories components, config, hooks, lib, tray-panel, utils — 8 of them are reported below, and 7 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 15 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 15 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 15 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (343 matched lines × 2 locations) · ×1
Duplicated block with local edits (343 matched lines × 2 locations) src/components/providers/forms/KimiProviderForm.tsx:98— src/components/providers/forms/KimiProviderForm.tsx:98 · src/components/providers/forms/WorkBuddyProviderForm.tsx:57 — the two spans are one implementation copied and then locally edited — 1786 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (331 matched lines × 2 locations) · ×1
Duplicated block with local edits (331 matched lines × 2 locations) src/components/providers/forms/HermesFormFields.tsx:36— src/components/providers/forms/HermesFormFields.tsx:36 · src/components/providers/forms/OpenClawFormFields.tsx:32 — the two spans are one implementation copied and then locally edited — 1753 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (178 matched lines × 2 locations) · ×1
Duplicated block with local edits (178 matched lines × 2 locations) src/components/usage/ModelsDevAutoSyncPanel.tsx:105— src/components/usage/ModelsDevAutoSyncPanel.tsx:105 · src/components/usage/ModelsDevPickerDialog.tsx:73 — the two spans are one implementation copied and then locally edited — 990 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (165 matched lines × 2 locations) · ×1
Duplicated block with local edits (165 matched lines × 2 locations) src/components/providers/forms/CodexOAuthSection.tsx:133— src/components/providers/forms/CodexOAuthSection.tsx:133 · src/components/providers/forms/CopilotAuthSection.tsx:121 — the two spans are one implementation copied and then locally edited — 733 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (120 matched lines × 2 locations) · ×1
Duplicated block with local edits (120 matched lines × 2 locations) src/components/prompts/PiPromptPanel.tsx:171— src/components/prompts/PiPromptPanel.tsx:171 · src/components/prompts/PromptPanel.tsx:244 — the two spans are one implementation copied and then locally edited — 729 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (99 matched lines × 2 locations) · ×1
Duplicated block with local edits (99 matched lines × 2 locations) src/components/providers/forms/AgyOAuthSection.tsx:58— src/components/providers/forms/AgyOAuthSection.tsx:58 · src/components/providers/forms/ClaudeOfficialSection.tsx:179 — the two spans are one implementation copied and then locally edited — 527 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (89 matched lines × 2 locations) · ×1
Duplicated block with local edits (89 matched lines × 2 locations) src/components/settings/WebdavSyncSection.tsx:1105— src/components/settings/WebdavSyncSection.tsx:1105 · src/components/settings/WebdavSyncSection.tsx:1301 — the two spans are one implementation copied and then locally edited — 413 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (82 matched lines × 2 locations) · ×1
Duplicated block with local edits (82 matched lines × 2 locations) src/components/providers/forms/hooks/useHermesFormState.ts:77— src/components/providers/forms/hooks/useHermesFormState.ts:77 · src/components/providers/forms/hooks/useOpenclawFormState.ts:61 — the two spans are one implementation copied and then locally edited — 531 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (80 identical lines × 2 files) src/components/usage/ModelStatsTable.tsx:1— src/components/usage/ModelStatsTable.tsx:1 · src/components/usage/ProviderStatsTable.tsx:1 — these 2 files are line-for-line copies of one another — 80 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Duplicated block (58 lines × 2 locations) src/components/settings/WebdavSyncSection.tsx:1218— src/components/settings/WebdavSyncSection.tsx:1218 · src/components/settings/WebdavSyncSection.tsx:1525 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (56 matched lines × 2 locations) · ×1
Duplicated block with local edits (56 matched lines × 2 locations) src/components/providers/forms/ClaudeFormFields.tsx:951— src/components/providers/forms/ClaudeFormFields.tsx:951 · src/components/providers/forms/CodexFormFields.tsx:1625 — the two spans are one implementation copied and then locally edited — 233 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (55 matched lines × 2 locations) · ×1
Duplicated block with local edits (55 matched lines × 2 locations) src/components/providers/forms/CopilotProviderForm.tsx:744— src/components/providers/forms/CopilotProviderForm.tsx:744 · src/components/providers/forms/WorkBuddyProviderForm.tsx:624 — the two spans are one implementation copied and then locally edited — 282 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (52 matched lines × 2 locations) · ×1
Duplicated block with local edits (52 matched lines × 2 locations) src/components/providers/forms/RequestHeadersEditor.tsx:36— src/components/providers/forms/RequestHeadersEditor.tsx:36 · src/components/providers/forms/StructuredOptionsEditor.tsx:63 — the two spans are one implementation copied and then locally edited — 284 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (51 matched lines × 2 locations) · ×1
Duplicated block with local edits (51 matched lines × 2 locations) src/components/sessions/reader/SessionFinalReply.tsx:74— src/components/sessions/reader/SessionFinalReply.tsx:74 · src/components/sessions/reader/SessionQuestion.tsx:74 — the two spans are one implementation copied and then locally edited — 244 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (48 matched lines × 2 locations) · ×1
Duplicated block with local edits (48 matched lines × 2 locations) src/components/workspace/DailyMemoryPanel.tsx:439— src/components/workspace/DailyMemoryPanel.tsx:439 · src/components/workspace/DailyMemoryPanel.tsx:497 — the two spans are one implementation copied and then locally edited — 242 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (46 lines × 2 locations) REDACTED:748— REDACTED:748 · REDACTED:974 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (45 matched lines × 2 locations) · ×1
Duplicated block with local edits (45 matched lines × 2 locations) src/components/prompts/PiNativePromptResources.tsx:664— src/components/prompts/PiNativePromptResources.tsx:664 · src/components/prompts/PromptFormPanel.tsx:187 — the two spans are one implementation copied and then locally edited — 226 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (43 lines × 2 locations) src/lib/query/mutations.ts:111— src/lib/query/mutations.ts:111 · src/lib/query/mutations.ts:266 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (42 lines × 2 locations) src/components/providers/forms/KimiProviderForm.tsx:436— src/components/providers/forms/KimiProviderForm.tsx:436 · src/components/providers/forms/McodeProviderForm.tsx:227 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (41 lines × 2 locations) src/components/openclaw/ToolsPanel.tsx:181— src/components/openclaw/ToolsPanel.tsx:181 · src/components/openclaw/ToolsPanel.tsx:223 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (41 matched lines × 2 locations) · ×1
Duplicated block with local edits (41 matched lines × 2 locations) src/components/providers/forms/CodexOAuthSection.tsx:434— src/components/providers/forms/CodexOAuthSection.tsx:434 · src/components/providers/forms/XaiOAuthSection.tsx:159 — the two spans are one implementation copied and then locally edited — 189 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (40 lines × 2 locations) src/components/UsageScriptModal.tsx:1433— src/components/UsageScriptModal.tsx:1433 · src/components/UsageScriptModal.tsx:1524 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (38 lines × 2 locations) src/config/piProviderPresets.ts:147— src/config/piProviderPresets.ts:147 · src/config/piProviderPresets.ts:205 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
Duplicated block (37 lines × 2 locations) src/components/mcp/UnifiedMcpPanel.tsx:447— src/components/mcp/UnifiedMcpPanel.tsx:447 · src/components/skills/UnifiedSkillsPanel.tsx:472 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (36 lines × 2 locations) src/config/piProviderPresets.ts:3106— src/config/piProviderPresets.ts:3106 · src/config/piProviderPresets.ts:3179 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
Complex function ProviderFormFull (cyclomatic 181, cognitive 157) src/components/providers/forms/ProviderForm.tsx:379— ProviderFormFull has cyclomatic complexity 181 and cognitive complexity 157; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function performSubmit (cyclomatic 156, cognitive 170) src/components/providers/forms/ProviderForm.tsx:1779— performSubmit has cyclomatic complexity 156 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ProviderCard (cyclomatic 135, cognitive 118) src/components/providers/ProviderCard.tsx:220— ProviderCard has cyclomatic complexity 135 and cognitive complexity 118; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function CodexFormFields (cyclomatic 127, cognitive 98) src/components/providers/forms/CodexFormFields.tsx:637— CodexFormFields has cyclomatic complexity 127 and cognitive complexity 98; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ClaudeFormFields (cyclomatic 92, cognitive 62) src/components/providers/forms/ClaudeFormFields.tsx:196— ClaudeFormFields has cyclomatic complexity 92 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleSubmit (cyclomatic 89, cognitive 124) src/components/providers/forms/ProviderForm.tsx:1375— handleSubmit has cyclomatic complexity 89 and cognitive complexity 124; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function DeepLinkImportDialog (cyclomatic 87, cognitive 67) src/components/DeepLinkImportDialog.tsx:86— DeepLinkImportDialog has cyclomatic complexity 87 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function UsageScriptModal (cyclomatic 75, cognitive 67) src/components/UsageScriptModal.tsx:253— UsageScriptModal has cyclomatic complexity 75 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 74, cognitive 113) src/components/providers/AddProviderDialog.tsx:254— (anonymous) has cyclomatic complexity 74 and cognitive complexity 113; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function CopilotProviderForm (cyclomatic 63, cognitive 56) src/components/providers/forms/CopilotProviderForm.tsx:283— CopilotProviderForm has cyclomatic complexity 63 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ToolRow (cyclomatic 62, cognitive 56) src/components/apps/AppsPage.tsx:736— ToolRow has cyclomatic complexity 62 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildAdditiveSections (cyclomatic 61, cognitive 135) src/components/providers/presentation.ts:800— buildAdditiveSections has cyclomatic complexity 61 and cognitive complexity 135; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SwitchModePanel (cyclomatic 61, cognitive 56) src/components/providers/mode/SwitchModePanel.tsx:102— SwitchModePanel has cyclomatic complexity 61 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function UnifiedSkillsPanel (cyclomatic 61, cognitive 46) src/components/skills/UnifiedSkillsPanel.tsx:129— UnifiedSkillsPanel has cyclomatic complexity 61 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function McodeProviderForm (cyclomatic 59, cognitive 50) src/components/providers/forms/McodeProviderForm.tsx:83— McodeProviderForm has cyclomatic complexity 59 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handlePresetChange (cyclomatic 58, cognitive 71) src/components/providers/forms/ProviderForm.tsx:2298— handlePresetChange has cyclomatic complexity 58 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function WebdavSyncSection (cyclomatic 56, cognitive 48) src/components/settings/WebdavSyncSection.tsx:236— WebdavSyncSection has cyclomatic complexity 56 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function KimiProviderForm (cyclomatic 56, cognitive 47) src/components/providers/forms/KimiProviderForm.tsx:111— KimiProviderForm has cyclomatic complexity 56 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ProviderList (cyclomatic 55, cognitive 52) src/components/providers/ProviderList.tsx:111— ProviderList has cyclomatic complexity 55 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SessionItem (cyclomatic 54, cognitive 46) src/components/sessions/SessionItem.tsx:85— SessionItem has cyclomatic complexity 54 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function CodexOAuthSection (cyclomatic 54, cognitive 45) src/components/providers/forms/CodexOAuthSection.tsx:78— CodexOAuthSection has cyclomatic complexity 54 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function WorkBuddyProviderForm (cyclomatic 50, cognitive 41) src/components/providers/forms/WorkBuddyProviderForm.tsx:129— WorkBuddyProviderForm has cyclomatic complexity 50 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleSubmit (cyclomatic 49, cognitive 59) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:718— handleSubmit has cyclomatic complexity 49 and cognitive complexity 59; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleTest (cyclomatic 47, cognitive 72) src/components/UsageScriptModal.tsx:617— handleTest has cyclomatic complexity 47 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function renderRow (cyclomatic 47, cognitive 45) src/components/usage/RequestLogTable.tsx:371— renderRow has cyclomatic complexity 47 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseDeepLinkConfigPreview (cyclomatic 46, cognitive 67) src/utils/deepLinkConfigPreview.ts:44— parseDeepLinkConfigPreview has cyclomatic complexity 46 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SessionManagerPage (cyclomatic 46, cognitive 42) src/components/sessions/SessionManagerPage.tsx:152— SessionManagerPage has cyclomatic complexity 46 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function McpFormModal (cyclomatic 45, cognitive 43) src/components/mcp/McpFormModal.tsx:127— McpFormModal has cyclomatic complexity 45 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ClaudeDesktopProviderForm (cyclomatic 45, cognitive 42) src/components/providers/forms/ClaudeDesktopProviderForm.tsx:254— ClaudeDesktopProviderForm has cyclomatic complexity 45 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function PiPromptPanel (cyclomatic 45, cognitive 38) src/components/prompts/PiPromptPanel.tsx:54— PiPromptPanel has cyclomatic complexity 45 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 44, cognitive 26) src/components/sessions/reader/SessionMarkdown.tsx:936— (anonymous) has cyclomatic complexity 44 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SessionReader (cyclomatic 42, cognitive 38) src/components/sessions/reader/SessionReader.tsx:161— SessionReader has cyclomatic complexity 42 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function UnifiedMcpPanel (cyclomatic 42, cognitive 33) src/components/mcp/UnifiedMcpPanel.tsx:148— UnifiedMcpPanel has cyclomatic complexity 42 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 39, cognitive 105) src/components/providers/forms/hooks/useOmoModelSource.ts:117— (anonymous) has cyclomatic complexity 39 and cognitive complexity 105; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function PiProviderForm (cyclomatic 39, cognitive 34) REDACTED:507— PiProviderForm has cyclomatic complexity 39 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function load (cyclomatic 38, cognitive 48) src/components/providers/EditProviderDialog.tsx:139— load has cyclomatic complexity 38 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function BlockText (cyclomatic 37, cognitive 27) src/components/sessions/reader/SessionStepDetails.tsx:73— BlockText has cyclomatic complexity 37 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function App (cyclomatic 36, cognitive 30) src/App.tsx:228— App has cyclomatic complexity 36 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 35, cognitive 44) src/components/sessions/reader/turns.ts:368— (anonymous) has cyclomatic complexity 35 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function submit (cyclomatic 35, cognitive 39) REDACTED:1358— submit has cyclomatic complexity 35 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· src/config/openclawProviderPresets.ts · ×1
src/config/openclawProviderPresets.ts: 7430 lines of code src/config/openclawProviderPresets.ts:1— src/config/openclawProviderPresets.ts has 7430 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/codexProviderPresets.ts · ×1
src/config/codexProviderPresets.ts: 5113 lines of code src/config/codexProviderPresets.ts:1— src/config/codexProviderPresets.ts has 5113 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/opencodeProviderPresets.ts · ×1
src/config/opencodeProviderPresets.ts: 4922 lines of code src/config/opencodeProviderPresets.ts:1— src/config/opencodeProviderPresets.ts has 4922 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/hermesProviderPresets.ts · ×1
src/config/hermesProviderPresets.ts: 4122 lines of code src/config/hermesProviderPresets.ts:1— src/config/hermesProviderPresets.ts has 4122 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/piProviderPresets.ts · ×1
src/config/piProviderPresets.ts: 3507 lines of code src/config/piProviderPresets.ts:1— src/config/piProviderPresets.ts has 3507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/claudeProviderPresets.ts · ×1
src/config/claudeProviderPresets.ts: 3237 lines of code src/config/claudeProviderPresets.ts:1— src/config/claudeProviderPresets.ts has 3237 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/ProviderForm.tsx · ×1
src/components/providers/forms/ProviderForm.tsx: 3104 lines of code src/components/providers/forms/ProviderForm.tsx:1— src/components/providers/forms/ProviderForm.tsx has 3104 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/claudeDesktopProviderPresets.ts · ×1
src/config/claudeDesktopProviderPresets.ts: 2600 lines of code src/config/claudeDesktopProviderPresets.ts:1— src/config/claudeDesktopProviderPresets.ts has 2600 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/CodexFormFields.tsx · ×1
src/components/providers/forms/CodexFormFields.tsx: 2439 lines of code src/components/providers/forms/CodexFormFields.tsx:1— src/components/providers/forms/CodexFormFields.tsx has 2439 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 2283 lines of code REDACTED:1— REDACTED has 2283 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/skills/UnifiedSkillsPanel.tsx · ×1
src/components/skills/UnifiedSkillsPanel.tsx: 2059 lines of code src/components/skills/UnifiedSkillsPanel.tsx:1— src/components/skills/UnifiedSkillsPanel.tsx has 2059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/App.tsx: 1969 lines of code src/App.tsx:1— src/App.tsx has 1969 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/settings/WebdavSyncSection.tsx · ×1
src/components/settings/WebdavSyncSection.tsx: 1808 lines of code src/components/settings/WebdavSyncSection.tsx:1— src/components/settings/WebdavSyncSection.tsx has 1808 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/UsageScriptModal.tsx · ×1
src/components/UsageScriptModal.tsx: 1691 lines of code src/components/UsageScriptModal.tsx:1— src/components/UsageScriptModal.tsx has 1691 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1636 lines of code REDACTED:1— REDACTED has 1636 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/sessions/SessionManagerPage.tsx · ×1
src/components/sessions/SessionManagerPage.tsx: 1591 lines of code src/components/sessions/SessionManagerPage.tsx:1— src/components/sessions/SessionManagerPage.tsx has 1591 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/ClaudeDesktopProviderForm.tsx · ×1
src/components/providers/forms/ClaudeDesktopProviderForm.tsx: 1440 lines of code src/components/providers/forms/ClaudeDesktopProviderForm.tsx:1— src/components/providers/forms/ClaudeDesktopProviderForm.tsx has 1440 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/mcp/McpFormModal.tsx · ×1
src/components/mcp/McpFormModal.tsx: 1399 lines of code src/components/mcp/McpFormModal.tsx:1— src/components/mcp/McpFormModal.tsx has 1399 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/ClaudeFormFields.tsx · ×1
src/components/providers/forms/ClaudeFormFields.tsx: 1301 lines of code src/components/providers/forms/ClaudeFormFields.tsx:1— src/components/providers/forms/ClaudeFormFields.tsx has 1301 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/OmoFormFields.tsx · ×1
src/components/providers/forms/OmoFormFields.tsx: 1259 lines of code src/components/providers/forms/OmoFormFields.tsx:1— src/components/providers/forms/OmoFormFields.tsx has 1259 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/icons/extracted/metadata.ts · ×1
src/icons/extracted/metadata.ts: 1238 lines of code src/icons/extracted/metadata.ts:1— src/icons/extracted/metadata.ts has 1238 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/OpenCodeFormFields.tsx · ×1
src/components/providers/forms/OpenCodeFormFields.tsx: 1202 lines of code src/components/providers/forms/OpenCodeFormFields.tsx:1— src/components/providers/forms/OpenCodeFormFields.tsx has 1202 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/mcp/UnifiedMcpPanel.tsx · ×1
src/components/mcp/UnifiedMcpPanel.tsx: 1188 lines of code src/components/mcp/UnifiedMcpPanel.tsx:1— src/components/mcp/UnifiedMcpPanel.tsx has 1188 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/tray-panel/TrayPanel.tsx · ×1
src/tray-panel/TrayPanel.tsx: 1152 lines of code src/tray-panel/TrayPanel.tsx:1— src/tray-panel/TrayPanel.tsx has 1152 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/geminiProviderPresets.ts · ×1
src/config/geminiProviderPresets.ts: 1104 lines of code src/config/geminiProviderPresets.ts:1— src/config/geminiProviderPresets.ts has 1104 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/presentation.ts · ×1
src/components/providers/presentation.ts: 1094 lines of code src/components/providers/presentation.ts:1— src/components/providers/presentation.ts has 1094 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/apps/useToolManagement.ts · ×1
src/components/apps/useToolManagement.ts: 1088 lines of code src/components/apps/useToolManagement.ts:1— src/components/apps/useToolManagement.ts has 1088 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/CopilotProviderForm.tsx · ×1
src/components/providers/forms/CopilotProviderForm.tsx: 1072 lines of code src/components/providers/forms/CopilotProviderForm.tsx:1— src/components/providers/forms/CopilotProviderForm.tsx has 1072 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/apps/AppsPage.tsx · ×1
src/components/apps/AppsPage.tsx: 1042 lines of code src/components/apps/AppsPage.tsx:1— src/components/apps/AppsPage.tsx has 1042 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/sessions/reader/SessionMarkdown.tsx · ×1
src/components/sessions/reader/SessionMarkdown.tsx: 1036 lines of code src/components/sessions/reader/SessionMarkdown.tsx:1— src/components/sessions/reader/SessionMarkdown.tsx has 1036 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/sessions/reader/turns.ts · ×1
src/components/sessions/reader/turns.ts: 1022 lines of code src/components/sessions/reader/turns.ts:1— src/components/sessions/reader/turns.ts has 1022 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/skills/SkillsPage.tsx · ×1
src/components/skills/SkillsPage.tsx: 1022 lines of code src/components/skills/SkillsPage.tsx:1— src/components/skills/SkillsPage.tsx has 1022 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/prompts/PiNativePromptResources.tsx · ×1
src/components/prompts/PiNativePromptResources.tsx: 1007 lines of code src/components/prompts/PiNativePromptResources.tsx:1— src/components/prompts/PiNativePromptResources.tsx has 1007 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/types.ts: 994 lines of code src/types.ts:1— src/types.ts has 994 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/usage/UsageDashboard.tsx · ×1
src/components/usage/UsageDashboard.tsx: 984 lines of code src/components/usage/UsageDashboard.tsx:1— src/components/usage/UsageDashboard.tsx has 984 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/DeepLinkImportDialog.tsx · ×1
src/components/DeepLinkImportDialog.tsx: 981 lines of code src/components/DeepLinkImportDialog.tsx:1— src/components/DeepLinkImportDialog.tsx has 981 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/piModelCatalog.ts · ×1
src/config/piModelCatalog.ts: 938 lines of code src/config/piModelCatalog.ts:1— src/config/piModelCatalog.ts has 938 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/KimiProviderForm.tsx · ×1
src/components/providers/forms/KimiProviderForm.tsx: 884 lines of code src/components/providers/forms/KimiProviderForm.tsx:1— src/components/providers/forms/KimiProviderForm.tsx has 884 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/components/providers/forms/ProviderPresetSelector.tsx · ×1
src/components/providers/forms/ProviderPresetSelector.tsx: 879 lines of code src/components/providers/forms/ProviderPresetSelector.tsx:1— src/components/providers/forms/ProviderPresetSelector.tsx has 879 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/config/grokBuildProviderPresets.ts · ×1
src/config/grokBuildProviderPresets.ts: 837 lines of code src/config/grokBuildProviderPresets.ts:1— src/config/grokBuildProviderPresets.ts has 837 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Blocking `thread::sleep` inside an `async` body src-tauri/src/services/kimi_oauth/lock.rs:196— This `async` body is polled on an executor's worker thread, and `std::thread::sleep` blocks that thread: for the whole delay no other task scheduled on it makes progress — the Rust form of blocking on a task. Use `tokio::time::sleep(…).await` (or the runtime's own timer), which suspends only this task. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the executor with `tokio::task::spawn_blocking(…).await`.
X14 · Bypassable address classification· IP classification is bypassable through an IPv4-in-IPv6 embedding · ×1
IP classification is bypassable through an IPv4-in-IPv6 embedding REDACTED:168— This function unwraps IPv4-MAPPED IPv6 (`::ffff: (in `extractIpv4Octets`)`, line 130) and rejects `10.0.0.0/8` on its IPv4 path, and it handles some IPv4-in-IPv6 embeddings — but not IPv4-compatible (`::a.b.c.d`) and 6to4 (`2002::/16`): either it never names it, or it names it and returns the verdict its IPv4 path gives public space. So `::10.0.0.1`, `2002:0a00:0001::` name a host inside `10.0.0.0/8`, the range this same function declares non-public, and reach the IPv6 decision at line 168 with the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright.
X2 · Cancellation propagation· Async function without AbortSignal · ×1
Async function without AbortSignal: copyImage src/components/sessions/reader/SessionImageLightbox.tsx:30— `copyImage` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Mock-dominated test: uses the web clipboard first on Linux (#9384) tests/lib/clipboard.test.ts:44— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: falls back to the native command on Linux when the web clipboard fails tests/lib/clipboard.test.ts:51— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: 连续切换预设时只认最后一次投影 tests/hooks/useDraftEditorProjection.test.tsx:44— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: 投影失败时提示并保持没有底 tests/hooks/useDraftEditorProjection.test.tsx:96— This test sets up 4 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: 作废后迟到的投影不再生效 tests/hooks/useDraftEditorProjection.test.tsx:119— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: discards a pending Copilot projection after a form lifecycle %s tests/hooks/useDraftEditorProjection.test.tsx:149— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should call API and invalidate query cache after successful drag tests/hooks/useDragSort.test.tsx:121— This test sets up 4 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should show error toast when drag operation fails tests/hooks/useDragSort.test.tsx:153— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: propagates export success message to toast with saved path tests/hooks/useImportExport.extra.test.tsx:108— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should export successfully with default filename and show path in toast tests/hooks/useImportExport.test.tsx:160— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should show error message when export fails tests/hooks/useImportExport.test.tsx:181— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should catch and show error when export throws exception tests/hooks/useImportExport.test.tsx:199— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should show error and return when user cancels save dialog during export tests/hooks/useImportExport.test.tsx:214— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should not request plugin sync when switching non-Claude provider tests/hooks/useProviderActions.test.tsx:185— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should sync plugin config when switching Claude provider with integration enabled tests/hooks/useProviderActions.test.tsx:583— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should not call applyClaudePluginConfig when integration is disabled tests/hooks/useProviderActions.test.tsx:605— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should show error toast when plugin sync fails with error message tests/hooks/useProviderActions.test.tsx:625— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should use default error message when plugin sync fails without error message tests/hooks/useProviderActions.test.tsx:662— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: should update provider and refresh cache when saveUsageScript succeeds tests/hooks/useProviderActions.test.tsx:714— This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: handles switch mutation errors silently tests/hooks/useProviderActions.test.tsx:868— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: auto-saves and applies Claude onboarding skip when toggled on tests/hooks/useSettings.test.tsx:204— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: auto-saves and clears Claude onboarding skip when toggled off tests/hooks/useSettings.test.tsx:232— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: shows toast when Claude plugin sync fails but continues flow tests/hooks/useSettings.test.tsx:417— This test sets up 5 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: detects plugin toggle via live cache even when closure data is stale tests/hooks/useSettings.test.tsx:454— This test sets up 6 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: resets form, language and directories using server data tests/hooks/useSettings.test.tsx:495— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Duplicated predicate src/components/prompts/PiPromptPanel.tsx:193— `!(key in before) && key.startsWith("backup-")` appears character-identically in 2 files — src/components/prompts/PiPromptPanel.tsx, src/components/prompts/PromptPanel.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/UsageScriptModal.tsx:215— `!baseUrl || (typeof baseUrl === "string" && baseUrl.trim() === "")` appears character-identically in 2 files — src/components/UsageScriptModal.tsx, src/components/providers/ProviderCard.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/UsageScriptModal.tsx:224— `!bearerToken && (!apiKey || (typeof apiKey === "string" && apiKey.trim() === ""))` appears character-identically in 2 files — src/components/UsageScriptModal.tsx, src/components/providers/ProviderCard.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/McodeProviderForm.tsx:160— `!isEdit && providerKey !== "" && !KEY_PATTERN.test(providerKey)` appears character-identically in 2 files — src/components/providers/forms/McodeProviderForm.tsx, src/components/providers/forms/WorkBuddyProviderForm.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/openclaw/utils.ts:29— `!parsed || typeof parsed !== "object" || Array.isArray(parsed)` appears character-identically in 5 files — src/components/openclaw/utils.ts, src/components/providers/forms/hooks/useCodexConfigState.ts, src/components/providers/forms/hooks/useOpenclawFormState.ts, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/lib/modelMetadata.ts:187— `!provider || typeof provider !== "object"` appears character-identically in 2 files — src/lib/modelMetadata.ts, src/lib/modelsDevPricing.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/config/hermesProviderPresets.ts:23— `!settingsConfig || typeof settingsConfig !== "object"` appears character-identically in 2 files — src/config/hermesProviderPresets.ts, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/ClaudeDesktopProviderForm.tsx:139— `!value || typeof value !== "object" || Array.isArray(value)` appears character-identically in 2 files — src/components/providers/forms/ClaudeDesktopProviderForm.tsx, src/config/piThinkingProfiles.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/UsageScriptModal.tsx:233— `(!apiKey || (typeof apiKey === "string" && apiKey.trim() === "")) && (!baseUrl || (typeof baseUrl === "string" && baseUrl.trim() === ""))` appears character-identically in 2 files — src/components/UsageScriptModal.tsx, src/components/providers/ProviderCard.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/usage/ModelsDevAutoSyncPanel.tsx:124— `(providerFilter === "all" || entry.providerId === providerFilter) && (!query || entry.modelId.toLowerCase().includes(query) || entry.normali…` appears character-identically in 2 files — src/components/usage/ModelsDevAutoSyncPanel.tsx, src/components/usage/ModelsDevPickerDialog.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/KimiProviderForm.tsx:288— `Boolean(apiKey) || Object.keys(requestHeaders).length > 0` appears character-identically in 3 files — src/components/providers/forms/KimiProviderForm.tsx, src/components/providers/forms/OpenCodeFormFields.tsx, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/CopilotProviderForm.tsx:178— `Boolean(value) && typeof value === "object" && !Array.isArray(value)` appears character-identically in 2 files — src/components/providers/forms/CopilotProviderForm.tsx, src/config/copilotConfig.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/usage/RequestLogTable.tsx:74— `a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()` appears character-identically in 2 files — src/components/usage/RequestLogTable.tsx, src/components/usage/UsageDateRangePicker.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/ClaudeDesktopProviderForm.tsx:783— `account.id === accountId && !account.requires_reauth` appears character-identically in 2 files — src/components/providers/forms/ClaudeDesktopProviderForm.tsx, src/components/providers/forms/ProviderForm.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/ClaudeDesktopProviderForm.tsx:776— `account.id === effectiveAccountId && !account.reauth_required` appears character-identically in 2 files — src/components/providers/forms/ClaudeDesktopProviderForm.tsx, src/components/providers/forms/ProviderForm.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/ClaudeDesktopProviderForm.tsx:1240— `apiFormat === "openai_chat" || apiFormat === "openai_responses"` appears character-identically in 2 files — src/components/providers/forms/ClaudeDesktopProviderForm.tsx, src/components/providers/forms/ClaudeFormFields.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/ClaudeFormFields.tsx:979— `category !== "official" && category !== "cloud_provider"` appears character-identically in 3 files — src/components/providers/forms/ClaudeFormFields.tsx, src/components/providers/forms/ProviderForm.tsx, src/components/providers/forms/hooks/useApiKeyState.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/App.tsx:1059— `event.key !== "Escape" || event.defaultPrevented` appears character-identically in 3 files — src/App.tsx, src/components/sessions/SessionManagerPage.tsx, src/components/skills/UnifiedSkillsPanel.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/apps/useToolManagement.ts:870— `extractErrorMessage(error) || String(error)` appears character-identically in 7 files — src/components/apps/useToolManagement.ts, src/components/mcp/UnifiedMcpPanel.tsx, src/components/providers/forms/WorkBuddyOfficialSection.tsx, src/components/providers/useWorkBuddyOfficial.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/App.tsx:466— `extractErrorMessage(error) || t("common.unknown")` appears character-identically in 6 files — src/App.tsx, src/components/prompts/promptUtils.tsx, src/components/providers/mode/SwitchModePanel.tsx, src/lib/query/failover.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/mcp/UnifiedMcpPanel.tsx:757— `extractErrorMessage(loadError) || String(loadError)` appears character-identically in 2 files — src/components/mcp/UnifiedMcpPanel.tsx, src/components/skills/UnifiedSkillsPanel.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/usage/RequestLogTable.tsx:332— `i18n.resolvedLanguage || i18n.language || "en"` appears character-identically in 9 files — src/components/usage/RequestLogTable.tsx, src/components/usage/TablePagination.tsx, src/components/usage/UsageDashboard.tsx, src/components/usage/UsageDateRangePicker.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/ClaudeOfficialSection.tsx:440— `index < accounts.length - 1 || onManageAccounts` appears character-identically in 2 files — src/components/providers/forms/ClaudeOfficialSection.tsx, src/components/providers/forms/CodexOAuthSection.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/providers/forms/KimiProviderForm.tsx:144— `isAccountLogin && (!step || step.step === "form")` appears character-identically in 2 files — src/components/providers/forms/KimiProviderForm.tsx, src/components/providers/forms/McodeProviderForm.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate src/components/UsageScriptModal.tsx:417— `isBoundCodexOfficial || Boolean(claudeBoundAccountId)` appears character-identically in 2 files — src/components/UsageScriptModal.tsx, src/components/providers/ProviderCard.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default on Err src-tauri/src/session_manager/search.rs:453— `search` turns every `Err` into `"[]".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/codex_history_migration.rs:999— `trusted_legacy_codex_model_provider_ids_from_config` turns every `Err` into `BTreeSet::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/mode/stack.rs:399— `desktop_models` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/proxy/providers/transform_codex_chat.rs:2507— `chat_error_to_response_error` turns every `Err` into `"Upstream error".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/proxy/tool_media.rs:348— `strip_media_from_tool_value_at_depth` turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/backup_storage.rs:155— `matched_files` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/provider/codex_editor.rs:254— `inactive_fields` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/provider/codex_official_models.rs:221— `split` (in `compare_versions`) turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/provider/grok_editor.rs:129— `inactive_fields` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/provider/icon.rs:147— `strip_invalid_universal_icons` turns every `Err` into `Ok(0)` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/provider/icon.rs:193— `strip_invalid_library_icons` turns every `Err` into `Ok(0)` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/session_usage_agy/native_models.rs:136— `native_state_fingerprint` turns every `Err` into `"none".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err REDACTED:1004— `parse_codex_reset_credits` turns every `Err` into `Some(None)` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/workbuddy_account/mod.rs:1146— `ps_lines` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/services/workbuddy_account/quota.rs:702— `summary_package_codes` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src-tauri/src/session_manager/providers/hermes.rs:239— `edge_messages` turns every `Err` into `HashMap::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Subsumed condition operand src-tauri/tests/import_export_sync.rs:777— `context.contains("原子写入失败")` can never decide this `||` — every value satisfying `context.contains("原子写入失败")` also satisfies `context.contains("写入失败")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/services/coding_plan.rs:36— `url.contains("open.bigmodel.cn")` can never decide this `||` — every value satisfying `url.contains("open.bigmodel.cn")` also satisfies `url.contains("bigmodel.cn")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/services/coding_plan.rs:1319— `c.contains("accessdenied")` can never decide this `||` — every value satisfying `c.contains("accessdenied")` also satisfies `c.contains("denied")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:94— `path.ends_with("/v1beta/openai/chat/completions")` can never decide this `||` — every value satisfying `path.ends_with("/v1beta/openai/chat/completions")` also satisfies `path.ends_with("/openai/chat/completions")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:95— `path.ends_with("/v1beta/openai/responses")` can never decide this `||` — every value satisfying `path.ends_with("/v1beta/openai/responses")` also satisfies `path.ends_with("/openai/responses")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:98— `path.ends_with("/v1/openai/chat/completions")` can never decide this `||` — every value satisfying `path.ends_with("/v1/openai/chat/completions")` also satisfies `path.ends_with("/openai/chat/completions")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:99— `path.ends_with("/v1/openai/responses")` can never decide this `||` — every value satisfying `path.ends_with("/v1/openai/responses")` also satisfies `path.ends_with("/openai/responses")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:112— `path.ends_with("/v1beta/models")` can never decide this `||` — every value satisfying `path.ends_with("/v1beta/models")` also satisfies `path.ends_with("/models")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:113— `path.ends_with("/v1beta/openai")` can never decide this `||` — every value satisfying `path.ends_with("/v1beta/openai")` also satisfies `path.ends_with("/openai")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:115— `path.ends_with("/v1/models")` can never decide this `||` — every value satisfying `path.ends_with("/v1/models")` also satisfies `path.ends_with("/models")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/gemini_url.rs:117— `path.ends_with("/v1/openai")` can never decide this `||` — every value satisfying `path.ends_with("/v1/openai")` also satisfies `path.ends_with("/openai")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/thinking_rectifier.rs:73— `lower.contains("redacted_thinking")` can never decide this `||` — every value satisfying `lower.contains("redacted_thinking")` also satisfies `lower.contains("thinking")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand src-tauri/src/proxy/thinking_rectifier.rs:94— `lower.contains("redacted_thinking")` can never decide this `||` — every value satisfying `lower.contains("redacted_thinking")` also satisfies `lower.contains("thinking")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Silent fallback default in catch src/components/providers/OpenTerminalDialog.tsx:42— `readRecent` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/components/providers/OpenTerminalDialog.tsx:75— `readExtraArgs` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/components/providers/forms/presetGroups.ts:71— `presetDomain` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/components/providers/forms/hooks/useBaseUrlState.ts:29— `readEnvUrl` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/components/providers/forms/hooks/useCodexConfigState.ts:205— `useCodexConfigState.getCodexAuthApiKey` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/lib/updater.ts:20— `getCurrentVersion` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/lib/navigation.ts:107— `readStoredView` swallows every exception into `return "providers"` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:84— `getApiKeyFromConfig` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch tests/msw/handlers.ts:43— `withJson` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Unused export 'default' src/components/DatabaseUpgrade.tsx:301— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' src/components/providers/forms/AgyOAuthSection.tsx:176— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' src/components/providers/forms/ClaudeOfficialSection.tsx:340— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' src/components/providers/forms/CodexOAuthSection.tsx:540— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' src/components/providers/forms/CopilotAuthSection.tsx:508— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' src/components/providers/forms/XaiOAuthSection.tsx:489— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' src/components/settings/auth/WorkBuddyAccountSection.tsx:458— Nothing imports this binding — it is safe to review for removal.
X7 · Silent fallback defaults· Pending state with no failure state · ×7
Pending state with no failure state src/tray-panel/UsageTab.tsx:279— The view draws `<div class="flex h-40 items-center justify-center text-muted-foreground">` under `! summary && isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state src/components/usage/UsageHeatmap.tsx:336— The view draws `<div class="flex h-[150px] items-center justify-center">` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state src/components/usage/UsageSettingsSheet.tsx:124— The view draws `<Loader2 aria-hidden="true" class="h-4 w-4 text-fg-3 motion-safe:animate-spin"/>` under `isLoading || ! config`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state src/components/usage/UsageTrendChart.tsx:397— The view draws `<div class="flex h-full items-center justify-center">` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state src/components/settings/AboutSection.tsx:210— The view draws `<Loader2 class="h-3 w-3 animate-spin"/>` under `isLoadingVersion`, but `isLoadingVersion` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state src/components/settings/AboutSection.tsx:233— The view draws `<>` under `isDownloading`, but `isDownloading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state src/components/settings/GlobalProxySettings.tsx:145— The view draws `<div class="flex items-center justify-center p-4">` under `isLoading && savedUrl === undefined`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
redundant comment src/components/providers/forms/ClaudeFormFields.tsx:153— "Speed Test Endpoints" repeats the code it sits on: 3 of its 3 words (speed, test, endpoints) are already in `speedTestEndpoints: EndpointCandidate[];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/components/providers/forms/CodexFormFields.tsx:249— "Speed Test Endpoints" repeats the code it sits on: 3 of its 3 words (speed, test, endpoints) are already in `speedTestEndpoints: EndpointCandidate[];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/components/providers/forms/GeminiFormFields.tsx:50— "Speed Test Endpoints" repeats the code it sits on: 3 of its 3 words (speed, test, endpoints) are already in `speedTestEndpoints: EndpointCandidate[];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 84 significant file(s) lose their only recent owner: src-tauri/src/codex_history_migration.rs, src/config/claudeDesktopProviderPresets.ts, src-tauri/src/services/provider/codex_direct.rs, src-tauri/src/services/provider/codex_official_models.rs, src/components/mcp/McpFormModal.tsx, src-tauri/src/mode/operation.rs, src-tauri/src/proxy/opaque_state_rectifier.rs, src-tauri/src/services/subscription_grok.rs (+76 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 3 significant file(s) lose their only recent owner: src-tauri/src/session_manager/providers/codex_items.rs, src/components/sessions/reader/SessionStepDetails.tsx, src/components/ui/ime-safe-input.tsx. Pair on, review, or document these before any departure.
D21 · Naming Consistency· `baseURL` spells `URL` where 147 names in the project spell it `Url` · ×2
`baseURL` spells `URL` where 147 names in the project spell it `Url` src/config/geminiProviderPresets.ts:22— 147 of 149 names in project cc-switch spell the token `Url` (147 of 149; unit: names in project cc-switch containing `Url`). Peers: UsageScriptModal.detectBalanceProvider(baseUrl) (src/components/UsageScriptModal.tsx:202); ProviderCard.extractApiUrl (src/components/providers/ProviderCard.tsx:208); ClaudeFormFieldsProps.websiteUrl (src/components/providers/forms/ClaudeFormFields.tsx:93); ClaudeFormFieldsProps.baseUrl (src/components/providers/forms/ClaudeFormFields.tsx:130); ClaudeFormFieldsProps.onBaseUrlChange (src/components/providers/forms/ClaudeFormFields.tsx:131). Rename to `baseUrl`. [rule N6]
`baseURL` spells `URL` where 147 names in the project spell it `Url` src/types.ts:970— 147 of 149 names in project cc-switch spell the token `Url` (147 of 149; unit: names in project cc-switch containing `Url`). Peers: UsageScriptModal.detectBalanceProvider(baseUrl) (src/components/UsageScriptModal.tsx:202); ProviderCard.extractApiUrl (src/components/providers/ProviderCard.tsx:208); ClaudeFormFieldsProps.websiteUrl (src/components/providers/forms/ClaudeFormFields.tsx:93); ClaudeFormFieldsProps.baseUrl (src/components/providers/forms/ClaudeFormFields.tsx:130); ClaudeFormFieldsProps.onBaseUrlChange (src/components/providers/forms/ClaudeFormFields.tsx:131). Rename to `baseUrl`. [rule N6]
Orphaned file src/lib/requestOverrides.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src-tauri/src/database/dao/universal_providers.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (90 single-owned of 704 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 704 of the 873 production source files in this repository met that bar). They are anonymized user #3 (1 file(s)), anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: src-tauri/src/proxy/providers/transform_codex_chat_moonshot_schema.rs, src-tauri/src/proxy/providers/inline_think.rs, src/components/ui/sliding-indicator.tsx.
No ADRs found package.json:7— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `package.json` makes this repository a deployable product (line 7).
D21 · Naming Consistency· `formatJSON` spells `JSON` where 22 names in the project spell it `Json` · ×1
`formatJSON` spells `JSON` where 22 names in the project spell it `Json` src/utils/formatters.ts:7— 22 of 23 names in project cc-switch spell the token `Json` (22 of 23; unit: names in project cc-switch containing `Json`). Peers: mcpDraft.parseJsonText (src/components/mcp/mcpDraft.ts:323); LocalProxyRequestOverridesFieldProps.headersJson (src/components/providers/forms/LocalProxyRequestOverridesField.tsx:11); LocalProxyRequestOverridesFieldProps.bodyJson (src/components/providers/forms/LocalProxyRequestOverridesField.tsx:12); LocalProxyRequestOverridesFieldProps.onHeadersJsonChange (src/components/providers/forms/LocalProxyRequestOverridesField.tsx:13); LocalProxyRequestOverridesFieldProps.onBodyJsonChange (src/components/providers/forms/LocalProxyRequestOverridesField.tsx:14). Rename to `formatJson`. [rule N6]
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 2 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `src-tauri` (322753 LoC, 837 module-visible types across 30 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 2 of 704 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 704 of the 873 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: src/lib/requestOverrides.ts, src-tauri/src/database/dao/universal_providers.rs. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No dependency-update automation package.json:22— `package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
Unused export 'McpIcon' src/components/BrandIcons.tsx:89— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'PiNativePromptResources' · ×1
Unused export 'PiNativePromptResources' src/components/prompts/PiNativePromptResources.tsx:1040— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'CLAUDE_DESKTOP_DEFAULT_CONFIG' · ×1
Unused export 'CLAUDE_DESKTOP_DEFAULT_CONFIG' src/components/providers/forms/helpers/opencodeFormUtils.ts:7— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'TABLE_PAGE_SIZE' · ×1
Unused export 'TABLE_PAGE_SIZE' src/components/usage/TablePagination.tsx:143— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useUpstreamProxyStatus' · ×1
Unused export 'useUpstreamProxyStatus' src/hooks/useGlobalProxy.ts:86— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'HERMES_WEB_OFFLINE_ERROR' · ×1
Unused export 'HERMES_WEB_OFFLINE_ERROR' src/hooks/useHermes.ts:21— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'McpImportResult' · ×1
Unused export 'McpImportResult' src/lib/api/deeplink.ts:75— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'restoreEnvBackup' · ×1
Unused export 'restoreEnvBackup' src/lib/api/env.ts:34— Nothing imports this binding — it is safe to review for removal.
Security headers incomplete — Set: Referrer-Policy. Missing: Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each.(−2.0 on this card.) The server: `.serve_connection(` (src-tauri/src/proxy/server.rs:206).
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 0/1 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Null assertions (`!`) override strict null checking — ~0.3 `!` null assertions per 1k TypeScript source lines — 50 assertion(s) across the 165023 source line(s) of the 490 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: src/lib/query/sessions.ts (10), src/components/quota/QuotaLines.tsx (4), src/components/sessions/utils.ts (4). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Outdated: aho-corasick — `aho-corasick` is locked at 1.1.4 but 1.1.5 is the current stable release on crates.io, and it already satisfies the `"1.1"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aho-corasick` and commit the updated REDACTED.
Outdated: anyhow — `anyhow` is locked at 1.0.102 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
Outdated: arboard — `arboard` is locked at 3.6.1 but 3.7.0 is the current stable release on crates.io, and it already satisfies the `"3.6"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arboard` and commit the updated REDACTED.
Outdated: bytes — `bytes` is locked at 1.11.1 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1.5"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytes` and commit the updated REDACTED.
Outdated: chrono — `chrono` is locked at 0.4.44 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
Outdated: flate2 — `flate2` is locked at 1.1.9 but 1.1.11 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
Outdated: futures — `futures` is locked at 0.3.32 but 0.3.34 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures` and commit the updated REDACTED.
Outdated: http — `http` is locked at 1.4.0 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http` and commit the updated REDACTED.
Outdated: http-body-util — `http-body-util` is locked at 0.1.3 but 0.1.5 is the current stable release on crates.io, and it already satisfies the `"0.1"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http-body-util` and commit the updated REDACTED.
Outdated: hyper — `hyper` is locked at 1.8.1 but 1.12.0 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hyper` and commit the updated REDACTED.
Outdated: hyper-rustls — `hyper-rustls` is locked at 0.27.7 but 0.27.10 is the current stable release on crates.io, and it already satisfies the `"0.27"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hyper-rustls` and commit the updated REDACTED.
Outdated: hyper-util — `hyper-util` is locked at 0.1.20 but 0.1.21 is the current stable release on crates.io, and it already satisfies the `"0.1"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hyper-util` and commit the updated REDACTED.
Outdated: indexmap — `indexmap` is locked at 2.13.0 but 2.14.2 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p indexmap` and commit the updated REDACTED.
Outdated: libc — `libc` is locked at 0.2.183 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
Outdated: log — `log` is locked at 0.4.29 but 0.4.35 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p log` and commit the updated REDACTED.
Outdated: once_cell — `once_cell` is locked at 1.21.3 but 1.21.4 is the current stable release on crates.io, and it already satisfies the `"1.21.3"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p once_cell` and commit the updated REDACTED.
Outdated: prost — `prost` is locked at 0.14.4 but 0.14.6 is the current stable release on crates.io, and it already satisfies the `"0.14"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p prost` and commit the updated REDACTED.
Outdated: regex — `regex` is locked at 1.12.3 but 1.13.1 is the current stable release on crates.io, and it already satisfies the `"1.10"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p regex` and commit the updated REDACTED.
Outdated: rust_decimal — `rust_decimal` is locked at 1.40.0 but 1.43.0 is the current stable release on crates.io, and it already satisfies the `"1.33"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rust_decimal` and commit the updated REDACTED.
Outdated: rustls — `rustls` is locked at 0.23.37 but 0.23.46 is the current stable release on crates.io, and it already satisfies the `"0.23"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustls` and commit the updated REDACTED.
Outdated: rustls-native-certs — `rustls-native-certs` is locked at 0.8.3 but 0.8.5 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustls-native-certs` and commit the updated REDACTED.
Outdated: serde — `serde` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.149 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: tauri — `tauri` is locked at 2.10.3 but 2.12.5 is the current stable release on crates.io, and it already satisfies the `"2.8.2"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri` and commit the updated REDACTED.
Outdated: tauri-build — `tauri-build` is locked at 2.5.6 but 2.7.4 is the current stable release on crates.io, and it already satisfies the `"2.4.0"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-build` and commit the updated REDACTED.
doc comments repeat the names src/config/openclawProviderPresets.ts:41— 0 of 4 documented parameters and 1 of 152 summaries in `cc-switch` only repeat the member or parameter name (e.g. "Icon color" for `iconColor`). Delete the restating tags, or add what the name does not say.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 11 file(s) — `REDACTED`, `src/components/providers/forms/ProviderForm.tsx`, `src/components/providers/presentation.ts`, `src/components/sessions/utils.ts`, `src/components/usage/requestLogColumns.ts`, … (+6 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1d853-f2b7-7992-83dc-83dc4ec72a37 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 157 · Warnings: 2382 · Recommendations: 192 · Info: 39 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 04:32 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.