Public report of SaladDay/cc-switch-cli, 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 report Measured 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, 19:42 UTC · Survey ID cd_9f7eab84962543b998034bbf1a96b494

SaladDay/cc-switch-cli

Measured 14 November 2026, 19:37 UTC, at code version b1fa06e

CAI score 57out of 100 At risk Up 1 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: 355,332 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 2.8 person-years · Weakest lens: Production Readiness, 43

Findings by how serious they are

50 critical 1823 serious 114 minor

21 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

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 19:37 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 ▸

46of 46 dimensions measured by tools.
1946of 1987 findings point to an exact file and line, so you can open each one in the code. The other 41 concern the repository as a whole, such as missing documentation.
46dimensions across 6 lenses, read from 355,332 lines of product code in 2 projects.
Chapters

Executive summary

SaladDay/cc-switch-cli is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back in part because we found no automated security scanning of the code, its secrets or its dependencies. It scores 57 out of 100, which the At risk rating leaves unchanged.

Production Readiness, at 43, is the weakest lens and counts most in the score. The best first step is adding automated security scanning, worth about 7 points. Recording design decisions comes next, worth about 3 points. Raising Production Readiness to 70 would lift the score to about 67.

Thirty-five pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Nine weaknesses in the code could be used by an attacker, and three known security holes in the packages the code depends on can be used by attackers. Pinning each tool to an exact version, fixing the weaknesses the scanner points to and updating the vulnerable packages would close these risks. Limiting each secret to its own step would fix the secret exposed to more of the pipeline than needed, and the two pipeline steps that run downloads without checking them need each download checked against a known checksum first.

The product code is 355,332 lines, about €400,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 for The 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.
Production Readiness 43 · counts for 46%Security and Compliance 62 · counts for 25%Maturity 66 · counts for 14%Code Health 83 · counts for 8%Architecture 86 · counts for 4%Performance 89 · counts for 2%

If Production Readiness rose from 43 to 70, the lowest score rated Strong, the score would rise from 57 to about 67.

Code composition: what the lines of code are
Product code 91%Tests 9%
New since the last survey: 579 findings

These 579 critical or serious findings weren't in the previous survey, on 28 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · CodexOAuthManager::adopt_account_refresh_token_under_lock (cyclomatic 25) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Cyclomatic Complexity · CodexOAuthManager::resolve_valid_cached_token_under_lock (cyclomatic 16) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Cognitive Complexity · CodexOAuthManager::adopt_account_refresh_token_under_lock (cognitive 36) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Cognitive Complexity · CodexOAuthManager::resolve_valid_cached_token_under_lock (cognitive 19) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • God Classes · TooManyMethods: CodexOAuthManager src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • God Classes · MethodTooLong: CodexOAuthManager.resolve_valid_cached_token_under_lock src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • God Classes · FileTooLong: src/provider_preset_pi.rs src-tauri/src/provider_preset_pi.rs
  • Code Duplication · Near-duplicate member family (5 members, 25 shared lines) src-tauri/src/cli/tui/ui/forms/mcp.rs
  • Code Duplication · Near-duplicate member family (4 members, 46 shared lines) src-tauri/src/cli/tui/ui/forms/mcp.rs
  • Code Duplication · Near-duplicate member pair (82 shared lines) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Near-duplicate member pair (80 shared lines) src-tauri/src/session_manager/providers/claude.rs
  • Code Duplication · Near-duplicate member pair (66 shared lines) src-tauri/src/cli/commands/provider.rs
  • Code Duplication · Near-duplicate member pair (38 shared lines) src-tauri/src/session_manager/providers/hermes.rs
  • Code Duplication · Near-duplicate member pair (36 shared lines) src-tauri/src/services/usage_stats.rs
  • Code Duplication · Near-duplicate member pair (27 shared lines) src-tauri/src/cli/tui/ui/forms/provider.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/cli/tui/ui/overlay/basic.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/codex_config.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp.rs
  • Code Duplication · Edited copy of a member (104 corresponding lines) src-tauri/src/cli/tui/form/provider_state.rs
  • Code Duplication · Edited copy of a member (103 corresponding lines) src-tauri/src/services/usage_stats.rs
  • Code Duplication · Edited copy of a member (97 corresponding lines) src-tauri/src/services/coding_plan.rs
  • Code Duplication · Edited copy of a member (81 corresponding lines) src-tauri/src/cli/commands/provider_input.rs
  • Code Duplication · Edited copy of a member (111 corresponding lines) src-tauri/src/services/session_usage.rs
  • Code Duplication · Edited copy of a member (90 corresponding lines) src-tauri/src/cli/tui/ui/forms/provider.rs
  • Code Duplication · Edited copy of a member (61 corresponding lines) src-tauri/src/live/patch/json.rs
  • Code Duplication · Edited copy of a member (67 corresponding lines) src-tauri/src/session_manager/transcript.rs
  • Code Duplication · Edited copies of one member (4 members, 58+ corresponding lines) src-tauri/src/session_manager/providers/claude.rs
  • Code Duplication · Edited copy of a member (54 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Code Duplication · Edited copy of a member (72 corresponding lines) src-tauri/src/services/coding_plan.rs
  • Code Duplication · Edited copy of a member (51 corresponding lines) src-tauri/src/config.rs
  • Code Duplication · Edited copy of a member (48 corresponding lines) src-tauri/src/cli/tui/app/form_handlers/provider.rs
  • Code Duplication · Edited copy of a member (49 corresponding lines) src-tauri/src/cli/commands/provider_input.rs
  • Code Duplication · Edited copy of a member (43 corresponding lines) src-tauri/src/cli/tui/ui/usage.rs
  • Code Duplication · Edited copy of a member (38 corresponding lines) src-tauri/src/database/dao/proxy.rs
  • Code Duplication · Edited copy of a member (54 corresponding lines) src-tauri/src/session_manager/providers/gemini.rs
  • Code Duplication · Edited copy of a member (57 corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Edited copy of a member (50 corresponding lines) src-tauri/src/proxy/providers/copilot_auth.rs
  • Code Duplication · Edited copy of a member (62 corresponding lines) src-tauri/src/cli/tui/runtime_systems/workers.rs
  • Code Duplication · Edited copies of one member (4 members, 47+ corresponding lines) src-tauri/src/services/balance.rs
  • Code Duplication · Edited copy of a member (43 corresponding lines) src-tauri/src/services/provider/common_config.rs
  • Code Duplication · Edited copy of a member (41 corresponding lines) src-tauri/src/session_manager/transcript.rs
  • Code Duplication · Edited copy of a member (41 corresponding lines) src-tauri/src/cli/tui/runtime_actions/editor.rs
  • Code Duplication · Edited copy of a member (37 corresponding lines) src-tauri/src/proxy/providers/transform_codex_anthropic.rs
  • Code Duplication · Edited copy of a member (60 corresponding lines) src-tauri/src/deeplink/parser.rs
  • Code Duplication · Edited copy of a member (41 corresponding lines) src-tauri/src/session_manager/paged_manifest.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) src-tauri/src/session_manager/transcript.rs
  • Code Duplication · Edited copy of a member (48 corresponding lines) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) src-tauri/src/cli/tui/data.rs
  • Code Duplication · Edited copy of a member (41 corresponding lines) src-tauri/src/session_manager/providers/hermes.rs
  • Code Duplication · Edited copy of a member (44 corresponding lines) REDACTED
  • Code Duplication · Edited copy of a member (53 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_chat.rs
  • Code Duplication · Edited copy of a member (35 corresponding lines) src-tauri/src/session_manager/providers/hermes.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) src-tauri/src/cli/commands/update.rs
  • Code Duplication · Edited copy of a member (31 corresponding lines) src-tauri/src/hermes_config.rs
  • Code Duplication · Edited copy of a member (41 corresponding lines) src-tauri/src/cli/commands/config_s3.rs
  • Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Edited copy of a member (33 corresponding lines) src-tauri/src/proxy/providers/claude.rs
  • Code Duplication · Edited copy of a member (31 corresponding lines) src-tauri/src/cli/tui/app/editor_state.rs
  • Code Duplication · Edited copy of a member (58 corresponding lines) src-tauri/src/services/subscription.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) src-tauri/src/cli/tui/app/form_handlers/provider.rs
  • Code Duplication · Edited copy of a member (36 corresponding lines) src-tauri/src/session_manager/paged_manifest.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) src-tauri/src/cli/commands/skills.rs
  • Code Duplication · Edited copy of a member (53 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_chat.rs
  • Code Duplication · Edited copy of a member (39 corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Edited copy of a member (41 corresponding lines) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs
  • Code Duplication · Edited copy of a member (31 corresponding lines) src-tauri/src/proxy/http_client.rs
  • Code Duplication · Edited copy of a member (42 corresponding lines) src-tauri/src/services/s3_sync.rs
  • Code Duplication · Edited copy of a member (44 corresponding lines) src-tauri/src/services/provider/live.rs
  • Code Duplication · Edited copy of a member (45 corresponding lines) src-tauri/src/cli/tui/terminal.rs
  • Code Duplication · Edited copy of a member (36 corresponding lines) src-tauri/src/services/mcp.rs
  • Code Duplication · Edited copy of a member (36 corresponding lines) src-tauri/src/cli/tui/ui/forms/s3.rs
  • Code Duplication · Edited copy of a member (36 corresponding lines) src-tauri/src/cli/commands/env.rs
  • Code Duplication · Edited copy of a member (28 corresponding lines) src-tauri/src/cli/tui/runtime_actions/settings.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) src-tauri/src/session_manager/scan_cache_store.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Code Duplication · Edited copy of a member (31 corresponding lines) src-tauri/src/cli/commands/hermes.rs
  • Code Duplication · Edited copy of a member (31 corresponding lines) src-tauri/src/cli/tui/app/form_handlers/provider.rs
  • Code Duplication · Edited copy of a member (27 corresponding lines) src-tauri/src/config.rs
  • Code Duplication · Edited copy of a member (28 corresponding lines) src-tauri/src/cli/commands/sessions.rs
  • Code Duplication · Edited copy of a member (25 corresponding lines) src-tauri/src/proxy/providers/transform_responses.rs
  • Code Duplication · Edited copy of a member (27 corresponding lines) src-tauri/src/services/env_manager.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) src-tauri/src/cli/tui/app/editor_state.rs
  • Code Duplication · Edited copy of a member (21 corresponding lines) src-tauri/src/openclaw_config.rs
  • Code Duplication · Edited copy of a member (32 corresponding lines) src-tauri/src/proxy/providers/streaming_gemini.rs
  • Code Duplication · Edited copy of a member (36 corresponding lines) src-tauri/src/cli/tui/form/provider_state.rs
  • Code Duplication · Edited copy of a member (22 corresponding lines) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Edited copy of a member (19 corresponding lines) src-tauri/src/services/webdav.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) src-tauri/src/services/codex_oauth.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) src-tauri/src/cli/tui/mod.rs
  • Code Duplication · Edited copy of a member (32 corresponding lines) src-tauri/src/cli/tui/ui/usage.rs
  • Code Duplication · Edited copy of a member (22 corresponding lines) src-tauri/src/daemon/mod.rs
  • Code Duplication · Edited copy of a member (25 corresponding lines) src-tauri/src/services/codex_oauth.rs
  • Code Duplication · Edited copy of a member (29 corresponding lines) src-tauri/src/cli/commands/config_common.rs
  • Code Duplication · Edited copy of a member (28 corresponding lines) src-tauri/src/cli/tui/runtime_actions/settings.rs
  • Code Duplication · Edited copy of a member (25 corresponding lines) src-tauri/src/services/s3.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) src-tauri/src/cli/tui/ui/chrome.rs

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: 201 findings

These 201 critical or serious findings were in the previous survey, on 28 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · benchmark_cc_switch.benchmark_cli (cyclomatic 36) scripts/benchmark_cc_switch.py
  • Cyclomatic Complexity · TuiScreen._handle_csi (cyclomatic 31) scripts/benchmark_cc_switch.py
  • Cyclomatic Complexity · benchmark_cc_switch.benchmark_tui (cyclomatic 25) scripts/benchmark_cc_switch.py
  • Cyclomatic Complexity · check_benchmark_thresholds.check_thresholds (cyclomatic 22) scripts/check_benchmark_thresholds.py
  • Cyclomatic Complexity · benchmark_cc_switch.main (cyclomatic 20) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · benchmark_cc_switch.benchmark_cli (cognitive 88) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · benchmark_cc_switch.benchmark_tui (cognitive 80) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · benchmark_cc_switch.run_pty_command (cognitive 33) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · check_benchmark_thresholds.check_thresholds (cognitive 33) scripts/check_benchmark_thresholds.py
  • Cognitive Complexity · benchmark_cc_switch.main (cognitive 23) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · TuiScreen._consume_escape (cognitive 18) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · TuiScreen._handle_csi (cognitive 17) scripts/benchmark_cc_switch.py
  • Cognitive Complexity · Snapshot.restore (cognitive 16) scripts/benchmark_cc_switch.py
  • Code Duplication · Near-duplicate member family (5 members, 24 shared lines) src-tauri/src/cli/tui/ui/forms/mcp.rs
  • Code Duplication · Near-duplicate member family (4 members, 40 shared lines) src-tauri/src/cli/tui/ui/forms/mcp.rs
  • Code Duplication · Near-duplicate member pair (77 shared lines) src-tauri/src/session_manager/providers/claude.rs
  • Code Duplication · Near-duplicate member pair (65 shared lines) src-tauri/src/cli/commands/provider.rs
  • Code Duplication · Near-duplicate member pair (33 shared lines) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Near-duplicate member pair (20 shared lines) src-tauri/src/services/skill.rs
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src-tauri/src/session_manager/providers/claude.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/cli/tui/ui/overlay/basic.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/mcp.rs
  • Code Duplication · Duplicated block (73–75 lines × 2) src-tauri/src/cli/tui/form/provider_state.rs
  • Code Duplication · Duplicated block (41–48 lines × 2) src-tauri/src/cli/commands/provider.rs
  • Code Duplication · Duplicated block (40 lines × 2) src-tauri/src/cli/tui/form/provider_state.rs
  • Code Duplication · Duplicated block (23–28 lines × 2) src-tauri/src/cli/commands/config_s3.rs
  • Code Duplication · Duplicated block (27 lines × 2) src-tauri/src/services/proxy.rs
  • Code Duplication · Duplicated block (26 lines × 3) src-tauri/src/cli/commands/hermes.rs
  • Code Duplication · Duplicated block (24 lines × 2) src-tauri/src/cli/tui/mod.rs
  • Code Duplication · Duplicated block (24 lines × 2) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (24 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs
  • Code Duplication · Duplicated block (20–23 lines × 2) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (16–22 lines × 4) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (22 lines × 2) src-tauri/src/proxy/handlers.rs
  • Code Duplication · Duplicated block (22 lines × 2) src-tauri/src/proxy/http_client.rs
  • Code Duplication · Duplicated block (22 lines × 2) src-tauri/src/services/session_usage.rs
  • Code Duplication · Duplicated block (19–20 lines × 3) src-tauri/src/services/session_usage.rs
  • Code Duplication · Duplicated block (16–19 lines × 2) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (18 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs
  • Code Duplication · Duplicated block (10–17 lines × 5) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (16–17 lines × 2) src-tauri/src/proxy/providers/streaming.rs
  • Code Duplication · Duplicated block (16 lines × 2) src-tauri/src/database/dao/proxy.rs
  • Code Duplication · Duplicated block (16 lines × 2) src-tauri/src/mcp.rs
  • Code Duplication · Duplicated block (9–15 lines × 11) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (15 lines × 2) src-tauri/src/proxy/response.rs
  • Code Duplication · Duplicated block (15 lines × 2) src-tauri/src/services/usage_stats.rs
  • Code Duplication · Duplicated block (14 lines × 3) src-tauri/src/cli/commands/provider_input.rs
  • Code Duplication · Duplicated block (14 lines × 3) src-tauri/src/services/provider/mod.rs
  • Code Duplication · Duplicated block (14 lines × 2) src-tauri/src/cli/tui/ui/editor.rs
  • Code Duplication · Duplicated block (14 lines × 2) src-tauri/src/database/dao/proxy.rs
  • Code Duplication · Duplicated block (13–14 lines × 2) src-tauri/src/deeplink/provider.rs
  • Code Duplication · Duplicated block (13 lines × 3) src-tauri/src/proxy/handlers.rs
  • Code Duplication · Duplicated block (12–13 lines × 3) src-tauri/src/services/subscription.rs
  • Code Duplication · Duplicated block (9–13 lines × 2) src-tauri/src/cli/tui/ui/forms/mcp.rs
  • Code Duplication · Duplicated block (11–13 lines × 2) src-tauri/src/cli/tui/ui/forms/prompt.rs
  • Code Duplication · Duplicated block (13 lines × 2) src-tauri/src/proxy/response.rs
  • Code Duplication · Duplicated block (12 lines × 3) src-tauri/src/cli/tui/ui/forms/mcp.rs
  • Code Duplication · Duplicated block (11–12 lines × 3) src-tauri/src/cli/tui/ui/forms/provider.rs
  • Code Duplication · Duplicated block (10–12 lines × 2) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (12 lines × 2) src-tauri/src/cli/tui/ui/forms/prompt.rs
  • Code Duplication · Duplicated block (12 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs
  • Code Duplication · Duplicated block (12 lines × 2) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Duplicated block (11–12 lines × 2) src-tauri/src/codex_history_migration.rs
  • Code Duplication · Duplicated block (12 lines × 2) src-tauri/src/services/skill.rs
  • Code Duplication · Duplicated block (10–12 lines × 2) src-tauri/src/session_manager/providers/claude.rs
  • Code Duplication · Duplicated block (10–11 lines × 5) src-tauri/src/session_manager/providers/claude.rs
  • Code Duplication · Duplicated block (11 lines × 4) src-tauri/src/proxy/providers/streaming.rs
  • Code Duplication · Duplicated block (11 lines × 3) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (10–11 lines × 3) src-tauri/src/mcp.rs
  • Code Duplication · Duplicated block (11 lines × 2) src-tauri/src/cli/commands/provider_input.rs
  • Code Duplication · Duplicated block (11 lines × 2) src-tauri/src/database/dao/proxy.rs
  • Code Duplication · Duplicated block (11 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs
  • Code Duplication · Duplicated block (11 lines × 2) src-tauri/src/session_manager/cache.rs
  • Code Duplication · Duplicated block (11 lines × 2) src-tauri/src/session_manager/providers/hermes.rs
  • Code Duplication · Duplicated block (11 lines × 2) src-tauri/src/session_manager/transcript.rs
  • Code Duplication · Duplicated block (10 lines × 3) src-tauri/src/cli/tui/ui/config.rs
  • Code Duplication · Duplicated block (10 lines × 3) src-tauri/src/deeplink/provider.rs
  • Code Duplication · Duplicated block (10 lines × 3) src-tauri/src/proxy/handlers.rs
  • Code Duplication · Duplicated block (10 lines × 3) src-tauri/src/proxy/response.rs
  • Code Duplication · Duplicated block (10 lines × 3) src-tauri/src/services/coding_plan.rs
  • Code Duplication · Duplicated block (10 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs
  • Code Duplication · Duplicated block (9–10 lines × 2) src-tauri/src/cli/tui/ui/overlay/pickers.rs
  • Code Duplication · Duplicated block (8–10 lines × 2) src-tauri/src/codex_history_migration.rs
  • Code Duplication · Duplicated block (10 lines × 2) src-tauri/src/proxy/providers/copilot_auth.rs
  • Code Duplication · Duplicated block (10 lines × 2) src-tauri/src/services/skill.rs
  • Code Duplication · Duplicated block (10 lines × 2) src-tauri/src/services/usage_stats.rs
  • Code Duplication · Duplicated block (9 lines × 5) src-tauri/src/services/provider/mod.rs
  • Code Duplication · Duplicated block (9 lines × 3) src-tauri/src/cli/tui/runtime_actions/editor.rs
  • Code Duplication · Duplicated block (9 lines × 3) src-tauri/src/session_manager/providers/codex.rs
  • Code Duplication · Duplicated block (7–9 lines × 2) src-tauri/src/cli/commands/provider.rs
  • Code Duplication · Duplicated block (8–9 lines × 2) src-tauri/src/cli/commands/provider_input.rs
  • Code Duplication · Duplicated block (9 lines × 2) src-tauri/src/cli/provider_quota.rs
  • Code Duplication · Duplicated block (9 lines × 2) src-tauri/src/cli/tui/app/content_entities.rs
  • Code Duplication · Duplicated block (8–9 lines × 2) src-tauri/src/cli/tui/app/helpers.rs
  • Code Duplication · Duplicated block (9 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs
  • Code Duplication · Duplicated block (9 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs
  • Code Duplication · Duplicated block (9 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs
Rebuild cost: about €400,000 · Estimate
Cost to rebuild€130,000 to €670,000, for 2,217 to 7,034 hours of work, about 2.8 person-years for 1 to 6 engineers
Difficulty of the problemStandard, 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 57. 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.
SizeLarge: 355,332 lines of product code
What it is notNot 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
Add a SAST step to CI running what this repository's stack ships: cargo-audit / cargo-deny (or clippy) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
Raises the score by about 7 points · Medium effort · Security & performance tooling
2
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.
Raises the score by about 3 points · Low effort · ADR Quality
3
Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED (2).
Raises the score by about 2 points · Low effort · Static Analysis (SAST)

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.

Files that change often carry extra risk · Combined risk
7 files are changed often and are hard to read, which makes them the likeliest places for a mistake. They also have under half their code tested, or were written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to these files therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (31 files) · Code Coverage (49 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: REDACTED, help.rs and config.rs
What to do: Add tests to these files and have a second person review every change to them, starting with REDACTED, help.rs and config.rs.
Where the investment is most exposed · Value at risk
This code would cost about €400,000 to build again, about 2.8 person-years of work. Its weakest lens is Production Readiness, at 43 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Add a SAST step to CI running what this repository's stack ships: cargo-audit / cargo-deny (or clippy) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. 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 6.4 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 60,415 lines over the last 90 days, which is about 245,016 lines a year. At that pace, the extra work comes to an estimated 24.5 to 146.7 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.

343 modules, with 750 dependencies between them. 2 loops run through 41 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 303 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.
uses →1 cli.tui.text_edit2 daemon.ipc.protocol3 error4 live.patch.dotenv5 proxy.types6 session_manager.scan_cache_store7 cli.tui.route8 cli.tui.theme9 proxy.server10 services.skill11 session_manager12 services.proxy13 session_manager.paged_manifest14 session_manager.project_scope15 store16 services.provider.claude_editor17 cli.commands.provider18 provider19 cli.tui.form20 database21 settings22 cli.tui.data23 cli.tui.app.types24 cli.tui.app.helpers25 cli.tui.app.app_state26 cli.tui.ui.overlay.pickers27 app_config28 cli.tui.help29 cli.tui.runtime_systems.types30 cli.tui.ui.config31 proxy.forwarder32 proxy.usage.logger33 services.provider34 cli.tui.runtime_actions35 cli.tui.runtime_systems.handlers36 proxy.handlers37 proxy.response38 cli.tui39 cli.tui.runtime_actions.editor40 proxy.response_handler
1 cli.tui.text_edit
2 daemon.ipc.protocol
3 error
4 live.patch.dotenv
5 proxy.types
6 session_manager.scan_cache_store
7 cli.tui.route1
8 cli.tui.theme1
9 proxy.server5121
10 services.skill16
11 session_manager1
12 services.proxy161113
13 session_manager.paged_manifest11
14 session_manager.project_scope1
15 store122
16 services.provider.claude_editor1121
17 cli.commands.provider11141
18 provider11
19 cli.tui.form6236
20 database28114
21 settings4112
22 cli.tui.data1322127
23 cli.tui.app.types52115711426
24 cli.tui.app.helpers14435433
25 cli.tui.app.app_state11511851453
26 cli.tui.ui.overlay.pickers11113112113
27 app_config112
28 cli.tui.help7111
29 cli.tui.runtime_systems.types111
30 cli.tui.ui.config5112561
31 proxy.forwarder2442
32 proxy.usage.logger112
33 services.provider2216114
34 cli.tui.runtime_actions11121312
35 cli.tui.runtime_systems.handlers111111114
36 proxy.handlers111121
37 proxy.response11
38 cli.tui1014261
39 cli.tui.runtime_actions.editor1111111
40 proxy.response_handler231132
Uses a module listed above itPart of a loopThe module itself
1 cli.tui.text_edit2 daemon.ipc.protocol3 error4 live.patch.dotenv5 proxy.types6 session_manager.scan_cache_store7 cli.tui.route8 cli.tui.theme9 proxy.server10 services.skill11 session_manager12 services.proxy13 session_manager.paged_manifest14 session_manager.project_scope15 store16 services.provider.claude_editor17 cli.commands.provider18 provider19 cli.tui.form20 database21 settings22 cli.tui.data23 cli.tui.app.types24 cli.tui.app.helpers25 cli.tui.app.app_state26 cli.tui.ui.overlay.pickers27 app_config28 cli.tui.help29 cli.tui.runtime_systems.types30 cli.tui.ui.config31 proxy.forwarder32 proxy.usage.logger33 services.provider34 cli.tui.runtime_actions35 cli.tui.runtime_systems.handlers36 proxy.handlers37 proxy.response38 cli.tui39 cli.tui.runtime_actions.editor40 proxy.response_handlercli.tui.text_edit1daemon.ipc.protocol2error3live.patch.dotenv4proxy.types5session_manager.scan_cache_store6cli.tui.route7cli.tui.theme8proxy.server9services.skill10session_manager11services.proxy12session_manager.paged_manifest13session_manager.project_scope14store15services.provider.claude_editor16cli.commands.provider17provider18cli.tui.form19database20settings21cli.tui.data22cli.tui.app.types23cli.tui.app.helpers24cli.tui.app.app_state25cli.tui.ui.overlay.pickers26app_config27cli.tui.help28cli.tui.runtime_systems.types29cli.tui.ui.config30proxy.forwarder31proxy.usage.logger32services.provider33cli.tui.runtime_actions34cli.tui.runtime_systems.handlers35proxy.handlers36proxy.response37cli.tui38cli.tui.runtime_actions.editor39proxy.response_handler401151211611611131111221121111411162362811441121322127521157114261443543311511851453111131121131127111111511256124421122216114111213121111111141111211110142611111111231132+303 more modules (most-connected shown)

At a glance — Code Health · 83% · Adequate · gated by D2 ·

At a glance — Architecture · 86% · Adequate · gated by D26 ·

At a glance — Maturity · 66% · Adequate · gated by M2 ·

At a glance — Readiness · 43% · Weak · gated by P3, P7 ·

At a glance — Security · 62% · Adequate · gated by D29, D36 ·

At a glance — Performance · 89% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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 categoryFindingsSeverity
A05:2025 — Injection50High / Critical
A03:2025 — Software Supply Chain Failures41High / Critical

Roadmap

Top priorities: Add a SAST step to CI running what this repository's stack ships: cargo-audit / cargo-deny (or clippy) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing; Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail; Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Add a SAST step to CI running what this repository's stack ships: cargo-audit / cargo-deny (or clippy) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.+7.3 ptsMediumSecurity & performance tooling
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.+3.0 ptsLowADR Quality
Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED (2).+2.0 ptsLowStatic Analysis (SAST)
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.+3.7 ptsMediumOutbound HTTP resilience
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).+2.8 ptsMediumDR & Backup
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.+2.8 ptsMediumArchitecture documentation
Resolve the 62 Low coverage finding(s) in Code Coverage — start with REDACTED (4), prompts.rs (3), webdav.rs (3).+1.3 ptsMediumCode Coverage
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.+2.1 ptsMediumDeployment & Rollback

File quality

Per-file score 0–10 — a quality signature. Of 258 files carrying findings, judged against the Production bar: 2% slop · 76% mixed · 22% near-clean.

FileScoreBandWorst signal
REDACTED0.2SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.6SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
src-tauri/src/cli/i18n.rs4.8MixedCognitive Complexity: cc_switch::cli::i18n::texts::tui_local_proxy_settings_summary (cognitive 16)
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
src-tauri/src/cli/tui/runtime_systems/handlers.rs5.5MixedCyclomatic Complexity: cc_switch::cli::tui::runtime_systems::handlers::handle_session_msg (cyclomatic 87)
src-tauri/src/cli/tui/runtime_systems/workers.rs5.5MixedCyclomatic Complexity: cc_switch::cli::tui::runtime_systems::workers::handle_session_req (cyclomatic 26)
src-tauri/src/services/subscription.rs5.5MixedCyclomatic Complexity: cc_switch::services::subscription::get_subscription_quota (cyclomatic 24)
src-tauri/src/cli/commands/provider_inspect.rs5.5MixedCyclomatic Complexity: cc_switch::cli::commands::provider_inspect::quota_provider (cyclomatic 21)
src-tauri/src/cli/tui/ui/overlay/pickers.rs5.5MixedCyclomatic Complexity: cc_switch::cli::tui::ui::overlay::pickers::render_claude_model_picker_overlay (cyclomatic 21)
src-tauri/src/session_manager/providers/hermes.rs5.5MixedCyclomatic Complexity: cc_switch::session_manager::providers::hermes::parse_jsonl_session_lines (cyclomatic 18)
src-tauri/src/claude_mcp.rs5.5MixedCyclomatic Complexity: cc_switch::claude_mcp::upsert_mcp_server (cyclomatic 16)
src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs5.5MixedCyclomatic Complexity: App::handle_confirm_overlay_key (cyclomatic 70)
src-tauri/src/services/coding_plan.rs5.5MixedCognitive Complexity: cc_switch::services::coding_plan::query_kimi (cognitive 20)
src-tauri/src/cli/tui/runtime_actions/config.rs5.5MixedGod Classes: TooManyFunctions: cc_switch::cli::tui::runtime_actions::config
src-tauri/src/cli/commands/auth.rs5.5MixedCode Duplication: Near-duplicate member pair (63 shared lines)

How the grades work

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 — 50

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 — 1823

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 — 114

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 21

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 46 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 — 46 dimensions across the health lenses
D1D2D3D4D6D8D12D13D14D15D16D17D19D20D26D28D29D30D34D35D36D43AX10AX3AX4AX9C2M1M2M3M4P1P10P2P3P4P5P6P7PF1PF3S1X1X21X28X30

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
  1. 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, 1946 of 1987 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.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. 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.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1db90-926e-765b-a9c3-c8d2bc6286a7.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

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.

  • 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 source is present (.rs) and this repository declares a Cargo test suite (src-tauri, 290 test files), but it was not re-run: its build outgrew the 12 GB scratch ceiling (12.051 GB measured) and was stopped; its suite was not run. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • 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.
  • 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 — 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 the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • 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.
  • D44 Platform End-of-Life — 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 dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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.
  • ED5 Idempotency — 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 decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
  • 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 no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Rust 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 no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Rust 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X13 Undrained process stream — 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, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, Dart, Ruby, Scala or Kotlin was found in this repository, 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.
  • X18 Disposal-pattern correctness — 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, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, 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.
  • X19 Unrestored process-global state — 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, and JavaScript/TypeScript, Java, Kotlin, Python, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Python, Dart, Ruby, Scala or PHP was found in this repository, 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.
  • X22 Contradicted release guard — 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, and Java, TypeScript/JavaScript, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded, and this repository's Rust 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.
  • X23 Unguarded diagnostic materialisation — 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, and JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin or PHP was found in this repository, 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python was found in this repository, 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart and Ruby source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart or Ruby was found in this repository, 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.
  • 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 reads C# syntax, and PHP, Java, Kotlin, Python, Ruby, Scala, Dart, Swift, Erlang, Go and JavaScript/TypeScript source only, and no C# was loaded and no PHP, Java, Kotlin, Python, Ruby, Scala, Dart, Swift, Erlang, Go, JavaScript or TypeScript was found in this repository, 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.
  • X5 Nullable reference types — 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 and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Rust 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.

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.
  • 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.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • 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 Secret Scanning: Secret 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.
  • 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.
  • 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.

Dimensions

D1 · Cyclomatic Complexity5.5 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.5 / 10 · rule-coverage 100% · ceiling Prevented

193 function(s) exceeded the cyclomatic complexity threshold of 15; the worst was cc_switch::cli::tui::runtime_actions::handle_action at 164. A further 17 function(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 cc_switch::cli::tui::help::provider_field_help at 47 — they are counted neither in the figure above nor in this dimension's score. 7 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: src-tauri/src/cli/tui/ui/overlay/render.rs (cc_switch::cli::tui::ui::overlay::render::render_overlay at 42), src-tauri/src/cli/tui/text_edit.rs (TextEditCommand::from_key at 21), src-tauri/src/main.rs (cc_switch::run at 21), src-tauri/src/cli/commands/provider.rs (cc_switch::cli::commands::provider::execute at 17), src-tauri/src/cli/commands/skills.rs (cc_switch::cli::commands::skills::execute at 17), and 2 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.

cc_switch::cli::tui::runtime_actions::handle_action (cyclomatic 164) · ×106src-tauri/src/cli/tui/runtime_actions/mod.rs:514
App::handle_provider_field_activate (cyclomatic 94) · ×35src-tauri/src/cli/tui/app/form_handlers/provider.rs:368
ProviderService::refresh_provider_snapshot (cyclomatic 36) · ×11src-tauri/src/services/provider/mod.rs:1358
ProviderAddFormState::to_provider_json_value (cyclomatic 82) · ×5src-tauri/src/cli/tui/form/provider_json.rs:281
RequestForwarder::prepare_request_with_client (cyclomatic 43) · ×5src-tauri/src/proxy/forwarder/request_builder.rs:126

+ 18 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 1 body over 120 down to 120 or less in Cyclomatic Complexity — start with cc_switch::cli::tui::runtime_actions::handle_action (cyclomatic 164). — Refactoring it lifts Cyclomatic Complexity from 5.5 to about 5.8/10.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.8 / 10Weak✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.8 / 10 · rule-coverage 100% · ceiling Prevented

337 function(s) exceeded the cognitive complexity threshold of 15; the worst was cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses at 387.

cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses (cognitive 387) · ×206src-tauri/src/proxy/providers/streaming_responses.rs:156
App::handle_provider_field_activate (cognitive 129) · ×39src-tauri/src/cli/tui/app/form_handlers/provider.rs:368
ProviderService::fetch_provider_models (cognitive 96) · ×16src-tauri/src/services/provider/models.rs:24
SkillService::migrate_storage (cognitive 92) · ×12src-tauri/src/services/skill.rs:2025
ProviderAddFormState::to_provider_json_value (cognitive 220) · ×8src-tauri/src/cli/tui/form/provider_json.rs:281

+ 33 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 3 bodies over 240 down to 240 or less in Cognitive Complexity — start with cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses (cognitive 387), cc_switch::proxy::providers::streaming::create_anthropic_sse_stream (cognitive 333), cc_switch::cli::tui::run (cognitive 282). — 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 3 together lifts Cognitive Complexity from 2.8 to about 3.5/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes8.5 / 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.

Maturity: Documented → Verified → Prevented · effective 8.5 / 10 · rule-coverage 100% · ceiling Prevented

245 god class(es) detected.

FileTooLong: cli/i18n.rs · ×88src-tauri/src/cli/i18n.rs
FunctionTooLong: cc_switch::cli::tui::run · ×71src-tauri/src/cli/tui/mod.rs:3053
MethodTooLong: Database.seed_model_pricing · ×52src-tauri/src/database/schema.rs:1823
ClassTooLong: ProxyService · ×14src-tauri/src/services/proxy.rs:50
TooManyMethods: App · ×13src-tauri/src/cli/tui/app/app_state.rs:722

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 88 FileTooLong finding(s) in God Classes — start with provider.rs (5), REDACTED (4), types.rs (2). — One of this dimension's main actionable groups (88 warning-level).
  2. Resolve the 71 FunctionTooLong finding(s) in God Classes — start with handlers.rs (7), config.rs (6), provider.rs (6). — One of this dimension's main actionable groups (71 warning-level).
  3. Resolve the 52 MethodTooLong finding(s) in God Classes — start with REDACTED (6), schema.rs (5), skill.rs (4). — One of this dimension's main actionable groups (52 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication7.4 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 7.4 / 10 · rule-coverage 100% · ceiling Verified

573 duplicated block group(s) detected. 6.6 % of the production lines (23,432 of 355,332) are in a reported copy. A further 333 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (7 lines × 2) · ×48src-tauri/src/app_config.rs:38
Duplicated block (8 lines × 2) · ×43src-tauri/src/cli/commands/config.rs:329
Duplicated block (9 lines × 2) · ×38src-tauri/src/cli/commands/provider_input.rs:142
Duplicated block (10 lines × 2) · ×34src-tauri/src/claude_mcp.rs:173
Duplicated block (11 lines × 2) · ×32src-tauri/src/cli/commands/sessions.rs:883

+ 229 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 48 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with provider.rs (5), editor_state.rs (3), app_config.rs (2). — One of this dimension's main actionable groups (48 warning-level).
  2. Resolve the 43 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with provider_input.rs (3), prompts.rs (2), codex_config.rs (2). — One of this dimension's main actionable groups (43 warning-level).
  3. Resolve the 38 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with editor.rs (4), workers.rs (3), provider_input.rs (2). — One of this dimension's main actionable groups (38 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 141 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.md.

D8 · Code Coverage9.7 / 10Stronggated by 62 serious findings✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Verified

Line coverage 71.2% — 62 file(s) below 50%. Measured from the Rust suite (src-tauri: `cargo test --workspace` instrumented over 367 production file(s), 44 test binaries and 0 doc-test binaries).

Low coverage: src-tauri/src/claude_mcp.rs · ×62src-tauri/src/claude_mcp.rs:1

What to do

  1. Resolve the 62 Low coverage finding(s) in Code Coverage — start with REDACTED (4), prompts.rs (3), webdav.rs (3). — One of this dimension's main actionable groups (62 warning-level).

Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.

D12 · Dependency Hygiene8.6 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.6 / 10 · rule-coverage 100% · ceiling Verified

29 outdated, 0 yanked direct Cargo dependencies. 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: anyhow · ×29

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 481 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.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.9 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.9 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: src-tauri/src/cli/tui/ui/forms/provider.rs (9×120=1080); src-tauri/src/cli/tui/runtime_actions/mod.rs (5×164=820); src-tauri/src/cli/tui/help.rs (12×62=744) Repeated repair below the complexity floor: src-tauri/src/cli/i18n.rs (7 of 13 changes were fixes); src-tauri/src/cli/tui/form/provider_state_loading.rs (5 of 7 changes were fixes); src-tauri/src/services/sync_protocol.rs (5 of 6 changes were fixes)

Hotspot: src-tauri/src/cli/tui/ui/forms/provider.rs · ×23src-tauri/src/cli/tui/ui/forms/provider.rs:1922
Repeated repair: src-tauri/src/cli/i18n.rs · ×11src-tauri/src/cli/i18n.rs:1807

What to do

  1. Resolve the 23 Hotspot finding(s) in Churn × Complexity Hotspots — start with provider.rs (2), REDACTED (2), help.rs. — One of this dimension's main actionable groups (23 warning-level).
  2. Resolve the 11 Repeated repair finding(s) in Churn × Complexity Hotspots — start with i18n.rs, provider_state_loading.rs, sync_protocol.rs. — One of this dimension's main actionable groups (11 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor6.4 / 10Adequate✓ 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.

Maturity: Documented → Verified → Prevented · effective 6.4 / 10 · rule-coverage 100% · ceiling Documented

126 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src-tauri/src/cli/tui/app/tests.rs. Counted over 349 of the 392 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
Further sole-owners (lower concentration)

What to do

  1. Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
  2. 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.

D17 · Explicit Debt10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 deducted task-comment markers across 355332 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.

✓ On the Gold path — maintain.

Detailed fixes: d17_recommendation.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 14 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs foundsrc-tauri/Cargo.toml:17

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml. — 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.

D26 · Project Cohesion0.0 / 10Critical✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 2 build units (Cargo, checkout) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. 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.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Secret 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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)1.1 / 10Critical✓ Tool-verified

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).

Maturity: Documented → Verified → Prevented · effective 1.1 / 10 · rule-coverage 100% · ceiling Documented

50 finding(s): 0 critical, 47 high, 3 medium, 0 low. 35 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 2 file(s) — `REDACTED` (line 61, line 65, line 66), `src-tauri/src/cli/tui/app/tests.rs` — 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 1 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

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (9 issue-level).
  2. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. No action in Static Analysis (SAST) — all 35 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 (35 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities1.4 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 1.4 / 10 · rule-coverage 100% · ceiling Documented

36 finding(s): 1 critical, 2 high, 32 medium, 1 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 17 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (17). — One of this dimension's main actionable groups (17 warning-level).
  2. Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. Resolve the 1 Critical CVE 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.

D34 · Knowledge Freshness9.7 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Documented

12 of 349 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src-tauri/src/claude_mcp.rs. Counted over 349 of the 392 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file · ×12src-tauri/src/claude_mcp.rs: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.

D35 · Change Coupling9.5 / 10Stronggated by 8 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: REDACTED↔render.rs 94%; REDACTED↔pickers.rs 81%; i18n.rs↔render.rs 81%

Change coupling: basic.rs ↔ REDACTED · ×6src-tauri/src/cli/tui/ui/overlay/basic.rs:1
Change-coupling hub: REDACTED → basic.rs, pickers.rs, render.rs · ×2src-tauri/src/cli/tui/app/tests.rs

What to do

  1. Resolve the 6 Change coupling finding(s) in Change Coupling — start with REDACTED (2), basic.rs, pickers.rs. — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with REDACTED, i18n.rs. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

1/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. 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).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition9.6 / 10Exemplary✓ Tool-verified

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.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

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.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

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.

C2 · Access Controls7.0 / 10Strong✓ Tool-verified

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.

  • Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.

What to do

  • Name the access rules — roles and permissions declared once (an enum Role/Permission, actix-web-grants #[protect(…)], axum-login's permission_required!, a casbin or oso policy) and consulted where access is checked, so the rule set is reviewable and testable on its own.
M1 · Documentation (README)8.0 / 10Strong✓ Tool-verified

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.

M2 · Architecture documentation2.0 / 10Critical✓ Tool-verified

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.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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.

P10 · Library API & versioning9.9 / 10Exemplary✓ Tool-verified

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.

  • 1 public type in `cc_switch.cli.commands.internal` is marked as implementation by its own namespace, folder or name: `InternalCommand` (src-tauri/src/cli/commands/internal.rs:10, `internal`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src-tauri/src/cli/commands/internal.rs:10

What to do

  • Hide `cc_switch.cli.commands.internal` (`InternalCommand`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
P2 · Observability8.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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.

  • No static application security testing detected. For this repository's stack, add cargo-audit / cargo-deny (or clippy) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 4 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:12

What to do

  • Add a SAST step to CI running what this repository's stack ships: cargo-audit / cargo-deny (or clippy) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

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.

  • The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P5 · DR & Backup4.0 / 10Weak✓ 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.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

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.

  • `Client::builder()` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — src-tauri/src/services/stream_check/provider_extract.rs:188

What to do

  • Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
PF1 · Benchmark discipline8.0 / 10Strong✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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.

S1 · Web-Security Posture8.0 / 10Strong✓ Tool-verified

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 (`axum::serve(` (src-tauri/src/proxy/server.rs:274)), 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.

  • None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (src-tauri/src/proxy/server.rs:274).

What to do

  • Set security response headers on what the server sends — actix-web's `DefaultHeaders::new().add((header::X_CONTENT_TYPE_OPTIONS, "nosniff"))`, tower-http's `SetResponseHeaderLayer::overriding(…)` on an axum router, or keep Rocket's default `Shield` — with `Content-Security-Policy`, `X-Content-Type-Options` and a frame policy on every response.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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.

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.

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.

Reference — by lens

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.

LensScoreRatingImpact
Code Health83%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture86%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity66%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness43%Weak — gated by P3, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security62%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance89%StrongStrongest area.
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 — 36 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 67 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.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: 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.
  • 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.
  • 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 — not assessed — interface segregation is computed over a type surface 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
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
  • 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.
  • D10 Test Quality — ~34786 lines of test source are present (.rs) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • 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.
  • D21 Naming Consistency — N/A — too few peers to establish a naming convention (26514 declarations, no unit with a dominant convention).
  • 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"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .py, .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • 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) — 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.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • 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.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D5 Coupling — Not applicable — this Cargo build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
  • 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
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (49 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 — Not assessed, and this one is on us: 1 command handler(s) or message consumer(s) were found here, but this check does not yet recognise persistence writes in this repository's language. Idempotency was neither confirmed nor ruled out — this is a limit of the analyzer, not a finding about your code.
  • 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 data present for 367 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • 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.
  • X12 Unreachable branch — 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
  • X13 Undrained process stream — 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
  • X14 Bypassable address classification — 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 — 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
  • X17 Uncapped recursion over a caller-supplied document — 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
  • X18 Disposal-pattern correctness — 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
  • X19 Unrestored process-global state — 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
  • X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • 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 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
  • X23 Unguarded diagnostic materialisation — 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
  • X24 Document value interpolated into markup unescaped — 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
  • X25 Inert configuration knob — 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
  • X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. Rust's compiler refuses the unsynchronised version: a collection shared between a callback's thread and the waiting body must be `Sync`, which a `Vec`, `VecDeque` or `HashMap` is only behind a `Mutex`/`RwLock`, so the race this check looks for cannot be written in safe Rust. Not a gap in the analyzer and not a finding about your code.
  • 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
  • X29 Per-element action decided by a fixed element — 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 — 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
  • 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.
  • X5 Nullable reference types — 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
  • 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.

Critical — 50 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 10 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×1
  • REDACTED
Serious — 1823 finding(s)
D2 · Cognitive Complexity · cc_switch · ×206
  • cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses (cognitive 387) src-tauri/src/proxy/providers/streaming_responses.rs:156 — cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses has cognitive complexity 387 (threshold 15). Drivers by points: if/else 70 (355 pts), match/switch 4 (15 pts), loops 4 (14 pts), boolean chains 3 (nesting depth added 306). 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 333) src-tauri/src/proxy/providers/streaming.rs:92 — cc_switch::proxy::providers::streaming::create_anthropic_sse_stream has cognitive complexity 333 (threshold 15). Drivers by points: if/else 51 (292 pts), loops 7 (34 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 269). 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::cli::tui::run (cognitive 282) src-tauri/src/cli/tui/mod.rs:3053 — cc_switch::cli::tui::run has cognitive complexity 282 (threshold 15). Drivers by points: if/else 68 (194 pts), loops 17 (48 pts), match/switch 21 (39 pts), boolean chains 1 (nesting depth added 175). 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::cli::tui::runtime_systems::handlers::handle_session_msg (cognitive 175) src-tauri/src/cli/tui/runtime_systems/handlers.rs:425 — cc_switch::cli::tui::runtime_systems::handlers::handle_session_msg has cognitive complexity 175 (threshold 15). Drivers by points: if/else 51 (137 pts), match/switch 11 (21 pts), boolean chains 12, loops 2 (5 pts) (nesting depth added 99). 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_gemini::create_anthropic_sse_stream_from_gemini (cognitive 129) src-tauri/src/proxy/providers/streaming_gemini.rs:240 — cc_switch::proxy::providers::streaming_gemini::create_anthropic_sse_stream_from_gemini has cognitive complexity 129 (threshold 15). Drivers by points: if/else 33 (114 pts), loops 4 (9 pts), match/switch 2 (6 pts) (nesting depth added 90). 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::session_manager::transcript::scan_named_json_array (cognitive 129) src-tauri/src/session_manager/transcript.rs:2436 — cc_switch::session_manager::transcript::scan_named_json_array has cognitive complexity 129 (threshold 15). Drivers by points: if/else 34 (109 pts), boolean chains 9, match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 82). 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::daemon::migration::quiesce_for_database_migration (cognitive 118) src-tauri/src/daemon/migration.rs:396 — cc_switch::daemon::migration::quiesce_for_database_migration has cognitive complexity 118 (threshold 15). Drivers by points: if/else 26 (84 pts), match/switch 10 (30 pts), loops 2 (4 pts) (nesting depth added 80). 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::import_from_codex (cognitive 117) src-tauri/src/mcp.rs:424 — cc_switch::mcp::import_from_codex has cognitive complexity 117 (threshold 15). Drivers by points: if/else 37 (94 pts), loops 5 (14 pts), match/switch 4 (9 pts) (nesting depth added 71). 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::cli::tui::runtime_systems::handlers::handle_webdav_msg (cognitive 87) src-tauri/src/cli/tui/runtime_systems/handlers.rs:1513 — cc_switch::cli::tui::runtime_systems::handlers::handle_webdav_msg has cognitive complexity 87 (threshold 15). Drivers by points: match/switch 17 (52 pts), if/else 12 (33 pts), boolean chains 2 (nesting depth added 56). 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.
  • cc_switch::cli::commands::provider_input::display_provider_summary (cognitive 76) src-tauri/src/cli/commands/provider_input.rs:4519 — cc_switch::cli::commands::provider_input::display_provider_summary has cognitive complexity 76 (threshold 15). Drivers by points: if/else 37 (73 pts), boolean chains 2, match/switch 1 (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.
  • cc_switch::proxy::forwarder::request_builder::build_request (cognitive 74) src-tauri/src/proxy/forwarder/request_builder.rs:516 — cc_switch::proxy::forwarder::request_builder::build_request has cognitive complexity 74 (threshold 15). Drivers by points: if/else 32 (48 pts), match/switch 4 (12 pts), boolean chains 8, loops 2 (6 pts) (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.
  • cc_switch::services::session_usage_codex::sync_single_codex_file (cognitive 69) src-tauri/src/services/session_usage_codex.rs:1530 — cc_switch::services::session_usage_codex::sync_single_codex_file has cognitive complexity 69 (threshold 15). Drivers by points: if/else 26 (46 pts), match/switch 11 (18 pts), boolean chains 5 (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_anthropic::responses_request_to_anthropic (cognitive 68) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:226 — cc_switch::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic has cognitive complexity 68 (threshold 15). Drivers by points: if/else 32 (58 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_anthropic::convert_input_to_messages (cognitive 68) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:505 — cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (52 pts), match/switch 3 (10 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 47). 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::cli::tui::handle_usage_pricing_msg (cognitive 65) src-tauri/src/cli/tui/mod.rs:1239 — cc_switch::cli::tui::handle_usage_pricing_msg has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (48 pts), boolean chains 10, match/switch 4 (7 pts) (nesting depth added 32). 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.
  • cc_switch::cli::tui::runtime_actions::handle_action (cognitive 64) src-tauri/src/cli/tui/runtime_actions/mod.rs:514 — cc_switch::cli::tui::runtime_actions::handle_action has cognitive complexity 64 (threshold 15). Drivers by points: if/else 26 (52 pts), match/switch 4 (7 pts), boolean chains 5 (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.
  • cc_switch::proxy::cache_injector::inject (cognitive 63) src-tauri/src/proxy/cache_injector.rs:5 — cc_switch::proxy::cache_injector::inject has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (54 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 40). 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::anthropic_sse_to_message_value (cognitive 63) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1385 — cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (54 pts), match/switch 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 34). 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_anthropic::create_responses_sse_stream_from_anthropic_with_context (cognitive 62) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:667 — 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::openai_to_anthropic (cognitive 62) src-tauri/src/proxy/providers/transform.rs:493 — cc_switch::proxy::providers::transform::openai_to_anthropic has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (47 pts), match/switch 3 (8 pts), loops 2 (5 pts), boolean chains 2 (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::convert_message_to_openai (cognitive 60) src-tauri/src/proxy/providers/transform.rs:267 — 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::session_manager::providers::codex::parse_session_lines (cognitive 59) src-tauri/src/session_manager/providers/codex.rs:866 — cc_switch::session_manager::providers::codex::parse_session_lines has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (48 pts), boolean chains 6, 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.
  • cc_switch::cli::tui::runtime_systems::handlers::handle_skills_msg (cognitive 58) src-tauri/src/cli/tui/runtime_systems/handlers.rs:1278 — cc_switch::cli::tui::runtime_systems::handlers::handle_skills_msg has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (35 pts), match/switch 6 (11 pts), loops 3 (10 pts), boolean chains 2 (nesting depth added 34). 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.
  • cc_switch::cli::tui::ui::forms::provider::provider_field_label_and_value (cognitive 58) src-tauri/src/cli/tui/ui/forms/provider.rs:1922 — cc_switch::cli::tui::ui::forms::provider::provider_field_label_and_value has cognitive complexity 58 (threshold 15). Drivers by points: if/else 36 (53 pts), match/switch 4 (5 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.
  • cc_switch::proxy::providers::streaming_codex_chat::create_responses_sse_stream_from_chat_with_context (cognitive 56) src-tauri/src/proxy/providers/streaming_codex_chat.rs:916 — cc_switch::proxy::providers::streaming_codex_chat::create_responses_sse_stream_from_chat_with_context has cognitive complexity 56 (threshold 15). Drivers by points: if/else 8 (30 pts), loops 6 (19 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 39). 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.
  • + 181 more in this group — see findings.md.
D1 · Cyclomatic Complexity · cc_switch · ×106
  • cc_switch::cli::tui::runtime_actions::handle_action (cyclomatic 164) src-tauri/src/cli/tui/runtime_actions/mod.rs:514 — cc_switch::cli::tui::runtime_actions::handle_action has cyclomatic complexity 164 (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::cli::tui::ui::forms::provider::provider_field_label_and_value (cyclomatic 120) src-tauri/src/cli/tui/ui/forms/provider.rs:1922 — cc_switch::cli::tui::ui::forms::provider::provider_field_label_and_value has cyclomatic complexity 120 (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::cli::tui::run (cyclomatic 110) src-tauri/src/cli/tui/mod.rs:3053 — cc_switch::cli::tui::run has cyclomatic complexity 110 (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::cli::tui::runtime_systems::handlers::handle_session_msg (cyclomatic 87) src-tauri/src/cli/tui/runtime_systems/handlers.rs:425 — cc_switch::cli::tui::runtime_systems::handlers::handle_session_msg has cyclomatic complexity 87 (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_responses::create_anthropic_sse_stream_from_responses (cyclomatic 84) src-tauri/src/proxy/providers/streaming_responses.rs:156 — cc_switch::proxy::providers::streaming_responses::create_anthropic_sse_stream_from_responses has cyclomatic complexity 84 (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::cli::tui::help::current_help_target (cyclomatic 62) src-tauri/src/cli/tui/help.rs:104 — cc_switch::cli::tui::help::current_help_target has cyclomatic complexity 62 (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::proxy::providers::streaming::create_anthropic_sse_stream (cyclomatic 60) src-tauri/src/proxy/providers/streaming.rs:92 — cc_switch::proxy::providers::streaming::create_anthropic_sse_stream 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.
  • cc_switch::mcp::import_from_codex (cyclomatic 52) src-tauri/src/mcp.rs:424 — cc_switch::mcp::import_from_codex has cyclomatic complexity 52 (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::transcript::scan_named_json_array (cyclomatic 52) src-tauri/src/session_manager/transcript.rs:2436 — cc_switch::session_manager::transcript::scan_named_json_array has cyclomatic complexity 52 (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::daemon::migration::quiesce_for_database_migration (cyclomatic 51) src-tauri/src/daemon/migration.rs:396 — cc_switch::daemon::migration::quiesce_for_database_migration has cyclomatic complexity 51 (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::cli::commands::provider_input::display_provider_summary (cyclomatic 45) src-tauri/src/cli/commands/provider_input.rs:4519 — cc_switch::cli::commands::provider_input::display_provider_summary 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.
  • cc_switch::proxy::forwarder::request_builder::build_request (cyclomatic 44) src-tauri/src/proxy/forwarder/request_builder.rs:516 — cc_switch::proxy::forwarder::request_builder::build_request 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 44) src-tauri/src/services/session_usage_codex.rs:1530 — cc_switch::services::session_usage_codex::sync_single_codex_file 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::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic (cyclomatic 43) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:226 — cc_switch::proxy::providers::transform_codex_anthropic::responses_request_to_anthropic 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::cli::tui::runtime_systems::handlers::handle_webdav_msg (cyclomatic 41) src-tauri/src/cli/tui/runtime_systems/handlers.rs:1513 — cc_switch::cli::tui::runtime_systems::handlers::handle_webdav_msg has cyclomatic complexity 41 (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::cli::tui::handle_usage_pricing_msg (cyclomatic 40) src-tauri/src/cli/tui/mod.rs:1239 — cc_switch::cli::tui::handle_usage_pricing_msg 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.
  • cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value (cyclomatic 39) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1385 — cc_switch::proxy::providers::transform_codex_anthropic::anthropic_sse_to_message_value 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::streaming_gemini::create_anthropic_sse_stream_from_gemini (cyclomatic 37) src-tauri/src/proxy/providers/streaming_gemini.rs:240 — cc_switch::proxy::providers::streaming_gemini::create_anthropic_sse_stream_from_gemini has cyclomatic complexity 37 (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 32) src-tauri/src/proxy/providers/transform.rs:493 — cc_switch::proxy::providers::transform::openai_to_anthropic 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.
  • cc_switch::services::session_usage::sync_single_file (cyclomatic 32) src-tauri/src/services/session_usage.rs:859 — cc_switch::services::session_usage::sync_single_file 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.
  • cc_switch::cli::tui::ui::render_content (cyclomatic 31) src-tauri/src/cli/tui/ui.rs:137 — cc_switch::cli::tui::ui::render_content has cyclomatic complexity 31 (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::services::provider::codex_live::prepare (cyclomatic 31) src-tauri/src/services/provider/codex_live.rs:27 — cc_switch::services::provider::codex_live::prepare has cyclomatic complexity 31 (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.
  • cc_switch::session_manager::providers::utils::build_snippet_cancellable (cyclomatic 31) src-tauri/src/session_manager/providers/utils.rs:427 — cc_switch::session_manager::providers::utils::build_snippet_cancellable 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::cli::tui::ui::forms::mcp::mcp_field_label_and_value (cyclomatic 30) src-tauri/src/cli/tui/ui/forms/mcp.rs:372 — cc_switch::cli::tui::ui::forms::mcp::mcp_field_label_and_value has cyclomatic complexity 30 (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::proxy::providers::transform_codex_anthropic::convert_input_to_messages (cyclomatic 30) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:505 — cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages 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.
  • + 81 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×88
  • FileTooLong: cli/i18n.rs src-tauri/src/cli/i18n.rs — FileTooLong — 8450 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 1635 free functions. The bar is 500 significant lines; this is 7950 over it, 16.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: app/types.rs src-tauri/src/cli/tui/app/types.rs — FileTooLong — 3602 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 3102 over it, 7.20× 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: ui/config.rs src-tauri/src/cli/tui/ui/config.rs — FileTooLong — 3186 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 109 free functions. The bar is 500 significant lines; this is 2686 over it, 6.37× 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/proxy.rs src-tauri/src/services/proxy.rs — FileTooLong — 3082 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 97% of them inside a single declaration: ProxyService (2 blocks, 50-4306). The bar is 500 significant lines; this is 2582 over it, 6.16× 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 — 2946 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 91% of them inside a single declaration: ProviderService (373-4139). The bar is 500 significant lines; this is 2446 over it, 5.89× 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: runtime_systems/workers.rs src-tauri/src/cli/tui/runtime_systems/workers.rs — FileTooLong — 2876 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 73 free functions. The bar is 500 significant lines; this is 2376 over it, 5.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: tui/data.rs src-tauri/src/cli/tui/data.rs — FileTooLong — 2757 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 85 free functions. The bar is 500 significant lines; this is 2257 over it, 5.51× 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: tui/mod.rs src-tauri/src/cli/tui/mod.rs — FileTooLong — 2726 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 59 free functions. The bar is 500 significant lines; this is 2226 over it, 5.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: services/skill.rs src-tauri/src/services/skill.rs — FileTooLong — 2544 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 84% of them inside a single declaration: SkillService (630-3753). The bar is 500 significant lines; this is 2044 over it, 5.09× 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: form/provider_state.rs src-tauri/src/cli/tui/form/provider_state.rs — FileTooLong — 2384 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 1884 over it, 4.77× 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/provider_input.rs src-tauri/src/cli/commands/provider_input.rs — FileTooLong — 2244 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 80 free functions. The bar is 500 significant lines; this is 1744 over it, 4.49× 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: session_manager/transcript.rs src-tauri/src/session_manager/transcript.rs — FileTooLong — 2214 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 1714 over it, 4.43× 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 — 2020 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 (9-3765). The bar is 500 significant lines; this is 1520 over it, 4.04× 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: overlay/pickers.rs src-tauri/src/cli/tui/ui/overlay/pickers.rs — FileTooLong — 2001 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 1501 over it, 4.00× 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: session_manager/paged_manifest.rs src-tauri/src/session_manager/paged_manifest.rs — FileTooLong — 1777 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 1277 over it, 3.55× 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/provider.rs src-tauri/src/cli/tui/ui/forms/provider.rs — FileTooLong — 1717 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 37 free functions. The bar is 500 significant lines; this is 1217 over it, 3.43× 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/provider.rs src-tauri/src/cli/commands/provider.rs — FileTooLong — 1627 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 69 free functions. The bar is 500 significant lines; this is 1127 over it, 3.25× 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/usage_stats.rs src-tauri/src/services/usage_stats.rs — FileTooLong — 1550 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 61% of them inside a single declaration: Database (2 blocks, 491-1738). The bar is 500 significant lines; this is 1050 over it, 3.10× 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: form_handlers/provider.rs src-tauri/src/cli/tui/app/form_handlers/provider.rs — FileTooLong — 1515 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 91% of them inside a single declaration: App (12-1967). The bar is 500 significant lines; this is 1015 over it, 3.03× 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: REDACTED REDACTED — FileTooLong — 1437 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 49 free functions. The bar is 500 significant lines; this is 937 over it, 2.87× 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: runtime_systems/handlers.rs src-tauri/src/cli/tui/runtime_systems/handlers.rs — FileTooLong — 1425 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 925 over it, 2.85× 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/codex_config.rs src-tauri/src/codex_config.rs — FileTooLong — 1413 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 88 free functions. The bar is 500 significant lines; this is 913 over it, 2.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: providers/transform_codex_chat.rs src-tauri/src/proxy/providers/transform_codex_chat.rs — FileTooLong — 1355 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 57 free functions. The bar is 500 significant lines; this is 855 over it, 2.71× 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: overlay_handlers/pickers.rs src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs — FileTooLong — 1348 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 96% of them inside a single declaration: App (80-1892). The bar is 500 significant lines; this is 848 over it, 2.70× 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: app/helpers.rs src-tauri/src/cli/tui/app/helpers.rs — FileTooLong — 1308 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 69 free functions. The bar is 500 significant lines; this is 808 over it, 2.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.
  • + 63 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×71
  • FunctionTooLong: cc_switch::cli::tui::run src-tauri/src/cli/tui/mod.rs:3053 — FunctionTooLong — cc_switch::cli::tui::run runs 598 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 498 over it, 5.98× 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::cli::tui::runtime_actions::handle_action src-tauri/src/cli/tui/runtime_actions/mod.rs:514 — FunctionTooLong — cc_switch::cli::tui::runtime_actions::handle_action runs 517 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 417 over it, 5.17× 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::cli::tui::runtime_systems::handlers::handle_session_msg src-tauri/src/cli/tui/runtime_systems/handlers.rs:425 — FunctionTooLong — cc_switch::cli::tui::runtime_systems::handlers::handle_session_msg runs 435 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 335 over it, 4.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.
  • FunctionTooLong: cc_switch::cli::tui::ui::overlay::render::render_overlay src-tauri/src/cli/tui/ui/overlay/render.rs:4 — FunctionTooLong — cc_switch::cli::tui::ui::overlay::render::render_overlay runs 321 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 221 over it, 3.21× 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::cli::tui::ui::config::render_openclaw_agents_route src-tauri/src/cli/tui/ui/config.rs:2294 — FunctionTooLong — cc_switch::cli::tui::ui::config::render_openclaw_agents_route runs 302 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 202 over it, 3.02× 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::cli::tui::runtime_systems::workers::handle_session_req src-tauri/src/cli/tui/runtime_systems/workers.rs:1524 — FunctionTooLong — cc_switch::cli::tui::runtime_systems::workers::handle_session_req runs 283 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 183 over it, 2.83× 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::cli::tui::help::provider_field_help src-tauri/src/cli/tui/help.rs:618 — FunctionTooLong — cc_switch::cli::tui::help::provider_field_help runs 248 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 148 over it, 2.48× 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::proxy::handlers::handle_passthrough_request src-tauri/src/proxy/handlers.rs:562 — FunctionTooLong — cc_switch::proxy::handlers::handle_passthrough_request runs 245 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 145 over it, 2.45× 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::cli::tui::ui::forms::provider::provider_field_label_and_value src-tauri/src/cli/tui/ui/forms/provider.rs:1922 — FunctionTooLong — cc_switch::cli::tui::ui::forms::provider::provider_field_label_and_value runs 229 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 129 over it, 2.29× 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::cli::tui::ui::main_page::render_main src-tauri/src/cli/tui/ui/main_page.rs:47 — FunctionTooLong — cc_switch::cli::tui::ui::main_page::render_main runs 216 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 116 over it, 2.16× 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::services::session_usage_codex::sync_single_codex_file src-tauri/src/services/session_usage_codex.rs:1530 — FunctionTooLong — cc_switch::services::session_usage_codex::sync_single_codex_file runs 213 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 113 over it, 2.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: cc_switch::daemon::migration::quiesce_for_database_migration src-tauri/src/daemon/migration.rs:396 — FunctionTooLong — cc_switch::daemon::migration::quiesce_for_database_migration runs 210 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 110 over it, 2.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: cc_switch::cli::tui::ui::config::render_openclaw_tools_route src-tauri/src/cli/tui/ui/config.rs:1400 — FunctionTooLong — cc_switch::cli::tui::ui::config::render_openclaw_tools_route runs 209 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 109 over it, 2.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.
  • FunctionTooLong: cc_switch::services::provider::codex_live::prepare src-tauri/src/services/provider/codex_live.rs:27 — FunctionTooLong — cc_switch::services::provider::codex_live::prepare 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.
  • FunctionTooLong: cc_switch::proxy::handlers::handle_claude_request src-tauri/src/proxy/handlers.rs:219 — FunctionTooLong — cc_switch::proxy::handlers::handle_claude_request runs 189 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 89 over it, 1.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: cc_switch::cli::tui::runtime_systems::workers::session_dispatcher_loop_with src-tauri/src/cli/tui/runtime_systems/workers.rs:1245 — FunctionTooLong — cc_switch::cli::tui::runtime_systems::workers::session_dispatcher_loop_with runs 188 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 88 over it, 1.88× 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::cli::tui::ui::overlay::pickers::render_claude_model_picker_overlay src-tauri/src/cli/tui/ui/overlay/pickers.rs:83 — FunctionTooLong — cc_switch::cli::tui::ui::overlay::pickers::render_claude_model_picker_overlay runs 184 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 84 over it, 1.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.
  • FunctionTooLong: cc_switch::cli::tui::runtime_systems::handlers::handle_webdav_msg src-tauri/src/cli/tui/runtime_systems/handlers.rs:1513 — FunctionTooLong — cc_switch::cli::tui::runtime_systems::handlers::handle_webdav_msg runs 181 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 81 over it, 1.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: cc_switch::proxy::forwarder::request_builder::build_request src-tauri/src/proxy/forwarder/request_builder.rs:516 — FunctionTooLong — cc_switch::proxy::forwarder::request_builder::build_request runs 167 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 67 over it, 1.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: cc_switch::proxy::handlers::finish_codex_live_aware_response src-tauri/src/proxy/handlers.rs:1062 — FunctionTooLong — cc_switch::proxy::handlers::finish_codex_live_aware_response runs 167 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 67 over it, 1.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: cc_switch::cli::commands::provider_inspect::quota_provider src-tauri/src/cli/commands/provider_inspect.rs:428 — FunctionTooLong — cc_switch::cli::commands::provider_inspect::quota_provider runs 165 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 65 over it, 1.65× 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::cli::tui::handle_tui_action src-tauri/src/cli/tui/mod.rs:2497 — FunctionTooLong — cc_switch::cli::tui::handle_tui_action runs 160 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 60 over it, 1.60× 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::proxy::providers::transform_codex_anthropic::convert_input_to_messages src-tauri/src/proxy/providers/transform_codex_anthropic.rs:505 — FunctionTooLong — cc_switch::proxy::providers::transform_codex_anthropic::convert_input_to_messages runs 160 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 60 over it, 1.60× 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::cli::commands::provider_input::display_provider_summary src-tauri/src/cli/commands/provider_input.rs:4519 — FunctionTooLong — cc_switch::cli::commands::provider_input::display_provider_summary runs 158 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 58 over it, 1.58× 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::proxy::providers::transform_codex_chat::append_responses_item_as_chat_message src-tauri/src/proxy/providers/transform_codex_chat.rs:652 — FunctionTooLong — cc_switch::proxy::providers::transform_codex_chat::append_responses_item_as_chat_message runs 157 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 57 over it, 1.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.
  • + 46 more in this group — see findings.md.
D8 · Code Coverage · Low coverage · ×62
  • Low coverage: src-tauri/src/claude_mcp.rs src-tauri/src/claude_mcp.rs:1 — 39.2% line coverage (94/240).
  • Low coverage: src-tauri/src/cli/commands/auth.rs src-tauri/src/cli/commands/auth.rs:1 — 7.1% line coverage (21/294).
  • Low coverage: src-tauri/src/cli/commands/config.rs src-tauri/src/cli/commands/config.rs:1 — 1.2% line coverage (4/342).
  • Low coverage: src-tauri/src/cli/commands/config_common.rs src-tauri/src/cli/commands/config_common.rs:1 — 48.6% line coverage (103/212).
  • Low coverage: src-tauri/src/cli/commands/config_openclaw.rs src-tauri/src/cli/commands/config_openclaw.rs:1 — 29.4% line coverage (220/749).
  • Low coverage: src-tauri/src/cli/commands/config_s3.rs src-tauri/src/cli/commands/config_s3.rs:1 — 21.3% line coverage (37/174).
  • Low coverage: src-tauri/src/cli/commands/env.rs src-tauri/src/cli/commands/env.rs:1 — 4.7% line coverage (12/258).
  • Low coverage: src-tauri/src/cli/commands/failover.rs src-tauri/src/cli/commands/failover.rs:1 — 10.2% line coverage (32/314).
  • Low coverage: src-tauri/src/cli/commands/mcp.rs src-tauri/src/cli/commands/mcp.rs:1 — 2.5% line coverage (7/282).
  • Low coverage: src-tauri/src/cli/commands/prompts.rs src-tauri/src/cli/commands/prompts.rs:1 — 16.9% line coverage (90/531).
  • Low coverage: src-tauri/src/cli/commands/provider_inspect.rs src-tauri/src/cli/commands/provider_inspect.rs:1 — 47.3% line coverage (478/1011).
  • Low coverage: src-tauri/src/cli/commands/proxy.rs src-tauri/src/cli/commands/proxy.rs:1 — 49.9% line coverage (222/445).
  • Low coverage: src-tauri/src/cli/commands/sessions.rs src-tauri/src/cli/commands/sessions.rs:1 — 18.1% line coverage (125/689).
  • Low coverage: src-tauri/src/cli/commands/settings.rs src-tauri/src/cli/commands/settings.rs:1 — 9.8% line coverage (49/500).
  • Low coverage: src-tauri/src/cli/commands/skills.rs src-tauri/src/cli/commands/skills.rs:1 — 4.7% line coverage (20/425).
  • Low coverage: src-tauri/src/cli/commands/update.rs src-tauri/src/cli/commands/update.rs:1 — 48.3% line coverage (471/975).
  • Low coverage: src-tauri/src/cli/failover_policy.rs src-tauri/src/cli/failover_policy.rs:1 — 8.5% line coverage (5/59).
  • Low coverage: src-tauri/src/cli/i18n.rs src-tauri/src/cli/i18n.rs:1 — 42.8% line coverage (3598/8408).
  • Low coverage: src-tauri/src/cli/terminal.rs src-tauri/src/cli/terminal.rs:1 — 0.0% line coverage (0/15).
  • Low coverage: src-tauri/src/cli/tui/app/content_skills.rs src-tauri/src/cli/tui/app/content_skills.rs:1 — 49.5% line coverage (106/214).
  • Low coverage: src-tauri/src/cli/tui/app/form_handlers/s3.rs src-tauri/src/cli/tui/app/form_handlers/s3.rs:1 — 36.7% line coverage (36/98).
  • Low coverage: src-tauri/src/cli/tui/app/form_handlers/webdav.rs src-tauri/src/cli/tui/app/form_handlers/webdav.rs:1 — 0.0% line coverage (0/92).
  • Low coverage: src-tauri/src/cli/tui/form/webdav.rs src-tauri/src/cli/tui/form/webdav.rs:1 — 33.6% line coverage (43/128).
  • Low coverage: src-tauri/src/cli/tui/help.rs src-tauri/src/cli/tui/help.rs:1 — 46.9% line coverage (377/804).
  • Low coverage: src-tauri/src/cli/tui/runtime_actions/config.rs src-tauri/src/cli/tui/runtime_actions/config.rs:1 — 10.1% line coverage (47/466).
  • + 37 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×52
  • MethodTooLong: Database.seed_model_pricing src-tauri/src/database/schema.rs:1823 — MethodTooLong — seed_model_pricing runs 515 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 415 over it, 5.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.
  • MethodTooLong: ProviderAddFormState.to_provider_json_value src-tauri/src/cli/tui/form/provider_json.rs:281 — MethodTooLong — to_provider_json_value runs 366 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 266 over it, 3.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: App.on_sessions_key src-tauri/src/cli/tui/app/content_entities.rs:688 — MethodTooLong — on_sessions_key runs 281 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 181 over it, 2.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.
  • MethodTooLong: Database.create_tables_on_conn src-tauri/src/database/schema.rs:17 — MethodTooLong — create_tables_on_conn runs 281 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 181 over it, 2.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.
  • MethodTooLong: App.handle_provider_field_activate src-tauri/src/cli/tui/app/form_handlers/provider.rs:368 — MethodTooLong — handle_provider_field_activate runs 261 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 161 over it, 2.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: ProviderService.refresh_provider_snapshot src-tauri/src/services/provider/mod.rs:1358 — MethodTooLong — refresh_provider_snapshot runs 224 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 124 over it, 2.24× 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 src-tauri/src/services/usage_stats.rs:758 — MethodTooLong — get_daily_trends runs 216 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 116 over it, 2.16× 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.prepare_request_with_client src-tauri/src/proxy/forwarder/request_builder.rs:126 — MethodTooLong — prepare_request_with_client runs 211 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 111 over it, 2.11× 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: ProviderAddFormState.update_provider_meta src-tauri/src/cli/tui/form/provider_json.rs:844 — MethodTooLong — update_provider_meta runs 201 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 101 over it, 2.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.
  • MethodTooLong: App.handle_confirm_overlay_key src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:75 — MethodTooLong — handle_confirm_overlay_key runs 200 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 100 over it, 2.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.
  • MethodTooLong: Database.apply_schema_migrations_on_conn src-tauri/src/database/schema.rs:442 — MethodTooLong — apply_schema_migrations_on_conn runs 198 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 98 over it, 1.98× 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: App.handle_text_input_submit src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:388 — MethodTooLong — handle_text_input_submit runs 184 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 84 over it, 1.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: ProviderAddFormState.apply_template_fields src-tauri/src/cli/tui/form/provider_templates.rs:501 — MethodTooLong — apply_template_fields runs 181 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 81 over it, 1.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.
  • MethodTooLong: SkillService.migrate_storage src-tauri/src/services/skill.rs:2025 — MethodTooLong — migrate_storage runs 181 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 81 over it, 1.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.
  • MethodTooLong: Database.validate_imported_schema_contract REDACTED:1007 — MethodTooLong — validate_imported_schema_contract runs 167 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 67 over it, 1.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.
  • MethodTooLong: RequestForwarder.forward_response_detailed src-tauri/src/proxy/forwarder.rs:244 — MethodTooLong — forward_response_detailed runs 155 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 55 over it, 1.55× 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_buffered_response_detailed src-tauri/src/proxy/forwarder.rs:489 — MethodTooLong — forward_buffered_response_detailed runs 155 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 55 over it, 1.55× 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: App.on_settings_key src-tauri/src/cli/tui/app/content_config.rs:840 — MethodTooLong — on_settings_key runs 153 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 53 over it, 1.53× 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:1654 — 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: ProviderService.prepare_post_commit_action src-tauri/src/services/provider/mod.rs:1007 — MethodTooLong — prepare_post_commit_action 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: RequestForwarder.send_streaming_request src-tauri/src/proxy/forwarder.rs:706 — MethodTooLong — send_streaming_request runs 141 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 41 over it, 1.41× 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.send_buffered_request src-tauri/src/proxy/forwarder.rs:903 — MethodTooLong — send_buffered_request runs 141 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 41 over it, 1.41× 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: ProviderAddFormState.apply_sponsor_preset src-tauri/src/cli/tui/form/provider_templates.rs:739 — MethodTooLong — apply_sponsor_preset runs 140 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 40 over it, 1.40× 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: TranscriptIndexStore.build src-tauri/src/session_manager/transcript.rs:705 — MethodTooLong — build runs 139 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 39 over it, 1.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.
  • MethodTooLong: App.clamp_selections src-tauri/src/cli/tui/app/menu.rs:1174 — MethodTooLong — clamp_selections runs 132 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 32 over it, 1.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.
  • + 27 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×48
  • Duplicated block (7 lines × 2) src-tauri/src/app_config.rs:38 — src-tauri/src/app_config.rs:38-44 | src-tauri/src/app_config.rs:107-113 — 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/app_config.rs:38` 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/app_config.rs:428 — src-tauri/src/app_config.rs:428-434 | src-tauri/src/settings.rs:137-143 — 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/app_config.rs:428` 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/cli/commands/provider.rs:1842 — src-tauri/src/cli/commands/provider.rs:1842-1848 | src-tauri/src/cli/commands/provider.rs:2085-2091 — 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/cli/commands/provider.rs:1842` 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 (7 lines × 2) src-tauri/src/cli/tui/app/editor_state.rs:264 — src-tauri/src/cli/tui/app/editor_state.rs:264-270 | src-tauri/src/cli/tui/app/editor_state.rs:305-311 — 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/cli/tui/app/editor_state.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 (7 lines × 2) src-tauri/src/cli/tui/app/editor_state.rs:641 — src-tauri/src/cli/tui/app/editor_state.rs:641-647 | src-tauri/src/cli/tui/app/editor_state.rs:777-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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/cli/tui/app/editor_state.rs:641` 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 `self` to `crate) fn move_right(&mut` in one and `crate) fn delete(&mut` 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 (7 lines × 2) src-tauri/src/cli/tui/app/editor_state.rs:663 — src-tauri/src/cli/tui/app/editor_state.rs:663-669 | src-tauri/src/cli/tui/app/editor_state.rs:689-695 — 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/cli/tui/app/editor_state.rs:663` 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/cli/tui/app/form_handlers/provider.rs:779 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:779-785 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:832-838 — 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/cli/tui/app/form_handlers/provider.rs:779` 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 (7 lines × 2) src-tauri/src/cli/tui/app/form_handlers/provider.rs:1316 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:1316-1322 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1328-1334 — 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/cli/tui/app/form_handlers/provider.rs:1316` 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 (7 lines × 2) src-tauri/src/cli/tui/app/helpers.rs:1621 — src-tauri/src/cli/tui/app/helpers.rs:1621-1627 | src-tauri/src/cli/tui/ui/skills/discover.rs:56-62 — 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/cli/tui/app/helpers.rs:1621` 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/cli/tui/ui/skills/discover.rs:63` calls `to_lowercase`, `contains` and `src-tauri/src/cli/tui/app/helpers.rs:1628` 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/cli/tui/ui/chrome.rs:463 — src-tauri/src/cli/tui/ui/chrome.rs:463-469 | src-tauri/src/cli/tui/ui/chrome.rs:473-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 (7 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs:585 — src-tauri/src/cli/tui/ui/forms/provider.rs:585-591 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1041-1047 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/provider.rs` and `src-tauri/src/cli/tui/ui/overlay/pickers.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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/live/project/codex.rs:315 — src-tauri/src/live/project/codex.rs:315-321 | src-tauri/src/live/project/codex.rs:325-331 — 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.rs:543 — src-tauri/src/mcp.rs:543-549 | src-tauri/src/mcp.rs:565-571 — 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.rs:543` 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/mcp.rs:1181 — src-tauri/src/mcp.rs:1181-1187 | src-tauri/src/mcp.rs:1197-1203 — 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.rs:1181` 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:377 — src-tauri/src/proxy/providers/codex_chat_history.rs:377-383 | src-tauri/src/proxy/providers/streaming_gemini.rs:263-270 — 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: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 (7 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:878 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:878-884 | src-tauri/src/proxy/providers/transform_responses.rs:208-214 — 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:878` 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_gemini.rs:186 — src-tauri/src/proxy/providers/transform_gemini.rs:186-192 | src-tauri/src/proxy/providers/transform_gemini.rs:755-761 — 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/services/provider/mod.rs:2093 — src-tauri/src/services/provider/mod.rs:2093-2099 | src-tauri/src/services/provider/mod.rs:2109-2115 — 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:2093` 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:194 — src-tauri/src/services/provider/pi.rs:194-200 | src-tauri/src/services/provider/pi.rs:218-224 — 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/session_manager/providers/claude.rs:94 — src-tauri/src/session_manager/providers/claude.rs:94-100 | src-tauri/src/session_manager/providers/openclaw.rs:383-389 — before extracting anything, compare `src-tauri/src/session_manager/providers/claude.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 6 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/session_manager/providers/claude.rs:94` 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) REDACTED:1370 — REDACTED:1370-1376 | REDACTED:1887-1893 — 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:1370` 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/cli/tui/ui/forms/s3.rs:59 — src-tauri/src/cli/tui/ui/forms/s3.rs:59-65 | src-tauri/src/cli/tui/ui/forms/webdav.rs:52-58 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/s3.rs` and `src-tauri/src/cli/tui/ui/forms/webdav.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 97 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/services/skill.rs:1740 — src-tauri/src/services/skill.rs:1740-1746 | src-tauri/src/services/skill.rs:1770-1776 — 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/session_manager/providers/gemini.rs:46 — src-tauri/src/session_manager/providers/gemini.rs:46-52 | src-tauri/src/session_manager/providers/openclaw.rs:74-80 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 70 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/gemini.rs:46` 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/claude_mcp.rs:75 — src-tauri/src/claude_mcp.rs:75-81 | src-tauri/src/gemini_mcp.rs:34-40 — before extracting anything, compare `src-tauri/src/claude_mcp.rs` and `src-tauri/src/gemini_mcp.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. 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.
  • + 23 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×43
  • Duplicated block (8 lines × 2) src-tauri/src/cli/commands/config.rs:329 — src-tauri/src/cli/commands/config.rs:329-336 | src-tauri/src/cli/commands/config.rs:400-407 — 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/cli/commands/config.rs:329` 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/cli/commands/config_webdav.rs:273 — src-tauri/src/cli/commands/config_webdav.rs:273-280 | src-tauri/src/cli/commands/config_webdav.rs:284-291 — 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/cli/commands/config_webdav.rs:273` 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/cli/commands/prompts.rs:417 — src-tauri/src/cli/commands/prompts.rs:417-424 | src-tauri/src/cli/commands/prompts.rs:602-609 — 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/cli/commands/provider_input.rs:3022 — src-tauri/src/cli/commands/provider_input.rs:3022-3029 | src-tauri/src/cli/tui/form/provider_json.rs:523-530 — before extracting anything, compare `src-tauri/src/cli/commands/provider_input.rs` and `src-tauri/src/cli/tui/form/provider_json.rs` as WHOLE FILES: this scan already matched 6 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. 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/cli/commands/provider_input.rs:3022` 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/cli/tui/app/editor_state.rs:199 — src-tauri/src/cli/tui/app/editor_state.rs:199-206 | src-tauri/src/cli/tui/ui/forms/shared.rs:361-368 — 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/cli/tui/app/editor_state.rs:199` 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/cli/tui/runtime_actions/editor.rs:792 — src-tauri/src/cli/tui/runtime_actions/editor.rs:792-799 | src-tauri/src/cli/tui/runtime_actions/editor.rs:811-818 — 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/cli/tui/runtime_actions/editor.rs:792` 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/cli/tui/runtime_systems/workers.rs:468 — src-tauri/src/cli/tui/runtime_systems/workers.rs:468-475 | src-tauri/src/cli/tui/runtime_systems/workers.rs:551-558 — 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/cli/tui/runtime_systems/workers.rs:468` 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 `rx` to `mpsc::Receiver<StreamCheckReq>` in one and `mpsc::Receiver<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 (8 lines × 2) src-tauri/src/cli/tui/ui.rs:227 — src-tauri/src/cli/tui/ui.rs:227-234 | src-tauri/src/cli/tui/ui.rs:240-247 — 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/cli/tui/ui/overlay/layout.rs:96 — src-tauri/src/cli/tui/ui/overlay/layout.rs:96-103 | src-tauri/src/cli/tui/ui/overlay/layout.rs:128-135 — 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/cli/tui/ui/overlay/layout.rs:96` 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/cli/tui/ui/pricing.rs:159 — src-tauri/src/cli/tui/ui/pricing.rs:159-166 | src-tauri/src/cli/tui/ui/pricing.rs:184-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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/cli/tui/ui/pricing.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 (8 lines × 2) src-tauri/src/cli/tui/ui/prompts.rs:166 — src-tauri/src/cli/tui/ui/prompts.rs:166-173 | src-tauri/src/cli/tui/ui/prompts.rs:241-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/cli/tui/ui/prompts.rs:166` 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/codex_config.rs:1400 — src-tauri/src/codex_config.rs:1400-1407 | src-tauri/src/codex_config.rs:1448-1455 — 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/codex_config.rs:1400` 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) REDACTED:1435 — REDACTED:1435-1442 | src-tauri/src/database/dao/proxy.rs:1158-1165 — 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:1435` 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:334 — src-tauri/src/hermes_config.rs:334-341 | src-tauri/src/openclaw_config.rs:349-356 — before extracting anything, compare `src-tauri/src/hermes_config.rs` and `src-tauri/src/openclaw_config.rs` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/hermes_config.rs:334` 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/error.rs:211 — src-tauri/src/proxy/error.rs:211-218 | src-tauri/src/proxy/response/error_summary.rs:44-51 — 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) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1973 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1973-1980 | src-tauri/src/proxy/providers/copilot_auth.rs:1404-1411 — 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 8 separate duplicated blocks between them, totalling at least 110 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/proxy/providers/streaming_codex_anthropic.rs:677 — src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:677-684 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:924-931 — 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:677` 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/providers/streaming_codex_chat.rs:213 — src-tauri/src/proxy/providers/streaming_codex_chat.rs:213-220 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:243-250 — 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/provider/common_config.rs:652 — src-tauri/src/services/provider/common_config.rs:652-659 | src-tauri/src/services/provider/common_config.rs:705-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/services/provider/common_config.rs:652` 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/services/provider/common_config.rs:667 — src-tauri/src/services/provider/common_config.rs:667-674 | src-tauri/src/services/provider/common_config.rs:720-727 — 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/common_config.rs:667` 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/services/skill.rs:1475 — src-tauri/src/services/skill.rs:1475-1482 | src-tauri/src/services/skill.rs:2764-2771 — 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:1475` 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. 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/session_manager/paged_manifest.rs:314 — src-tauri/src/session_manager/paged_manifest.rs:314-321 | src-tauri/src/session_manager/transcript.rs:2704-2711 — 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/paged_manifest.rs:314` 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/session_manager/providers/hermes.rs:447 — src-tauri/src/session_manager/providers/hermes.rs:447-454 | REDACTED:644-651 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:447` 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) REDACTED:1540 — REDACTED:1540-1547 | REDACTED:1557-1564 — 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/streaming_responses.rs:96 — src-tauri/src/proxy/providers/streaming_responses.rs:96-103 | src-tauri/src/proxy/providers/streaming_responses.rs:107-114 — 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:96` 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:106` calls `tool_item_key_from_event` and `src-tauri/src/proxy/providers/streaming_responses.rs:95` 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.
  • + 18 more in this group — see findings.md.
D2 · Cognitive Complexity · App · ×39
  • App::handle_provider_field_activate (cognitive 129) src-tauri/src/cli/tui/app/form_handlers/provider.rs:368 — App::handle_provider_field_activate has cognitive complexity 129 (threshold 15). Drivers by points: if/else 55 (118 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 68). 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.
  • App::on_sessions_key (cognitive 89) src-tauri/src/cli/tui/app/content_entities.rs:688 — App::on_sessions_key has cognitive complexity 89 (threshold 15). Drivers by points: if/else 32 (69 pts), match/switch 8 (13 pts), boolean chains 7 (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.
  • App::handle_form_tab_key (cognitive 62) src-tauri/src/cli/tui/app/form_handlers/tab.rs:4 — App::handle_form_tab_key has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (42 pts), match/switch 6 (14 pts), boolean chains 6 (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.
  • App::handle_confirm_overlay_key (cognitive 52) src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:75 — App::handle_confirm_overlay_key has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (36 pts), match/switch 7 (16 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.
  • App::handle_text_input_submit (cognitive 50) src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:388 — App::handle_text_input_submit has cognitive complexity 50 (threshold 15). Drivers by points: if/else 25 (46 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 22). 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.
  • App::handle_model_fetch_picker_key (cognitive 48) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1119 — App::handle_model_fetch_picker_key has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 2, match/switch 1 (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.
  • App::commit_active_text_edit (cognitive 45) src-tauri/src/cli/tui/app/form_handlers/mod.rs:119 — App::commit_active_text_edit has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 7 (8 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.
  • App::on_providers_key (cognitive 44) src-tauri/src/cli/tui/app/content_entities.rs:219 — App::on_providers_key has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 2, match/switch 2 (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.
  • App::handle_claude_model_picker_select_key (cognitive 40) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:982 — App::handle_claude_model_picker_select_key has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 18). 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.
  • App::build_provider_form_save_action (cognitive 39) src-tauri/src/cli/tui/app/form_handlers/provider.rs:48 — App::build_provider_form_save_action has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 7, match/switch 3 (5 pts) (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.
  • App::on_filter_key (cognitive 39) src-tauri/src/cli/tui/app/menu.rs:944 — App::on_filter_key has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 7, match/switch 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.
  • App::clamp_selections (cognitive 39) src-tauri/src/cli/tui/app/menu.rs:1174 — App::clamp_selections has cognitive complexity 39 (threshold 15). Drivers by points: if/else 35 (36 pts), boolean chains 3 (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.
  • App::on_key_after_clamp (cognitive 36) src-tauri/src/cli/tui/app/menu.rs:738 — App::on_key_after_clamp has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 7, match/switch 3 (6 pts) (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.
  • App::handle_mcp_key_value_entry_editor_key (cognitive 36) src-tauri/src/cli/tui/app/overlay_handlers/mcp_key_value.rs:78 — App::handle_mcp_key_value_entry_editor_key has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 10 (16 pts), boolean chains 3 (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.
  • App::on_s3_sync_form_key (cognitive 35) src-tauri/src/cli/tui/app/form_handlers/s3.rs:4 — App::on_s3_sync_form_key has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 3 (4 pts) (nesting depth added 19). 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.
  • App::on_webdav_sync_form_key (cognitive 32) src-tauri/src/cli/tui/app/form_handlers/webdav.rs:4 — App::on_webdav_sync_form_key has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 3 (4 pts) (nesting depth added 18). 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.
  • App::on_settings_key (cognitive 31) src-tauri/src/cli/tui/app/content_config.rs:840 — App::on_settings_key has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 4 (10 pts), boolean chains 3 (nesting depth added 17). 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.
  • App::handle_session_project_picker_key (cognitive 28) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1256 — App::handle_session_project_picker_key has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 3 (4 pts) (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::on_usage_logs_key (cognitive 27) src-tauri/src/cli/tui/app/content_usage.rs:136 — App::on_usage_logs_key has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 2 (3 pts), boolean chains 2 (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.
  • App::handle_mcp_field_navigation (cognitive 27) src-tauri/src/cli/tui/app/form_handlers/mcp.rs:156 — App::handle_mcp_field_navigation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 15). 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.
  • App::handle_codex_reasoning_picker_key (cognitive 25) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:81 — App::handle_codex_reasoning_picker_key has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (20 pts), match/switch 3 (5 pts) (nesting depth added 16). 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.
  • App::handle_picker_overlay_key (cognitive 24) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:146 — App::handle_picker_overlay_key has cognitive complexity 24 (threshold 15). Drivers by points: if/else 24. 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.
  • App::handle_managed_account_picker_key (cognitive 22) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:728 — App::handle_managed_account_picker_key has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2, match/switch 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.
  • App::on_skills_installed_key (cognitive 21) src-tauri/src/cli/tui/app/content_skills.rs:20 — App::on_skills_installed_key has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 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.
  • App::handle_codex_inline_catalog_key (cognitive 20) src-tauri/src/cli/tui/app/form_handlers/provider.rs:994 — App::handle_codex_inline_catalog_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 2 (3 pts) (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.
  • + 14 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×38
  • Duplicated block (9 lines × 2) src-tauri/src/cli/commands/provider_input.rs:142 — src-tauri/src/cli/commands/provider_input.rs:142-150 | src-tauri/src/cli/tui/form/provider_state.rs:355-363 — 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/cli/commands/provider_input.rs:142` 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/cli/commands/provider_input.rs:3656 — src-tauri/src/cli/commands/provider_input.rs:3656-3664 | src-tauri/src/cli/tui/form/provider_json.rs:1545-1553 — before extracting anything, compare `src-tauri/src/cli/commands/provider_input.rs` and `src-tauri/src/cli/tui/form/provider_json.rs` as WHOLE FILES: this scan already matched 6 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. 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 (9 lines × 2) src-tauri/src/cli/tui/app/content_entities.rs:702 — src-tauri/src/cli/tui/app/content_entities.rs:702-710 | src-tauri/src/cli/tui/app/content_entities.rs:1135-1143 — 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/cli/tui/app/content_entities.rs:702` 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/cli/tui/app/helpers.rs:1369 — src-tauri/src/cli/tui/app/helpers.rs:1369-1377 | src-tauri/src/session_manager/query_manifest.rs:155-163 — before extracting anything, compare `src-tauri/src/cli/tui/app/helpers.rs` and `src-tauri/src/session_manager/query_manifest.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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `session` to `&crate::session_manager::SessionMeta` in one and `&SessionMeta` 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/cli/tui/app/helpers.rs:1430 — src-tauri/src/cli/tui/app/helpers.rs:1430-1438 | src-tauri/src/session_manager/query_manifest.rs:181-189 — before extracting anything, compare `src-tauri/src/cli/tui/app/helpers.rs` and `src-tauri/src/session_manager/query_manifest.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. 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. 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/cli/tui/form/provider_json.rs:311 — src-tauri/src/cli/tui/form/provider_json.rs:311-319 | src-tauri/src/cli/tui/form/provider_json.rs:453-461 — 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/cli/tui/runtime_actions/editor.rs:516 — src-tauri/src/cli/tui/runtime_actions/editor.rs:516-524 | src-tauri/src/cli/tui/runtime_actions/editor.rs:561-569 — 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/cli/tui/runtime_actions/editor.rs:869 — src-tauri/src/cli/tui/runtime_actions/editor.rs:869-877 | src-tauri/src/cli/tui/runtime_actions/editor.rs:931-939 — 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/cli/tui/runtime_actions/editor.rs:869` 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/cli/tui/runtime_actions/editor.rs:868` calls `then_some` and `src-tauri/src/cli/tui/runtime_actions/editor.rs:930` 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 × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs:1200 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1200-1208 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1275-1283 — 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/cli/tui/runtime_actions/editor.rs:1275 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1275-1283 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1319-1327 — 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/cli/tui/runtime_systems/workers.rs:179 — src-tauri/src/cli/tui/runtime_systems/workers.rs:179-187 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3769-3777 — 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/cli/tui/runtime_systems/workers.rs:179` 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 `rx` to `mpsc::Receiver<ProxyReq>` in one and `mpsc::Receiver<SkillsReq>` 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/cli/tui/runtime_systems/workers.rs:292 — src-tauri/src/cli/tui/runtime_systems/workers.rs:292-300 | src-tauri/src/cli/tui/runtime_systems/workers.rs:697-705 — 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/cli/tui/runtime_systems/workers.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. Note first that the copies are not typed on the same thing: the declarations holding them bind `rx` to `mpsc::Receiver<UpdateReq>` in one and `mpsc::Receiver<ManagedAuthReq>` 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/cli/tui/runtime_systems/workers.rs:1317 — src-tauri/src/cli/tui/runtime_systems/workers.rs:1317-1325 | src-tauri/src/cli/tui/runtime_systems/workers.rs:1353-1361 — 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/cli/tui/runtime_systems/workers.rs:1317` 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/cli/tui/ui/overlay/pickers.rs:1235 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:1235-1244 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1412-1420 — 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/cli/tui/ui/overlay/pickers.rs:1235` 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/codex_config.rs:383 — src-tauri/src/codex_config.rs:383-391 | src-tauri/src/codex_config.rs:403-411 — 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/codex_config.rs:383` 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/config.rs:348 — src-tauri/src/config.rs:348-356 | src-tauri/src/config.rs:1373-1381 — 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/config.rs:347` calls `to_path_buf` and `src-tauri/src/config.rs:1372` 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 (9 lines × 2) src-tauri/src/daemon/supervisor.rs:1256 — src-tauri/src/daemon/supervisor.rs:1256-1264 | src-tauri/src/services/proxy.rs:4112-4120 — 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/daemon/supervisor.rs:1256` 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/mcp.rs:810 — src-tauri/src/mcp.rs:810-818 | src-tauri/src/mcp.rs:1462-1470 — 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.rs:810` 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/forwarder.rs:765 — src-tauri/src/proxy/forwarder.rs:765-773 | src-tauri/src/proxy/forwarder.rs:962-970 — 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:765` 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_oauth_auth.rs:1849 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1849-1857 | src-tauri/src/proxy/providers/copilot_auth.rs:1175-1183 — 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 8 separate duplicated blocks between them, totalling at least 110 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `accounts` to `&HashMap<String, CodexAccountData>` in one and `&HashMap<String, GitHubAccountData>` 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/proxy/providers/streaming_responses.rs:316 — src-tauri/src/proxy/providers/streaming_responses.rs:316-324 | src-tauri/src/proxy/providers/streaming_responses.rs:584-592 — 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:316` 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/s3_sync.rs:265 — src-tauri/src/services/s3_sync.rs:265-273 | REDACTED:345-353 — 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. 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/claude.rs:328 — src-tauri/src/session_manager/providers/claude.rs:328-337 | src-tauri/src/session_manager/providers/codex.rs:954-962 — 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 10 separate duplicated blocks between them, totalling at least 152 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:328` 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/session_manager/providers/claude.rs:338` calls `or_else`, `truncate_summary` and `src-tauri/src/session_manager/providers/codex.rs:963` 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 (9 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:523 — src-tauri/src/session_manager/providers/hermes.rs:523-531 | REDACTED:1072-1080 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:523` 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/cli/tui/runtime_systems/types.rs:952 — src-tauri/src/cli/tui/runtime_systems/types.rs:952-960 | src-tauri/src/services/provider/models.rs:84-92 — before extracting anything, compare `src-tauri/src/cli/tui/runtime_systems/types.rs` and `src-tauri/src/services/provider/models.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/services/provider/models.rs:94` calls `is_empty` and `src-tauri/src/cli/tui/runtime_systems/types.rs:962` 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.
  • + 13 more in this group — see findings.md.
D1 · Cyclomatic Complexity · App · ×35
  • App::handle_provider_field_activate (cyclomatic 94) src-tauri/src/cli/tui/app/form_handlers/provider.rs:368 — App::handle_provider_field_activate has cyclomatic complexity 94 (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::handle_confirm_overlay_key (cyclomatic 70) src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:75 — App::handle_confirm_overlay_key has cyclomatic complexity 70 (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.
  • App::on_sessions_key (cyclomatic 57) src-tauri/src/cli/tui/app/content_entities.rs:688 — App::on_sessions_key has cyclomatic complexity 57 (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::handle_form_tab_key (cyclomatic 51) src-tauri/src/cli/tui/app/form_handlers/tab.rs:4 — App::handle_form_tab_key has cyclomatic complexity 51 (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::handle_text_input_submit (cyclomatic 43) src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:388 — App::handle_text_input_submit 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.
  • App::on_key_after_clamp (cyclomatic 38) src-tauri/src/cli/tui/app/menu.rs:738 — App::on_key_after_clamp has cyclomatic complexity 38 (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.
  • App::on_providers_key (cyclomatic 36) src-tauri/src/cli/tui/app/content_entities.rs:219 — App::on_providers_key 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.
  • App::on_settings_key (cyclomatic 33) src-tauri/src/cli/tui/app/content_config.rs:840 — App::on_settings_key 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.
  • App::build_provider_form_save_action (cyclomatic 32) src-tauri/src/cli/tui/app/form_handlers/provider.rs:48 — App::build_provider_form_save_action has cyclomatic complexity 32 (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.
  • App::handle_claude_model_picker_select_key (cyclomatic 28) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:982 — App::handle_claude_model_picker_select_key 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.
  • App::handle_model_fetch_picker_key (cyclomatic 27) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1119 — App::handle_model_fetch_picker_key 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.
  • App::commit_active_text_edit (cyclomatic 26) src-tauri/src/cli/tui/app/form_handlers/mod.rs:119 — App::commit_active_text_edit 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.
  • App::handle_mcp_key_value_entry_editor_key (cyclomatic 25) src-tauri/src/cli/tui/app/overlay_handlers/mcp_key_value.rs:78 — App::handle_mcp_key_value_entry_editor_key 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.
  • App::handle_picker_overlay_key (cyclomatic 25) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:146 — App::handle_picker_overlay_key has cyclomatic complexity 25 (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.
  • App::handle_session_project_picker_key (cyclomatic 24) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1256 — App::handle_session_project_picker_key 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.
  • App::on_filter_key (cyclomatic 23) src-tauri/src/cli/tui/app/menu.rs:944 — App::on_filter_key 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. This is NOT this file's highest cyclomatic complexity: App::on_content_key (cyclomatic 31) 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.
  • App::clamp_selections (cyclomatic 23) src-tauri/src/cli/tui/app/menu.rs:1174 — App::clamp_selections 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. This is NOT this file's highest cyclomatic complexity: App::on_content_key (cyclomatic 31) 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.
  • App::on_config_key (cyclomatic 21) src-tauri/src/cli/tui/app/content_config.rs:33 — App::on_config_key has cyclomatic complexity 21 (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.
  • App::nav_item_for_route (cyclomatic 21) src-tauri/src/cli/tui/app/menu.rs:181 — App::nav_item_for_route has cyclomatic complexity 21 (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. This is NOT this file's highest cyclomatic complexity: App::on_content_key (cyclomatic 31) 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.
  • App::on_skills_installed_key (cyclomatic 20) src-tauri/src/cli/tui/app/content_skills.rs:20 — App::on_skills_installed_key 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.
  • App::on_usage_logs_key (cyclomatic 20) src-tauri/src/cli/tui/app/content_usage.rs:136 — App::on_usage_logs_key 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.
  • App::handle_mcp_field_navigation (cyclomatic 20) src-tauri/src/cli/tui/app/form_handlers/mcp.rs:156 — App::handle_mcp_field_navigation 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.
  • App::on_s3_sync_form_key (cyclomatic 20) src-tauri/src/cli/tui/app/form_handlers/s3.rs:4 — App::on_s3_sync_form_key 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.
  • App::handle_codex_inline_catalog_key (cyclomatic 19) src-tauri/src/cli/tui/app/form_handlers/provider.rs:994 — App::handle_codex_inline_catalog_key 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.
  • App::on_webdav_sync_form_key (cyclomatic 19) src-tauri/src/cli/tui/app/form_handlers/webdav.rs:4 — App::on_webdav_sync_form_key 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.
  • + 10 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×34
  • Duplicated block (10 lines × 2) src-tauri/src/claude_mcp.rs:173 — src-tauri/src/claude_mcp.rs:173-182 | src-tauri/src/mcp.rs:25-34 — 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/claude_mcp.rs:173` 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 `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 (10 lines × 2) src-tauri/src/cli/commands/provider_inspect.rs:1140 — src-tauri/src/cli/commands/provider_inspect.rs:1140-1149 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1618-1627 — 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/cli/commands/provider_inspect.rs:1140` 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) src-tauri/src/cli/commands/sessions.rs:238 — src-tauri/src/cli/commands/sessions.rs:238-247 | src-tauri/src/cli/commands/sessions.rs:504-513 — 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/cli/commands/sessions.rs:238` 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) src-tauri/src/cli/tui/app/helpers.rs:1638 — src-tauri/src/cli/tui/app/helpers.rs:1638-1647 | src-tauri/src/cli/tui/ui/skills/repos.rs:52-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 `src-tauri/src/cli/tui/app/helpers.rs:1638` 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/cli/tui/app/types.rs:4962 — src-tauri/src/cli/tui/app/types.rs:4962-4971 | src-tauri/src/cli/tui/app/types.rs:5008-5017 — 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/cli/tui/app/types.rs:4961` calls `SessionProjectPicker` and `src-tauri/src/cli/tui/app/types.rs:5007` 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 lines × 2) src-tauri/src/cli/tui/data.rs:2611 — src-tauri/src/cli/tui/data.rs:2611-2620 | src-tauri/src/cli/tui/data.rs:2657-2666 — 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/cli/tui/data.rs:2611` 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) src-tauri/src/cli/tui/form/provider_state.rs:3188 — src-tauri/src/cli/tui/form/provider_state.rs:3188-3197 | src-tauri/src/cli/tui/form/provider_state.rs:3208-3217 — 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/cli/tui/form/provider_state.rs:3188` 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) src-tauri/src/cli/tui/runtime_actions/editor.rs:1024 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1024-1033 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1122-1131 — 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/cli/tui/runtime_actions/editor.rs:1123 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1123-1132 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1319-1328 — 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/cli/tui/runtime_actions/editor.rs:1123` 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/cli/tui/runtime_systems/types.rs:879 — src-tauri/src/cli/tui/runtime_systems/types.rs:879-888 | src-tauri/src/services/provider/models.rs:145-154 — before extracting anything, compare `src-tauri/src/cli/tui/runtime_systems/types.rs` and `src-tauri/src/services/provider/models.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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 (10 lines × 2) src-tauri/src/cli/tui/runtime_systems/workers.rs:2207 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2207-2216 | src-tauri/src/cli/tui/runtime_systems/workers.rs:2221-2230 — 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/cli/tui/runtime_systems/workers.rs:2207` 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) src-tauri/src/cli/tui/ui/config.rs:1309 — src-tauri/src/cli/tui/ui/config.rs:1309-1318 | src-tauri/src/cli/tui/ui/config.rs:2230-2239 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `rows` to `&[OpenClawToolsStyledRow]` in one and `&[OpenClawAgentsStyledRow]` 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 (10 lines × 2) src-tauri/src/cli/tui/ui/forms/prompt.rs:93 — src-tauri/src/cli/tui/ui/forms/prompt.rs:93-102 | src-tauri/src/cli/tui/ui/forms/provider.rs:567-576 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/prompt.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 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/cli/tui/ui/forms/prompt.rs:93` 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) src-tauri/src/cli/tui/ui/overlay/basic.rs:338 — src-tauri/src/cli/tui/ui/overlay/basic.rs:338-347 | src-tauri/src/cli/tui/ui/overlay/status.rs:316-325 — 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/cli/tui/ui/overlay/status.rs:316` 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 lines × 2) src-tauri/src/cli/tui/ui/overlay/pickers.rs:1996 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:1996-2005 | src-tauri/src/cli/tui/ui/shared.rs:411-420 — 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 (10 lines × 2) src-tauri/src/database/dao/proxy.rs:1049 — src-tauri/src/database/dao/proxy.rs:1049-1058 | src-tauri/src/database/dao/proxy.rs:1124-1133 — 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/proxy.rs:1049` 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) src-tauri/src/openclaw_config.rs:502 — src-tauri/src/openclaw_config.rs:502-511 | src-tauri/src/openclaw_config.rs:524-533 — 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/openclaw_config.rs:502` 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 lines × 2) src-tauri/src/provider_preset_models.rs:151 — src-tauri/src/provider_preset_models.rs:151-160 | src-tauri/src/provider_preset_models.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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/provider_preset_models.rs:151` 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/codex.rs:388 — src-tauri/src/proxy/providers/codex.rs:388-397 | src-tauri/src/proxy/providers/codex.rs:445-454 — 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:388` 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 × 2) src-tauri/src/services/skill.rs:1176 — src-tauri/src/services/skill.rs:1176-1185 | src-tauri/src/services/skill.rs:1507-1516 — 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:1697 — src-tauri/src/services/skill.rs:1697-1706 | src-tauri/src/services/skill.rs:1787-1796 — 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:1697` 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/usage_stats.rs:537 — src-tauri/src/services/usage_stats.rs:537-546 | src-tauri/src/services/usage_stats.rs:1205-1214 — 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/usage_stats.rs:537` 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) src-tauri/src/services/webdav.rs:256 — src-tauri/src/services/webdav.rs:256-265 | src-tauri/src/services/webdav.rs:414-423 — 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/webdav.rs:256` 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/session_manager/providers/codex.rs:755 — src-tauri/src/session_manager/providers/codex.rs:755-764 | src-tauri/src/session_manager/providers/openclaw.rs:405-414 — 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 10 separate duplicated blocks between them, totalling at least 125 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:755` 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/session_manager/providers/openclaw.rs:375 — src-tauri/src/session_manager/providers/openclaw.rs:375-384 | src-tauri/src/session_manager/providers/openclaw.rs:422-431 — 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/openclaw.rs:375` 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.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×32
  • Duplicated block (11 lines × 2) src-tauri/src/cli/commands/sessions.rs:883 — src-tauri/src/cli/commands/sessions.rs:883-893 | src-tauri/src/cli/tui/ui/sessions.rs:718-728 — 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/cli/commands/sessions.rs:883` 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 `session` to `&SessionMeta` in one and `&crate::session_manager::SessionMeta` 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 (11 lines × 2) src-tauri/src/cli/tui/app/helpers.rs:1550 — src-tauri/src/cli/tui/app/helpers.rs:1550-1560 | src-tauri/src/cli/tui/ui/mcp.rs:5-15 — 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/cli/tui/app/helpers.rs:1550` 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/cli/tui/runtime_actions/claude_temp_launch.rs:54 — src-tauri/src/cli/tui/runtime_actions/claude_temp_launch.rs:54-64 | src-tauri/src/cli/tui/runtime_actions/codex_temp_launch.rs:41-51 — 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/cli/tui/runtime_actions/claude_temp_launch.rs:54` 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 `id` to `&str` 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 (11 lines × 2) src-tauri/src/codex_config.rs:3543 — src-tauri/src/codex_config.rs:3543-3553 | src-tauri/src/codex_config.rs:3617-3627 — 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/database/dao/proxy.rs:194 — src-tauri/src/database/dao/proxy.rs:194-204 | src-tauri/src/database/dao/proxy.rs:218-228 — 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/proxy.rs:194` 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/openclaw_config.rs:819 — src-tauri/src/openclaw_config.rs:819-829 | src-tauri/src/openclaw_config.rs:898-908 — 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/openclaw_config.rs:819` 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/codex_oauth_auth.rs:1129 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1129-1139 | src-tauri/src/proxy/providers/codex_oauth_auth.rs:1174-1184 — 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:1877 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1877-1887 | src-tauri/src/proxy/providers/copilot_auth.rs:1204-1214 — 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 8 separate duplicated blocks between them, totalling at least 110 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:74 — src-tauri/src/proxy/providers/streaming_gemini.rs:74-84 | src-tauri/src/proxy/providers/transform_gemini.rs:1030-1040 — 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:74` 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/response.rs:373 — src-tauri/src/proxy/response.rs:373-383 | src-tauri/src/proxy/response.rs:403-413 — 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/session_usage.rs:1049 — src-tauri/src/services/session_usage.rs:1049-1059 | src-tauri/src/services/session_usage_gemini.rs:259-269 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_gemini.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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/session_usage.rs:1049` 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/skill.rs:733 — src-tauri/src/services/skill.rs:733-743 | src-tauri/src/services/skill.rs:763-773 — 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/skill.rs:3016 — src-tauri/src/services/skill.rs:3016-3026 | src-tauri/src/services/skill.rs:3045-3055 — 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 (11 lines × 2) src-tauri/src/session_manager/cache.rs:238 — src-tauri/src/session_manager/cache.rs:238-248 | src-tauri/src/session_manager/cache.rs:282-292 — 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/session_manager/paged_manifest.rs:2505 — src-tauri/src/session_manager/paged_manifest.rs:2505-2515 | src-tauri/src/session_manager/paged_manifest.rs:2564-2574 — 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/paged_manifest.rs:2505` 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/session_manager/paged_manifest.rs:2524 — src-tauri/src/session_manager/paged_manifest.rs:2524-2534 | src-tauri/src/session_manager/paged_manifest.rs:2583-2593 — 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/paged_manifest.rs:2524` 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/session_manager/providers/hermes.rs:393 — src-tauri/src/session_manager/providers/hermes.rs:393-403 | REDACTED:572-582 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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/session_manager/providers/hermes.rs:812 — src-tauri/src/session_manager/providers/hermes.rs:812-822 | REDACTED:1194-1204 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:812` 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/session_manager/providers/hermes.rs:903 — src-tauri/src/session_manager/providers/hermes.rs:903-913 | REDACTED:1297-1307 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:903` 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, `REDACTED:1308` calls `sqlite_session_uses_v2`, `search_session_sqlite_v2` and `src-tauri/src/session_manager/providers/hermes.rs:918` 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 (11 lines × 2) src-tauri/src/session_manager/providers/pi.rs:666 — src-tauri/src/session_manager/providers/pi.rs:666-676 | src-tauri/src/session_manager/providers/pi.rs:807-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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/session_manager/providers/pi.rs:666` 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/session_manager/providers/pi.rs:665` calls `default` and `src-tauri/src/session_manager/providers/pi.rs:806` 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 lines × 2) src-tauri/src/session_manager/transcript.rs:2856 — src-tauri/src/session_manager/transcript.rs:2856-2866 | src-tauri/src/session_manager/transcript.rs:2967-2977 — 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/transcript.rs:2856` 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 (11 lines × 2) src-tauri/src/services/coding_plan.rs:146 — src-tauri/src/services/coding_plan.rs:146-156 | src-tauri/src/services/coding_plan.rs:167-177 — 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:146` 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/provider/endpoints.rs:55 — src-tauri/src/services/provider/endpoints.rs:55-65 | src-tauri/src/services/provider/mod.rs:2966-2976 — 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/session_manager/providers/gemini.rs:226 — src-tauri/src/session_manager/providers/gemini.rs:226-236 | REDACTED:1734-1744 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `REDACTED` 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. 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/cli/tui/runtime_actions/helpers.rs:62 — src-tauri/src/cli/tui/runtime_actions/helpers.rs:62-72 | src-tauri/src/services/visible_apps.rs:185-195 — 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.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×29
  • Duplicated block (6 lines × 2) src-tauri/src/cli/commands/provider_input.rs:3787 — src-tauri/src/cli/commands/provider_input.rs:3787-3793 | src-tauri/src/cli/commands/provider_input.rs:4326-4331 — 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/cli/commands/provider_input.rs:3787` 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 (6 lines × 2) src-tauri/src/cli/tui/app/form_handlers/provider.rs:1300 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:1300-1305 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1550-1555 — 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/cli/tui/data.rs:3048 — src-tauri/src/cli/tui/data.rs:3048-3053 | src-tauri/src/cli/tui/data.rs:3093-3098 — 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/cli/tui/data.rs:3048` 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/cli/tui/form/mcp.rs:306 — src-tauri/src/cli/tui/form/mcp.rs:306-311 | src-tauri/src/cli/tui/form/s3.rs:186-191 — 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 `field` to `McpAddField` in one and `S3SyncField` 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 lines × 2) src-tauri/src/cli/tui/ui/editor.rs:76 — src-tauri/src/cli/tui/ui/editor.rs:76-81 | src-tauri/src/cli/tui/ui/forms/prompt.rs:206-212 — 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/cli/tui/ui/editor.rs:76` 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/proxy/copilot_optimizer.rs:282 — src-tauri/src/proxy/copilot_optimizer.rs:282-288 | src-tauri/src/proxy/copilot_optimizer.rs:311-316 — 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/providers/codex_chat_common.rs:10 — src-tauri/src/proxy/providers/codex_chat_common.rs:10-15 | src-tauri/src/proxy/providers/codex_chat_common.rs:55-60 — 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:10` 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:163 — src-tauri/src/proxy/providers/transform.rs:163-168 | src-tauri/src/proxy/providers/transform_responses.rs:309-314 — 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 5 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. 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/proxy/providers/transform.rs:581 — src-tauri/src/proxy/providers/transform.rs:581-586 | src-tauri/src/proxy/providers/transform_responses.rs:674-679 — 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 5 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. 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/proxy/providers/transform_responses.rs:680` calls `sanitize_anthropic_tool_use_input` and `src-tauri/src/proxy/providers/transform.rs:587` 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 (6 lines × 2) src-tauri/src/services/usage_stats.rs:821 — src-tauri/src/services/usage_stats.rs:821-826 | src-tauri/src/services/usage_stats.rs:911-916 — 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/usage_stats.rs:821` 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/paged_manifest.rs:2694 — src-tauri/src/session_manager/paged_manifest.rs:2694-2699 | src-tauri/src/session_manager/paged_manifest.rs:2727-2732 — 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/cli/commands/provider_input.rs:3183 — src-tauri/src/cli/commands/provider_input.rs:3183-3188 | src-tauri/src/cli/commands/provider_input.rs:3404-3409 — 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/cli/tui/app/editor_state.rs:716 — src-tauri/src/cli/tui/app/editor_state.rs:716-721 | src-tauri/src/cli/tui/app/editor_state.rs:733-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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn insert_char(&mut` in one and `crate) fn newline(&mut` 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 lines × 2) src-tauri/src/cli/tui/app/types.rs:3032 — src-tauri/src/cli/tui/app/types.rs:3032-3037 | src-tauri/src/cli/tui/app/types.rs:3694-3699 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn start_scan(&mut` 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 after the matched lines, `src-tauri/src/cli/tui/app/types.rs:3038` calls `reset` and `src-tauri/src/cli/tui/app/types.rs:3700` 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 (6 lines × 2) src-tauri/src/cli/tui/ui/usage.rs:887 — src-tauri/src/cli/tui/ui/usage.rs:887-892 | src-tauri/src/cli/tui/ui/usage.rs:943-948 — 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/cli/tui/ui/usage.rs:887` 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/proxy/providers/transform_codex_chat.rs:1404 — src-tauri/src/proxy/providers/transform_codex_chat.rs:1404-1409 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1425-1430 — 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/env_checker.rs:51 — src-tauri/src/services/env_checker.rs:51-56 | src-tauri/src/services/env_checker.rs:67-72 — 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: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 (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:238-243 — 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/cli/claude_temp_launch.rs:238 — src-tauri/src/cli/claude_temp_launch.rs:238-243 | src-tauri/src/cli/codex_temp_launch.rs:272-277 — before extracting anything, compare `src-tauri/src/cli/claude_temp_launch.rs` and `src-tauri/src/cli/codex_temp_launch.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 41 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/cli/commands/failover.rs:76 — src-tauri/src/cli/commands/failover.rs:76-81 | src-tauri/src/cli/commands/proxy.rs:76-81 — 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/cli/provider_quota.rs:195 — src-tauri/src/cli/provider_quota.rs:195-200 | src-tauri/src/cli/tui/ui/shared.rs:885-890 — before extracting anything, compare `src-tauri/src/cli/provider_quota.rs` and `src-tauri/src/cli/tui/ui/shared.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 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 (6 lines × 2) src-tauri/src/cli/tui/app/helpers.rs:1418 — src-tauri/src/cli/tui/app/helpers.rs:1418-1423 | src-tauri/src/session_manager/query_manifest.rs:169-174 — before extracting anything, compare `src-tauri/src/cli/tui/app/helpers.rs` and `src-tauri/src/session_manager/query_manifest.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. 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 (6 lines × 2) src-tauri/src/services/provider/mod.rs:116 — src-tauri/src/services/provider/mod.rs:116-121 | src-tauri/src/services/subscription.rs:674-679 — 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 (6 lines × 2) src-tauri/src/app_config.rs:746 — src-tauri/src/app_config.rs:746-753 | src-tauri/src/proxy/providers/gemini.rs:98-103 — 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/app_config.rs:746` 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/cli/commands/prompts.rs:427 — src-tauri/src/cli/commands/prompts.rs:427-432 | src-tauri/src/cli/commands/prompts.rs:612-619 — 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/cli/commands/prompts.rs:612` 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.
  • + 4 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×27
  • Duplicated block (5 lines × 2) src-tauri/src/cli/tui/app/content_entities.rs:770 — src-tauri/src/cli/tui/app/content_entities.rs:770-774 | src-tauri/src/cli/tui/app/content_entities.rs:783-787 — 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/cli/tui/ui/config.rs:182 — src-tauri/src/cli/tui/ui/config.rs:182-186 | src-tauri/src/cli/tui/ui/config.rs:244-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/cli/tui/ui/config.rs:182` 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/dao/proxy.rs:741 — src-tauri/src/database/dao/proxy.rs:741-745 | src-tauri/src/database/dao/proxy.rs:792-796 — 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/proxy.rs:741` 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/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/streaming_codex_anthropic.rs:494 — src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:494-498 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:860-864 — 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:112 — src-tauri/src/proxy/providers/transform.rs:112-116 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:238-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.
  • Duplicated block (5 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:859 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:859-863 | src-tauri/src/proxy/providers/transform_responses.rs:193-197 — 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:859` 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:14 — src-tauri/src/proxy/providers/transform_responses.rs:14-18 | src-tauri/src/proxy/providers/transform_responses.rs:45-49 — 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:14` 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/services/provider/endpoints.rs:87 — src-tauri/src/services/provider/endpoints.rs:87-91 | src-tauri/src/services/provider/endpoints.rs:111-115 — 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/endpoints.rs:87` 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/services/provider/live.rs:240 — src-tauri/src/services/provider/live.rs:240-244 | src-tauri/src/services/provider/live.rs:414-418 — 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/services/usage_stats.rs:576 — src-tauri/src/services/usage_stats.rs:576-581 | src-tauri/src/services/usage_stats.rs:696-700 — 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/usage_stats.rs:576` 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/session_manager/transcript.rs:2409 — src-tauri/src/session_manager/transcript.rs:2409-2413 | src-tauri/src/session_manager/transcript.rs:2417-2421 — 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/transcript.rs:2409` 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/forwarder/request_builder.rs:796 — src-tauri/src/proxy/forwarder/request_builder.rs:796-800 | src-tauri/src/proxy/gemini_url.rs:158-162 — 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 (5 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1348 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1348-1352 | src-tauri/src/proxy/providers/copilot_auth.rs:464-468 — 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 8 separate duplicated blocks between them, totalling at least 110 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/cli/commands/config_s3.rs:185 — src-tauri/src/cli/commands/config_s3.rs:185-189 | src-tauri/src/cli/commands/config_webdav.rs:265-269 — 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/cli/tui/runtime_systems/workers.rs:2867 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2867-2871 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3383-3387 — 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/cli/tui/runtime_systems/workers.rs:2867` 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 `state` to `Arc<Mutex<UsagePricingAggregateState>>` in one and `Arc<Mutex<UsageLogQueryState>>` 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/database/mod.rs:806 — src-tauri/src/database/mod.rs:806-810 | src-tauri/src/database/mod.rs:815-819 — 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:806` 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/streaming_codex_anthropic.rs:156 — src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:156-160 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:121-125 — 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.rs:664 — src-tauri/src/services/session_usage.rs:664-668 | src-tauri/src/services/session_usage_codex.rs:1462-1466 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_codex.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 84 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/session_usage.rs:664` 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.rs:830 — src-tauri/src/mcp.rs:830-834 | src-tauri/src/mcp.rs:843-847 — 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.rs:830` 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/session_manager/providers/hermes.rs:434 — src-tauri/src/session_manager/providers/hermes.rs:434-438 | REDACTED:616-620 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:434` 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, `REDACTED:622` calls `get` and `src-tauri/src/session_manager/providers/hermes.rs:440` 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/skill.rs:1450 — src-tauri/src/services/skill.rs:1450-1454 | src-tauri/src/services/skill.rs:2744-2748 — 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/cli/tui/app/helpers.rs:1489 — src-tauri/src/cli/tui/app/helpers.rs:1489-1493 | src-tauri/src/cli/tui/runtime_actions/providers.rs:348-352 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/cli/tui/app/helpers.rs:1488` calls `match` and `src-tauri/src/cli/tui/runtime_actions/providers.rs:347` 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/cli/tui/ui/pricing.rs:234 — src-tauri/src/cli/tui/ui/pricing.rs:234-238 | src-tauri/src/cli/tui/ui/usage.rs:1372-1376 — before extracting anything, compare `src-tauri/src/cli/tui/ui/pricing.rs` and `src-tauri/src/cli/tui/ui/usage.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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 (5 lines × 2) src-tauri/src/cli/tui/ui/usage.rs:1009 — src-tauri/src/cli/tui/ui/usage.rs:1009-1013 | src-tauri/src/cli/tui/ui/usage.rs:1051-1055 — 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/cli/tui/ui/usage.rs: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.
  • + 2 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×23
  • Hotspot: src-tauri/src/cli/tui/ui/forms/provider.rs src-tauri/src/cli/tui/ui/forms/provider.rs:1922 — src-tauri/src/cli/tui/ui/forms/provider.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 120 in cc_switch::cli::tui::ui::forms::provider::provider_field_label_and_value at line 1922. 7 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/ui/forms/provider.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/cli/tui/runtime_actions/mod.rs src-tauri/src/cli/tui/runtime_actions/mod.rs:514 — src-tauri/src/cli/tui/runtime_actions/mod.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 164 in cc_switch::cli::tui::runtime_actions::handle_action at line 514. 2 of those changes were fix/bug commits, and the other 3 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/runtime_actions/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-tauri/src/cli/tui/help.rs src-tauri/src/cli/tui/help.rs:104 — src-tauri/src/cli/tui/help.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in cc_switch::cli::tui::help::current_help_target at line 104. 7 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/help.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/cli/tui/app/form_handlers/provider.rs src-tauri/src/cli/tui/app/form_handlers/provider.rs:368 — src-tauri/src/cli/tui/app/form_handlers/provider.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 94 in App::handle_provider_field_activate at line 368. 5 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/app/form_handlers/provider.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/cli/tui/form/provider_json.rs src-tauri/src/cli/tui/form/provider_json.rs:281 — src-tauri/src/cli/tui/form/provider_json.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 82 in ProviderAddFormState::to_provider_json_value at line 281. 4 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/form/provider_json.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/skill.rs src-tauri/src/services/skill.rs:2025 — src-tauri/src/services/skill.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in SkillService::migrate_storage at line 2025. 5 of those changes were fix/bug commits, and the other 5 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/services/skill.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/cli/tui/app/overlay_handlers/dialogs.rs src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:75 — src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in App::handle_confirm_overlay_key at line 75. 2 of those changes were fix/bug commits, and the other 4 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/app/overlay_handlers/dialogs.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/database/schema.rs src-tauri/src/database/schema.rs:442 — src-tauri/src/database/schema.rs changed 7 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 442. 6 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00: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-tauri/src/cli/tui/form/provider_templates.rs src-tauri/src/cli/tui/form/provider_templates.rs:739 — src-tauri/src/cli/tui/form/provider_templates.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in ProviderAddFormState::apply_sponsor_preset at line 739. 4 of those changes were fix/bug commits, and the other 6 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/form/provider_templates.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/provider/mod.rs src-tauri/src/services/provider/mod.rs:1358 — src-tauri/src/services/provider/mod.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in ProviderService::refresh_provider_snapshot at line 1358. 5 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00: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-tauri/src/cli/tui/form/provider_state.rs src-tauri/src/cli/tui/form/provider_state.rs:480 — src-tauri/src/cli/tui/form/provider_state.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in ProviderAddFormState::fields at line 480. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/form/provider_state.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/cli/tui/app/content_config.rs src-tauri/src/cli/tui/app/content_config.rs:840 — src-tauri/src/cli/tui/app/content_config.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in App::on_settings_key at line 840. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/app/content_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.
  • Hotspot: src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:146 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in App::handle_picker_overlay_key at line 146. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/app/overlay_handlers/pickers.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/cli/commands/provider_input.rs src-tauri/src/cli/commands/provider_input.rs:568 — src-tauri/src/cli/commands/provider_input.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in cc_switch::cli::commands::provider_input::build_sponsor_template_settings_config at line 568. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/commands/provider_input.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/cli/tui/ui/config.rs src-tauri/src/cli/tui/ui/config.rs:3426 — src-tauri/src/cli/tui/ui/config.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in cc_switch::cli::tui::ui::config::render_settings at line 3426. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/ui/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.
  • Hotspot: src-tauri/src/cli/commands/provider_inspect.rs src-tauri/src/cli/commands/provider_inspect.rs:428 — src-tauri/src/cli/commands/provider_inspect.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in cc_switch::cli::commands::provider_inspect::quota_provider at line 428. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/commands/provider_inspect.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/cli/tui/runtime_systems/types.rs src-tauri/src/cli/tui/runtime_systems/types.rs:967 — src-tauri/src/cli/tui/runtime_systems/types.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in cc_switch::cli::tui::runtime_systems::types::fetch_provider_models_for_tui at line 967. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/runtime_systems/types.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/cli/tui/runtime_systems/workers.rs src-tauri/src/cli/tui/runtime_systems/workers.rs:1956 — src-tauri/src/cli/tui/runtime_systems/workers.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in cc_switch::cli::tui::runtime_systems::workers::run_session_scan at line 1956. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/runtime_systems/workers.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/proxy/providers/transform_codex_chat.rs src-tauri/src/proxy/providers/transform_codex_chat.rs:652 — src-tauri/src/proxy/providers/transform_codex_chat.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in cc_switch::proxy::providers::transform_codex_chat::append_responses_item_as_chat_message at line 652. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/proxy/providers/transform_codex_chat.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/provider/live.rs src-tauri/src/services/provider/live.rs:41 — src-tauri/src/services/provider/live.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in LiveSnapshot::restore at line 41. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/services/provider/live.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/proxy/providers/codex_oauth_auth.rs src-tauri/src/proxy/providers/codex_oauth_auth.rs:1151 — src-tauri/src/proxy/providers/codex_oauth_auth.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in CodexOAuthManager::resolve_valid_cached_token_under_lock at line 1151. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/proxy/providers/codex_oauth_auth.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/cli/tui/ui.rs src-tauri/src/cli/tui/ui.rs:137 — src-tauri/src/cli/tui/ui.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in cc_switch::cli::tui::ui::render_content at line 137. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/ui.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/cli/tui/app/menu.rs src-tauri/src/cli/tui/app/menu.rs:181 — src-tauri/src/cli/tui/app/menu.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in App::nav_item_for_route at line 181. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/app/menu.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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×22
  • Duplicated block (12 lines × 2) src-tauri/src/cli/tui/app/form_handlers/provider.rs:863 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:863-874 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:995-1006 — 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/cli/tui/app/form_handlers/provider.rs:863` 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/cli/tui/app/overlay_handlers/pickers.rs:625 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:625-636 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:686-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/cli/tui/app/overlay_handlers/pickers.rs:625` 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/cli/tui/app/overlay_handlers/pickers.rs:1277 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1277-1288 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1297-1308 — 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/cli/tui/app/overlay_handlers/pickers.rs:1277` 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/cli/tui/runtime_actions/editor.rs:384 — src-tauri/src/cli/tui/runtime_actions/editor.rs:384-395 | src-tauri/src/cli/tui/runtime_actions/prompts.rs:190-201 — 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/cli/tui/runtime_actions/editor.rs:384` 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 (12 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs:1300 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1300-1311 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1337-1348 — 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/cli/tui/runtime_actions/editor.rs:1300` 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/cli/tui/runtime_actions/editor.rs:1336` calls `load_state` and `src-tauri/src/cli/tui/runtime_actions/editor.rs:1299` 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/cli/tui/ui/forms/prompt.rs:41 — src-tauri/src/cli/tui/ui/forms/prompt.rs:41-52 | src-tauri/src/cli/tui/ui/forms/provider.rs:1548-1559 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/prompt.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 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/cli/tui/ui/forms/prompt.rs:41` 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/cli/tui/ui/forms/provider.rs:1208 — src-tauri/src/cli/tui/ui/forms/provider.rs:1208-1219 | src-tauri/src/cli/tui/ui/forms/provider.rs:1328-1339 — 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/cli/tui/ui/forms/provider.rs:1208` 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/cli/tui/ui/overlay/pickers.rs:1819 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:1819-1830 | src-tauri/src/cli/tui/ui/sessions.rs:760-771 — 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 (12 lines × 2) src-tauri/src/codex_history_migration.rs:999 — src-tauri/src/codex_history_migration.rs:999-1010 | src-tauri/src/codex_history_migration.rs:1138-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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/codex_history_migration.rs:999` 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/mcp.rs:364 — src-tauri/src/mcp.rs:364-375 | src-tauri/src/mcp.rs:755-766 — 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.rs:364` 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 (12 lines × 2) src-tauri/src/openclaw_config.rs:726 — src-tauri/src/openclaw_config.rs:726-737 | src-tauri/src/openclaw_config.rs:751-762 — 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/openclaw_config.rs:726` 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/handlers.rs:228 — src-tauri/src/proxy/handlers.rs:228-239 | src-tauri/src/proxy/handlers.rs:573-584 — 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:228` 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 × 2) src-tauri/src/proxy/providers/streaming.rs:425 — src-tauri/src/proxy/providers/streaming.rs:425-436 | src-tauri/src/proxy/providers/streaming.rs:525-536 — 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:425` 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/streaming_responses.rs:340 — src-tauri/src/proxy/providers/streaming_responses.rs:340-351 | src-tauri/src/proxy/providers/streaming_responses.rs:606-617 — 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:340` 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 (12 lines × 2) src-tauri/src/services/provider/mod.rs:4014 — src-tauri/src/services/provider/mod.rs:4014-4025 | src-tauri/src/services/provider/mod.rs:4101-4112 — 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:4014` 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 (12 lines × 2) src-tauri/src/services/skill.rs:2124 — src-tauri/src/services/skill.rs:2124-2135 | src-tauri/src/services/skill.rs:2152-2163 — 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 (12 lines × 2) src-tauri/src/services/usage_stats.rs:1837 — src-tauri/src/services/usage_stats.rs:1837-1848 | src-tauri/src/services/usage_stats.rs:1864-1875 — 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/usage_stats.rs:1837` 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 × 2) src-tauri/src/daemon/migration.rs:491 — src-tauri/src/daemon/migration.rs:491-503 | src-tauri/src/daemon/migration.rs:555-566 — 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/daemon/migration.rs:491` 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/daemon/migration.rs:505` calls `iter`, `filter_map`, `collect` and `src-tauri/src/daemon/migration.rs:567` 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/services/proxy.rs:3185 — src-tauri/src/services/proxy.rs:3185-3196 | src-tauri/src/services/proxy.rs:3202-3213 — 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 (12 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:918 — src-tauri/src/session_manager/providers/hermes.rs:918-929 | REDACTED:1311-1322 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:918` 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, `REDACTED:1308` calls `sqlite_session_uses_v2`, `search_session_sqlite_v2` and `src-tauri/src/session_manager/providers/hermes.rs:913` 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/cli/commands/mcp.rs:196 — src-tauri/src/cli/commands/mcp.rs:196-207 | src-tauri/src/cli/commands/prompts.rs:570-581 — 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/cli/commands/mcp.rs:196` 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.rs:381 — src-tauri/src/mcp.rs:381-392 | src-tauri/src/mcp.rs:772-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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/mcp.rs:381` 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.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×17
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D2 · Cognitive Complexity · ProviderService · ×16
  • ProviderService::fetch_provider_models (cognitive 96) src-tauri/src/services/provider/models.rs:24 — ProviderService::fetch_provider_models has cognitive complexity 96 (threshold 15). Drivers by points: if/else 17 (72 pts), loops 4 (21 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 73). 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.
  • ProviderService::refresh_provider_snapshot (cognitive 68) src-tauri/src/services/provider/mod.rs:1358 — ProviderService::refresh_provider_snapshot has cognitive complexity 68 (threshold 15). Drivers by points: if/else 31 (65 pts), boolean chains 2, match/switch 1 (nesting depth added 34). 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.
  • ProviderService::build_effective_live_snapshot (cognitive 46) src-tauri/src/services/provider/mod.rs:3642 — ProviderService::build_effective_live_snapshot has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 1 (5 pts), match/switch 1 (nesting depth added 27). 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.
  • ProviderService::apply_prepared_post_commit_action (cognitive 41) src-tauri/src/services/provider/mod.rs:1188 — ProviderService::apply_prepared_post_commit_action has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 4 (11 pts), boolean chains 3 (nesting depth added 17). 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 32) src-tauri/src/services/provider/mod.rs:3983 — ProviderService::delete has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, match/switch 2 (3 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::update (cognitive 30) src-tauri/src/services/provider/mod.rs:2504 — ProviderService::update has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 8, match/switch 1 (2 pts) (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.
  • ProviderService::sync_current_to_live (cognitive 30) src-tauri/src/services/provider/mod.rs:3142 — ProviderService::sync_current_to_live has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 pts), match/switch 3 (5 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.
  • ProviderService::save_claude_from_editor (cognitive 26) src-tauri/src/services/provider/claude_editor_service.rs:15 — ProviderService::save_claude_from_editor has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6, match/switch 1 (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.
  • ProviderService::prepare_post_commit_action (cognitive 26) src-tauri/src/services/provider/mod.rs:1007 — ProviderService::prepare_post_commit_action has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 3, 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.
  • ProviderService::validate_provider_settings (cognitive 26) src-tauri/src/services/provider/mod.rs:3773 — ProviderService::validate_provider_settings has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 1, match/switch 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.
  • ProviderService::extract_codex_common_config_from_config_toml (cognitive 22) src-tauri/src/services/provider/codex.rs:127 — ProviderService::extract_codex_common_config_from_config_toml has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 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::run_staged_transaction (cognitive 22) src-tauri/src/services/provider/mod.rs:847 — ProviderService::run_staged_transaction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 4 (5 pts) (nesting depth added 10). 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.
  • ProviderService::query_provider_usage (cognitive 20) src-tauri/src/services/provider/usage.rs:155 — ProviderService::query_provider_usage 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.
  • ProviderService::set_common_config_snippet (cognitive 19) src-tauri/src/services/provider/mod.rs:2208 — ProviderService::set_common_config_snippet has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, boolean chains 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.
  • ProviderService::prepare_live_snapshot (cognitive 19) src-tauri/src/services/provider/mod.rs:3419 — ProviderService::prepare_live_snapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (3 pts), boolean chains 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.
  • ProviderService::import_default_config (cognitive 18) src-tauri/src/services/provider/mod.rs:2683 — ProviderService::import_default_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×16
  • Duplicated block (14 lines × 2) src-tauri/src/cli/commands/provider_input.rs:2990 — src-tauri/src/cli/commands/provider_input.rs:2990-3003 | src-tauri/src/cli/tui/form/provider_json.rs:491-504 — before extracting anything, compare `src-tauri/src/cli/commands/provider_input.rs` and `src-tauri/src/cli/tui/form/provider_json.rs` as WHOLE FILES: this scan already matched 6 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. 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/cli/commands/provider_input.rs:2990` 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/cli/tui/ui/config.rs:1575 — src-tauri/src/cli/tui/ui/config.rs:1575-1588 | src-tauri/src/cli/tui/ui/config.rs:2565-2578 — 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/cli/tui/ui/config.rs:1575` 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/cli/tui/ui/config.rs:3960 — src-tauri/src/cli/tui/ui/config.rs:3960-3973 | src-tauri/src/cli/tui/ui/config.rs:4013-4026 — 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 (14 lines × 2) src-tauri/src/cli/tui/ui/editor.rs:15 — src-tauri/src/cli/tui/ui/editor.rs:15-28 | src-tauri/src/cli/tui/ui/skills/detail.rs:38-51 — 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 (14 lines × 2) src-tauri/src/cli/tui/ui/forms/shared.rs:545 — src-tauri/src/cli/tui/ui/forms/shared.rs:545-558 | src-tauri/src/cli/tui/ui/forms/shared.rs:580-593 — 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/cli/tui/ui/forms/shared.rs:545` 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/cli/tui/ui/usage.rs:495 — src-tauri/src/cli/tui/ui/usage.rs:495-508 | src-tauri/src/cli/tui/ui/usage.rs:522-535 — 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 (14 lines × 2) src-tauri/src/codex_history_migration.rs:576 — src-tauri/src/codex_history_migration.rs:576-589 | src-tauri/src/codex_history_migration.rs:1501-1514 — 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/codex_history_migration.rs:1098 — src-tauri/src/codex_history_migration.rs:1098-1111 | src-tauri/src/codex_history_migration.rs:1161-1174 — 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 (14 lines × 2) src-tauri/src/daemon/mod.rs:44 — src-tauri/src/daemon/mod.rs:44-57 | src-tauri/src/daemon/mod.rs:70-83 — 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/daemon/mod.rs:44` 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/proxy/forwarder.rs:1195 — src-tauri/src/proxy/forwarder.rs:1195-1208 | src-tauri/src/proxy/handlers.rs:1302-1315 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `&reqwest::Response` in one and `&super::forwarder::LiveResponse` 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 (14 lines × 2) src-tauri/src/proxy/handlers.rs:267 — src-tauri/src/proxy/handlers.rs:267-280 | src-tauri/src/proxy/handlers.rs:384-397 — 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:267` 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.rs:441 — src-tauri/src/proxy/providers/streaming.rs:441-454 | src-tauri/src/proxy/providers/streaming.rs:457-470 — 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:441` 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:437` calls `insert` and `src-tauri/src/proxy/providers/streaming.rs:453` 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 lines × 2) src-tauri/src/services/provider/mod.rs:2719 — src-tauri/src/services/provider/mod.rs:2719-2732 | src-tauri/src/services/provider/mod.rs:2829-2842 — 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:2719` 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/cli/tui/ui/shared.rs:981 — src-tauri/src/cli/tui/ui/shared.rs:981-994 | src-tauri/src/cli/tui/ui/shared.rs:1045-1058 — 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/cli/tui/ui/shared.rs:981` 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/proxy.rs:4133 — src-tauri/src/services/proxy.rs:4133-4146 | src-tauri/src/services/proxy.rs:4149-4162 — 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 (14 lines × 2) src-tauri/src/cli/commands/provider.rs:1059 — src-tauri/src/cli/commands/provider.rs:1059-1072 | src-tauri/src/cli/commands/provider.rs:2133-2146 — 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.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×15
  • Edited copy of a member (12 corresponding lines) src-tauri/src/services/session_usage_pi.rs:300 — src-tauri/src/services/session_usage_pi.rs:300-319 | src-tauri/src/services/session_usage_pi.rs:321-332 — 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/cli/tui/form/provider_state.rs:865 — src-tauri/src/cli/tui/form/provider_state.rs:865-876 | src-tauri/src/cli/tui/form/provider_state.rs:878-889 — 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/cli/tui/runtime_actions/config.rs:345 — src-tauri/src/cli/tui/runtime_actions/config.rs:345-356 | src-tauri/src/cli/tui/runtime_actions/config.rs:361-374 — 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/cli/tui/runtime_systems/workers.rs:2908 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2908-2919 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3419-3430 — 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/cli/tui/runtime_systems/session_cost/mod.rs:114 — src-tauri/src/cli/tui/runtime_systems/session_cost/mod.rs:114-128 | src-tauri/src/cli/tui/runtime_systems/session_cost/mod.rs:130-141 — 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:264 — src-tauri/src/services/s3_sync.rs:264-275 | REDACTED:344-355 — 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/skill.rs:1635 — src-tauri/src/services/skill.rs:1635-1646 | src-tauri/src/services/skill.rs:1648-1664 — 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:956 — src-tauri/src/openclaw_config.rs:956-967 | src-tauri/src/openclaw_config.rs:974-988 — 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/cli/tui/app/content_config.rs:275 — src-tauri/src/cli/tui/app/content_config.rs:275-286 | src-tauri/src/cli/tui/app/content_config.rs:400-411 — 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/provider_preset_pi.rs:474 — src-tauri/src/provider_preset_pi.rs:474-501 | src-tauri/src/provider_preset_pi.rs:503-514 — 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/cli/tui/data.rs:1436 — src-tauri/src/cli/tui/data.rs:1436-1447 | src-tauri/src/cli/provider_quota.rs:77-88 — 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/cli/tui/ui/shared.rs:1159 — src-tauri/src/cli/tui/ui/shared.rs:1159-1170 | src-tauri/src/cli/tui/ui/usage.rs:362-374 — 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/cli/claude_temp_launch.rs:224 — src-tauri/src/cli/claude_temp_launch.rs:224-235 | src-tauri/src/cli/codex_temp_launch.rs:258-269 — 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/database/dao/model_pricing.rs:99 — src-tauri/src/database/dao/model_pricing.rs:99-111 | src-tauri/src/database/dao/proxy.rs:1061-1072 — 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/prompt.rs:453 — src-tauri/src/services/prompt.rs:453-465 | src-tauri/src/cli/tui/ui/shared.rs:1361-1372 — 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.
D3 · God Classes · ClassTooLong · ×14
  • ClassTooLong: ProxyService src-tauri/src/services/proxy.rs:50 — ClassTooLong — 2988 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 162 methods, 2 blocks, lines 50-4306. The bar is 400 significant lines; this is 2588 over it, 7.47× 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: ProviderService src-tauri/src/services/provider/mod.rs:91 — ClassTooLong — 2690 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 157 methods. The bar is 400 significant lines; this is 2290 over it, 6.73× 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: SkillService src-tauri/src/services/skill.rs:622 — ClassTooLong — 2126 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 126 methods. The bar is 400 significant lines; this is 1726 over it, 5.32× 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: SessionsState src-tauri/src/cli/tui/app/types.rs:1121 — ClassTooLong — 1525 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 111 methods, 3 blocks, lines 1121-4242. The bar is 400 significant lines; this is 1125 over it, 3.81× 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:373 — ClassTooLong — 999 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 34 methods, 2 blocks, lines 373-2010. The bar is 400 significant lines; this is 599 over it, 2.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: Supervisor src-tauri/src/daemon/supervisor.rs:91 — ClassTooLong — 761 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 31 methods, 3 blocks, lines 91-1170. The bar is 400 significant lines; this is 361 over it, 1.90× 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: RequestForwarder src-tauri/src/proxy/forwarder.rs:28 — ClassTooLong — 668 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 17 methods, 2 blocks, lines 28-1096. The bar is 400 significant lines; this is 268 over it, 1.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: CopilotAuthManager src-tauri/src/proxy/providers/copilot_auth.rs:411 — ClassTooLong — 662 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 36 methods, 2 blocks, lines 411-1563. 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: TranscriptIndexStore src-tauri/src/session_manager/transcript.rs:426 — ClassTooLong — 573 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 17 methods, 2 blocks, lines 426-1240. The bar is 400 significant lines; this is 173 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: ChatToResponsesState src-tauri/src/proxy/providers/streaming_codex_chat.rs:67 — ClassTooLong — 567 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 3 blocks, lines 67-877. 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.
  • ClassTooLong: TranscriptRemotePager src-tauri/src/cli/tui/app/types.rs:1023 — ClassTooLong — 513 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 28 methods, 2 blocks, lines 1023-2036. The bar is 400 significant lines; this is 113 over it, 1.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: EditorState src-tauri/src/cli/tui/app/editor_state.rs:80 — ClassTooLong — 500 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 2 blocks, lines 80-820. The bar is 400 significant lines; this is 100 over it, 1.25× 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: UiDataByAppCache src-tauri/src/cli/tui/mod.rs:448 — ClassTooLong — 454 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 2 blocks, lines 448-1237. The bar is 400 significant lines; this is 54 over it, 1.14× 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: ScanCacheStore src-tauri/src/session_manager/scan_cache_store.rs:39 — ClassTooLong — 416 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 16 methods, 2 blocks, lines 39-743. The bar is 400 significant lines; this is 16 over it, 1.04× 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.
D3 · God Classes · TooManyMethods · ×13
  • TooManyMethods: App src-tauri/src/cli/tui/app/app_state.rs:722 — TooManyMethods — 281 methods, declared across 19 files: app/menu.rs (61), app/content_config.rs (53), form_handlers/provider.rs (36), overlay_handlers/pickers.rs (29), +15 more file(s). The bar is 30 methods; this is 251 over it, 9.37× 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: Database src-tauri/src/database/mod.rs:382 — TooManyMethods — 252 methods, declared across 17 files: dao/proxy.rs (46), database/schema.rs (41), REDACTED (37), dao/settings.rs (25), +13 more file(s). The bar is 30 methods; this is 222 over it, 8.40× 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: ProviderAddFormState src-tauri/src/cli/tui/form.rs:541 — TooManyMethods — 206 methods, declared across 4 files: form/provider_state.rs (178), form/provider_json.rs (15), form/provider_templates.rs (11), tui/form.rs (2). The bar is 30 methods; this is 176 over it, 6.87× 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: ProxyService src-tauri/src/services/proxy.rs:50 — TooManyMethods — 162 methods. The bar is 30 methods; this is 132 over it, 5.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: ProviderService src-tauri/src/services/provider/mod.rs:91 — TooManyMethods — 157 methods, declared across 10 files: provider/mod.rs (102), provider/codex.rs (15), provider/usage.rs (9), provider/claude.rs (8), +6 more file(s). The bar is 30 methods; this is 127 over it, 5.23× 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:622 — TooManyMethods — 126 methods, declared across 2 files: services/skill.rs (101), skill/discovery.rs (25). The bar is 30 methods; this is 96 over it, 4.20× 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: SessionsState src-tauri/src/cli/tui/app/types.rs:1121 — TooManyMethods — 111 methods. The bar is 30 methods; this is 81 over it, 3.70× 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: McpAddFormState src-tauri/src/cli/tui/form.rs:693 — TooManyMethods — 41 methods, declared across 2 files: form/mcp.rs (40), tui/form.rs (1). The bar is 30 methods; this is 11 over it, 1.37× 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: PagedListState src-tauri/src/cli/tui/app/paged_list.rs:143 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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: CopilotAuthManager src-tauri/src/proxy/providers/copilot_auth.rs:411 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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: PagedManifestStore src-tauri/src/session_manager/paged_manifest.rs:397 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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:373 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× 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: Supervisor src-tauri/src/daemon/supervisor.rs:91 — TooManyMethods — 31 methods. The bar is 30 methods; 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 (16 corresponding lines) · ×13
  • Edited copy of a member (16 corresponding lines) src-tauri/src/session_manager/cache.rs:125 — src-tauri/src/session_manager/cache.rs:125-146 | src-tauri/src/session_manager/cache.rs:160-175 — 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/services/provider/pi.rs:89 — src-tauri/src/services/provider/pi.rs:89-107 | src-tauri/src/services/provider/pi.rs:109-124 — 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/cli/commands/auth.rs:298 — src-tauri/src/cli/commands/auth.rs:298-313 | src-tauri/src/cli/commands/failover.rs:182-199 — 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/cli/tui/app/content_entities.rs:93 — src-tauri/src/cli/tui/app/content_entities.rs:93-109 | src-tauri/src/cli/tui/app/content_entities.rs:111-126 — 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/cli/commands/start.rs:408 — src-tauri/src/cli/commands/start.rs:408-423 | src-tauri/src/cli/tui/runtime_actions/claude_temp_launch.rs:86-105 — 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/usage/parser.rs:530 — src-tauri/src/proxy/usage/parser.rs:530-545 | src-tauri/src/proxy/usage/parser.rs:572-590 — 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/codex_state_db.rs:52 — src-tauri/src/codex_state_db.rs:52-67 | src-tauri/src/settings.rs:835-851 — 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/cli/tui/runtime_systems/workers.rs:2934 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2934-2949 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3301-3319 — 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:1410 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1410-1426 | src-tauri/src/proxy/providers/copilot_auth.rs:572-587 — 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/cli/tui/runtime_systems/workers.rs:1057 — src-tauri/src/cli/tui/runtime_systems/workers.rs:1057-1075 | src-tauri/src/cli/tui/runtime_systems/workers.rs:1094-1109 — 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/usage/parser.rs:108 — src-tauri/src/proxy/usage/parser.rs:108-123 | src-tauri/src/proxy/usage/parser.rs:228-243 — 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/cli/tui/mod.rs:1465 — src-tauri/src/cli/tui/mod.rs:1465-1481 | src-tauri/src/cli/tui/mod.rs:1486-1501 — 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/cli/tui/ui/shared.rs:1142 — src-tauri/src/cli/tui/ui/shared.rs:1142-1157 | src-tauri/src/cli/tui/ui/shared.rs:1172-1187 — 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 (10 corresponding lines) · ×13
  • Edited copy of a member (10 corresponding lines) src-tauri/src/services/pi_prompt_files.rs:129 — src-tauri/src/services/pi_prompt_files.rs:129-138 | src-tauri/src/services/pi_prompt_files.rs:233-243 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/app/editor_state.rs:715 — src-tauri/src/cli/tui/app/editor_state.rs:715-724 | src-tauri/src/cli/tui/app/editor_state.rs:732-744 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/ui/overlay/layout.rs:87 — src-tauri/src/cli/tui/ui/overlay/layout.rs:87-103 | src-tauri/src/cli/tui/ui/overlay/layout.rs:126-135 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/data.rs:1393 — src-tauri/src/cli/tui/data.rs:1393-1409 | src-tauri/src/cli/tui/data.rs:1425-1434 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/opencode_config.rs:26 — src-tauri/src/opencode_config.rs:26-36 | REDACTED:29-38 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/form/s3.rs:212 — src-tauri/src/cli/tui/form/s3.rs:212-223 | src-tauri/src/cli/tui/form/webdav.rs:131-140 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/runtime_actions/mod.rs:344 — src-tauri/src/cli/tui/runtime_actions/mod.rs:344-353 | src-tauri/src/cli/tui/runtime_actions/mod.rs:357-366 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/gemini_config.rs:145 — src-tauri/src/gemini_config.rs:145-155 | src-tauri/src/openclaw_config.rs:125-134 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/ui/overlay/frame.rs:78 — src-tauri/src/cli/tui/ui/overlay/frame.rs:78-87 | src-tauri/src/cli/tui/ui/sessions.rs:337-349 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/data.rs:3486 — src-tauri/src/cli/tui/data.rs:3486-3495 | src-tauri/src/cli/tui/data.rs:3497-3507 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/services/provider/common_config.rs:417 — src-tauri/src/services/provider/common_config.rs:417-426 | src-tauri/src/services/provider/live_merge.rs:205-217 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/claude_temp_launch.rs:151 — src-tauri/src/cli/claude_temp_launch.rs:151-160 | src-tauri/src/cli/codex_temp_launch.rs:130-139 — 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.
  • Edited copy of a member (10 corresponding lines) src-tauri/src/cli/tui/ui/config.rs:2087 — src-tauri/src/cli/tui/ui/config.rs:2087-2097 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:330-339 — 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 · Duplicated block (15 lines × 2) · ×13
  • Duplicated block (15 lines × 2) src-tauri/src/claude_mcp.rs:338 — src-tauri/src/claude_mcp.rs:338-352 | src-tauri/src/gemini_mcp.rs:176-190 — before extracting anything, compare `src-tauri/src/claude_mcp.rs` and `src-tauri/src/gemini_mcp.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/claude_mcp.rs:338` 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/cli/tui/app/content_entities.rs:814 — src-tauri/src/cli/tui/app/content_entities.rs:814-828 | src-tauri/src/cli/tui/app/content_entities.rs:855-869 — 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/cli/tui/app/content_entities.rs:814` 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/cli/tui/app/content_entities.rs:830 — src-tauri/src/cli/tui/app/content_entities.rs:830-844 | src-tauri/src/cli/tui/app/content_entities.rs:871-885 — 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/cli/tui/app/content_entities.rs:830` 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/cli/tui/app/types.rs:1840 — src-tauri/src/cli/tui/app/types.rs:1840-1854 | src-tauri/src/cli/tui/app/types.rs:2215-2229 — 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/cli/tui/ui/overlay/pickers.rs:257 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:257-271 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1145-1159 — 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/cli/tui/ui/overlay/pickers.rs:257` 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/proxy/forwarder.rs:737 — src-tauri/src/proxy/forwarder.rs:737-751 | src-tauri/src/proxy/forwarder.rs:934-948 — 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:737` 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/proxy/handlers.rs:395 — src-tauri/src/proxy/handlers.rs:395-409 | src-tauri/src/proxy/handlers.rs:824-838 — 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:395` 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/streaming_codex_chat.rs:499 — src-tauri/src/proxy/providers/streaming_codex_chat.rs:499-513 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:733-747 — 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:730` calls `is_empty` and `src-tauri/src/proxy/providers/streaming_codex_chat.rs:498` 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 (15 lines × 2) src-tauri/src/proxy/response.rs:218 — src-tauri/src/proxy/response.rs:218-232 | src-tauri/src/proxy/response.rs:282-296 — 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.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.
  • Duplicated block (15 lines × 2) src-tauri/src/services/usage_stats.rs:852 — src-tauri/src/services/usage_stats.rs:852-866 | src-tauri/src/services/usage_stats.rs:1017-1031 — 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:886 — src-tauri/src/session_manager/providers/codex.rs:886-900 | src-tauri/src/session_manager/providers/openclaw.rs:541-555 — 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 10 separate duplicated blocks between them, totalling at least 125 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/hermes.rs:952 — src-tauri/src/session_manager/providers/hermes.rs:952-966 | REDACTED:1396-1410 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:952` 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/session_manager/scan_cache_store.rs:475 — src-tauri/src/session_manager/scan_cache_store.rs:475-489 | src-tauri/src/session_manager/scan_cache_store.rs:504-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/session_manager/scan_cache_store.rs:475` 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.
D2 · Cognitive Complexity · SkillService · ×12
  • SkillService::migrate_storage (cognitive 92) src-tauri/src/services/skill.rs:2025 — SkillService::migrate_storage has cognitive complexity 92 (threshold 15). Drivers by points: if/else 24 (59 pts), match/switch 5 (14 pts), loops 7 (11 pts), boolean chains 8 (nesting depth added 48). 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_ssot_if_pending (cognitive 79) src-tauri/src/services/skill.rs:893 — SkillService::migrate_ssot_if_pending has cognitive complexity 79 (threshold 15). Drivers by points: if/else 17 (53 pts), match/switch 6 (16 pts), loops 5 (9 pts), boolean chains 1 (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.
  • SkillService::check_updates (cognitive 39) src-tauri/src/services/skill.rs:2539 — SkillService::check_updates has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 6 (20 pts), if/else 5 (15 pts), loops 3 (4 pts) (nesting depth added 25). 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_skill (cognitive 28) src-tauri/src/services/skill.rs:2679 — SkillService::update_skill has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 1, loops 1, match/switch 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::scan_unmanaged (cognitive 26) src-tauri/src/services/skill.rs:3349 — SkillService::scan_unmanaged has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 2 (5 pts), loops 3 (4 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::import_from_apps (cognitive 24) src-tauri/src/services/skill.rs:3434 — SkillService::import_from_apps has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 5 (6 pts), match/switch 1 (2 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.
  • SkillService::extract_repo_archive_with_limits (cognitive 23) src-tauri/src/services/skill/discovery.rs:578 — SkillService::extract_repo_archive_with_limits has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), match/switch 1 (2 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.
  • SkillService::sync_to_app_unlocked (cognitive 23) src-tauri/src/services/skill.rs:1584 — SkillService::sync_to_app_unlocked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (3 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.
  • SkillService::merge_local_ssot_skills (cognitive 20) src-tauri/src/services/skill/discovery.rs:103 — SkillService::merge_local_ssot_skills has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), match/switch 1 (3 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.
  • SkillService::source_path_from_readme (cognitive 20) src-tauri/src/services/skill.rs:2451 — SkillService::source_path_from_readme has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 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_updated_skill_to_app (cognitive 17) src-tauri/src/services/skill.rs:1421 — SkillService::sync_updated_skill_to_app has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, 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.
  • SkillService::migration_tree_hash_with_ignored_root_file::visit (cognitive 17) src-tauri/src/services/skill.rs:1677 — SkillService::migration_tree_hash_with_ignored_root_file::visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 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.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×12
  • Edited copy of a member (9 corresponding lines) src-tauri/src/cli/tui/form/provider_state.rs:922 — src-tauri/src/cli/tui/form/provider_state.rs:922-938 | src-tauri/src/cli/tui/form/s3.rs:185-193 — 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/config.rs:293 — src-tauri/src/config.rs:293-301 | src-tauri/src/opencode_config.rs:42-50 — 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/cli/tui/runtime_actions/config.rs:164 — src-tauri/src/cli/tui/runtime_actions/config.rs:164-172 | src-tauri/src/cli/tui/runtime_actions/config.rs:194-202 — 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/cli/tui/runtime_actions/skills.rs:238 — src-tauri/src/cli/tui/runtime_actions/skills.rs:238-246 | src-tauri/src/cli/tui/runtime_actions/skills.rs:266-277 — 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/cli/commands/provider_inspect.rs:1367 — src-tauri/src/cli/commands/provider_inspect.rs:1367-1375 | src-tauri/src/proxy/providers/copilot_model_map.rs:74-84 — 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/codex_history_migration.rs:303 — src-tauri/src/codex_history_migration.rs:303-311 | src-tauri/src/codex_history_migration.rs:1693-1706 — 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/cli/tui/runtime_actions/providers.rs:87 — src-tauri/src/cli/tui/runtime_actions/providers.rs:87-98 | src-tauri/src/cli/tui/runtime_actions/editor.rs:99-107 — 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/cli/tui/runtime_actions/config.rs:394 — src-tauri/src/cli/tui/runtime_actions/config.rs:394-402 | src-tauri/src/cli/tui/runtime_actions/editor.rs:401-410 — 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/hermes_config.rs:793 — src-tauri/src/hermes_config.rs:793-803 | src-tauri/src/cli/tui/data.rs:1801-1809 — 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/database/dao/failover.rs:112 — src-tauri/src/database/dao/failover.rs:112-122 | src-tauri/src/database/dao/proxy.rs:1171-1179 — 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/transform_codex_chat.rs:522 — src-tauri/src/proxy/providers/transform_codex_chat.rs:522-533 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:36-44 — 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 · Duplicated block (13 lines × 2) · ×12
  • Duplicated block (13 lines × 2) src-tauri/src/cli/claude_temp_launch.rs:280 — src-tauri/src/cli/claude_temp_launch.rs:280-292 | src-tauri/src/cli/codex_temp_launch.rs:321-333 — before extracting anything, compare `src-tauri/src/cli/claude_temp_launch.rs` and `src-tauri/src/cli/codex_temp_launch.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 41 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 (13 lines × 2) src-tauri/src/cli/commands/provider_input.rs:2724 — src-tauri/src/cli/commands/provider_input.rs:2724-2736 | src-tauri/src/cli/commands/provider_input.rs:2750-2762 — 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/cli/commands/provider_input.rs:3667 — src-tauri/src/cli/commands/provider_input.rs:3667-3679 | src-tauri/src/cli/tui/form/provider_json.rs:1556-1568 — before extracting anything, compare `src-tauri/src/cli/commands/provider_input.rs` and `src-tauri/src/cli/tui/form/provider_json.rs` as WHOLE FILES: this scan already matched 6 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. 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 (13 lines × 2) src-tauri/src/cli/commands/provider_inspect.rs:987 — src-tauri/src/cli/commands/provider_inspect.rs:987-999 | src-tauri/src/cli/tui/ui/shared.rs:628-640 — 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.
  • Duplicated block (13 lines × 2) src-tauri/src/cli/tui/app/helpers.rs:1601 — src-tauri/src/cli/tui/app/helpers.rs:1601-1613 | src-tauri/src/cli/tui/ui/skills/helpers.rs:8-20 — 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/cli/tui/app/helpers.rs:1601` 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:345 — src-tauri/src/proxy/forwarder.rs:345-357 | src-tauri/src/proxy/forwarder.rs:590-602 — 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:345` 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/proxy/providers/codex_oauth_auth.rs:1891 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1891-1903 | src-tauri/src/proxy/providers/copilot_auth.rs:1227-1239 — 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 8 separate duplicated blocks between them, totalling at least 110 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:1891` 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/services/proxy.rs:3152 — src-tauri/src/services/proxy.rs:3152-3164 | src-tauri/src/services/proxy.rs:3201-3213 — 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 (13 lines × 2) src-tauri/src/services/proxy/codex_toml.rs:7 — src-tauri/src/services/proxy/codex_toml.rs:7-19 | src-tauri/src/services/proxy/codex_toml.rs:46-58 — 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/proxy/codex_toml.rs:7` 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/session_manager/providers/hermes.rs:156 — src-tauri/src/session_manager/providers/hermes.rs:156-168 | REDACTED:178-190 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:156` 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 lines × 2) src-tauri/src/session_manager/terminal/mod.rs:33 — src-tauri/src/session_manager/terminal/mod.rs:33-45 | src-tauri/src/session_manager/terminal/mod.rs:56-72 — 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/database/dao/proxy.rs:257 — src-tauri/src/database/dao/proxy.rs:257-269 | src-tauri/src/database/dao/proxy.rs:309-321 — 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.
D1 · Cyclomatic Complexity · ProviderService · ×11
  • ProviderService::refresh_provider_snapshot (cyclomatic 36) src-tauri/src/services/provider/mod.rs:1358 — ProviderService::refresh_provider_snapshot 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.
  • ProviderService::delete (cyclomatic 29) src-tauri/src/services/provider/mod.rs:3983 — ProviderService::delete 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.
  • ProviderService::apply_prepared_post_commit_action (cyclomatic 25) src-tauri/src/services/provider/mod.rs:1188 — ProviderService::apply_prepared_post_commit_action 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::update (cyclomatic 23) src-tauri/src/services/provider/mod.rs:2504 — ProviderService::update 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.
  • ProviderService::fetch_provider_models (cyclomatic 21) src-tauri/src/services/provider/models.rs:24 — ProviderService::fetch_provider_models 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.
  • ProviderService::build_effective_live_snapshot (cyclomatic 19) src-tauri/src/services/provider/mod.rs:3642 — ProviderService::build_effective_live_snapshot 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.
  • ProviderService::validate_provider_settings (cyclomatic 19) src-tauri/src/services/provider/mod.rs:3773 — ProviderService::validate_provider_settings 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.
  • ProviderService::save_claude_from_editor (cyclomatic 18) src-tauri/src/services/provider/claude_editor_service.rs:15 — ProviderService::save_claude_from_editor 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::prepare_post_commit_action (cyclomatic 17) src-tauri/src/services/provider/mod.rs:1007 — ProviderService::prepare_post_commit_action 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.
  • ProviderService::import_default_config (cyclomatic 17) src-tauri/src/services/provider/mod.rs:2683 — ProviderService::import_default_config 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.
  • ProviderService::sync_current_to_live (cyclomatic 16) src-tauri/src/services/provider/mod.rs:3142 — ProviderService::sync_current_to_live 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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×11
  • Repeated repair: src-tauri/src/cli/i18n.rs src-tauri/src/cli/i18n.rs:1807 — src-tauri/src/cli/i18n.rs changed 13 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 10 (its worst body is cc_switch::cli::i18n::texts::tui_local_proxy_settings_summary at line 1807), 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): bind managed ChatGPT accounts to official providers (#550)”; “fix(tui): align managed OAuth quota controls with upstream”; “fix(tui): clarify managed Codex OAuth quota refresh controls”; “fix(tui): add independent 1M toggle for Claude default model (#519)”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/i18n.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/cli/tui/form/provider_state_loading.rs src-tauri/src/cli/tui/form/provider_state_loading.rs:74 — src-tauri/src/cli/tui/form/provider_state_loading.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 15 (its worst body is cc_switch::cli::tui::form::provider_state_loading::populate_usage_query_form at line 74), 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): bind managed ChatGPT accounts to official providers (#550)”; “fix(codex): preserve provider authentication in forms”; “fix(tui): align managed OAuth quota controls with upstream”; “fix(tui): clarify managed Codex OAuth quota refresh controls”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/form/provider_state_loading.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/sync_protocol.rs src-tauri/src/services/sync_protocol.rs:212 — src-tauri/src/services/sync_protocol.rs 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 6 (its worst body is cc_switch::services::sync_protocol::validate_manifest_compat at line 212), 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(database): support upstream schemas 23–26 for sync restore (#549)”; “fix(database): align schema migrations through upstream v22 (#528)”; “fix(database): align schema and migrations with upstream v20 (#484)”; “fix(config): avoid nested executor during SQL import”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/services/sync_protocol.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/codex_config.rs src-tauri/src/codex_config.rs:3499 — src-tauri/src/codex_config.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 14 (its worst body is cc_switch::codex_config::codex_auth_resolved_mode at line 3499), 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): bind managed ChatGPT accounts to official providers (#550)”; “fix(codex): preserve provider authentication in forms”; “fix(codex): align provider switching and auth with upstream (#486)”; “fix(codex): respect user-owned model_catalog_json when generating catalog (#454)”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/codex_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/store.rs src-tauri/src/store.rs:232 — src-tauri/src/store.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 11 (its worst body is AppState::import_live_provider_configs_on_startup at line 232), 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(claude): align configuration editing with upstream (#536)”; “fix(codex): align provider switching and auth with upstream (#486)”; “fix(skills): preserve removed default repositories”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/store.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/cli/provider_quota.rs src-tauri/src/cli/provider_quota.rs:202 — src-tauri/src/cli/provider_quota.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 7 (its worst body is cc_switch::cli::provider_quota::usage_value_summary at line 202), 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(tui): align managed OAuth quota controls with upstream”; “fix(tui): clarify managed Codex OAuth quota refresh controls”; “fix(database): align schema and migrations with upstream v20 (#484)”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/provider_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-tauri/src/cli/commands/auth.rs src-tauri/src/cli/commands/auth.rs:372 — src-tauri/src/cli/commands/auth.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::cli::commands::auth::reset_quota at line 372), 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-oauth): isolate shared workspace accounts (#509)”; “fix: pin quota reset targets and distinguish inspection failures (#477)”; “fix(database): align schema and migrations with upstream v20 (#484)”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/commands/auth.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: REDACTED REDACTED:444 — REDACTED 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 5 (its worst body is cc_switch::services::webdav_sync::detect_v1_manifest at line 444), 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(database): support upstream schemas 23–26 for sync restore (#549)”; “fix(config): support symlinked home directory ancestors (#490)”; “fix(skills): coordinate state mutations”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00: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-tauri/src/services/provider/codex.rs src-tauri/src/services/provider/codex.rs:127 — src-tauri/src/services/provider/codex.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 13 (its worst body is ProviderService::extract_codex_common_config_from_config_toml at line 127), 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): bind managed ChatGPT accounts to official providers (#550)”; “fix(codex): align provider switching and auth with upstream (#486)”; “fix(provider): preserve Codex model mappings on switch”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/services/provider/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/session_manager/paged_manifest.rs src-tauri/src/session_manager/paged_manifest.rs:1621 — src-tauri/src/session_manager/paged_manifest.rs changed 3 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 15 (its worst body is PagedManifestBuilder::publish at line 1621), 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(sessions): allow Windows snapshot publication and cleanup (#552)”; “fix(config): support symlinked home directory ancestors (#490)”; “fix(sessions): allow Windows session cache synchronization (#455)”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/session_manager/paged_manifest.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/cli/tui/ui/forms/shared.rs src-tauri/src/cli/tui/ui/forms/shared.rs:14 — src-tauri/src/cli/tui/ui/forms/shared.rs changed 3 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 13 (its worst body is cc_switch::cli::tui::ui::forms::shared::add_form_key_items at line 14), 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(claude): align configuration editing with upstream (#536)”; “fix(tui): add independent 1M toggle for Claude default model (#519)”; “fix(tui): replace provider template chip row with a template field and grouped picker (#428)”. 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-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 18:43:52 +00:00' --until='2026-11-12 18:43:52 +00:00' --full-history --no-merges -- src-tauri/src/cli/tui/ui/forms/shared.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.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×11
  • Edited copy of a member (13 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1862 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1862-1874 | src-tauri/src/proxy/providers/copilot_auth.rs:1188-1201 — 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/codex_history_migration.rs:1675 — src-tauri/src/codex_history_migration.rs:1675-1687 | REDACTED:888-900 — 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/cli/tui/app/helpers.rs:1429 — src-tauri/src/cli/tui/app/helpers.rs:1429-1441 | src-tauri/src/session_manager/query_manifest.rs:180-192 — 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/cli/tui/runtime_actions/config.rs:177 — src-tauri/src/cli/tui/runtime_actions/config.rs:177-189 | src-tauri/src/cli/tui/runtime_actions/config.rs:250-262 — 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/cli/tui/runtime_actions/claude_temp_launch.rs:52 — src-tauri/src/cli/tui/runtime_actions/claude_temp_launch.rs:52-64 | src-tauri/src/cli/tui/runtime_actions/codex_temp_launch.rs:39-51 — 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/cli/commands/provider_usage_query.rs:351 — src-tauri/src/cli/commands/provider_usage_query.rs:351-363 | src-tauri/src/services/provider/mod.rs:3948-3961 — 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/daemon/supervisor.rs:1254 — src-tauri/src/daemon/supervisor.rs:1254-1266 | src-tauri/src/services/proxy.rs:4110-4123 — 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/deeplink/utils.rs:8 — src-tauri/src/deeplink/utils.rs:8-20 | src-tauri/src/services/webdav.rs:51-63 — 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/cli/tui/form/provider_state.rs:1429 — src-tauri/src/cli/tui/form/provider_state.rs:1429-1441 | src-tauri/src/cli/tui/form/provider_state.rs:2558-2570 — 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/cli/tui/form/provider_state.rs:3033 — src-tauri/src/cli/tui/form/provider_state.rs:3033-3045 | src-tauri/src/cli/commands/provider_input.rs:3067-3079 — 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/s3_sync.rs:325 — src-tauri/src/services/s3_sync.rs:325-337 | REDACTED:375-387 — 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 (14 corresponding lines) · ×11
  • Edited copy of a member (14 corresponding lines) src-tauri/src/services/provider/common_config.rs:257 — src-tauri/src/services/provider/common_config.rs:257-270 | src-tauri/src/services/provider/common_config.rs:360-378 — 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/session_manager/paged_manifest.rs:313 — src-tauri/src/session_manager/paged_manifest.rs:313-326 | src-tauri/src/session_manager/transcript.rs:2703-2716 — 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/cli/tui/app/types.rs:3900 — src-tauri/src/cli/tui/app/types.rs:3900-3913 | src-tauri/src/cli/tui/app/types.rs:3915-3928 — 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/cli/tui/app/helpers.rs:1618 — src-tauri/src/cli/tui/app/helpers.rs:1618-1631 | src-tauri/src/cli/tui/app/helpers.rs:1655-1674 — 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/codex_config.rs:104 — src-tauri/src/codex_config.rs:104-117 | src-tauri/src/config.rs:10-24 — 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:499 — src-tauri/src/hermes_config.rs:499-512 | src-tauri/src/hermes_config.rs:516-529 — 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/cli/tui/app/helpers.rs:165 — src-tauri/src/cli/tui/app/helpers.rs:165-178 | src-tauri/src/cli/tui/app/helpers.rs:411-424 — 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/openclaw_config.rs:840 — src-tauri/src/openclaw_config.rs:840-856 | src-tauri/src/opencode_config.rs:205-218 — 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/cli/tui/app/types.rs:2513 — src-tauri/src/cli/tui/app/types.rs:2513-2527 | src-tauri/src/cli/tui/app/types.rs:2533-2546 — 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/mcp.rs:986 — src-tauri/src/mcp.rs:986-999 | src-tauri/src/mcp.rs:1379-1393 — 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/session_manager/providers/gemini.rs:26 — src-tauri/src/session_manager/providers/gemini.rs:26-39 | src-tauri/src/session_manager/providers/openclaw.rs:53-67 — 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 copy of a member (7 corresponding lines) · ×11
  • Edited copy of a member (7 corresponding lines) REDACTED:242 — REDACTED:242-251 | REDACTED:426-432 — 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/cli/commands/completions.rs:396 — src-tauri/src/cli/commands/completions.rs:396-402 | src-tauri/src/hermes_config.rs:987-994 — 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/gemini.rs:108 — src-tauri/src/session_manager/providers/gemini.rs:108-116 | REDACTED:192-198 — 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:601 — src-tauri/src/session_manager/providers/hermes.rs:601-610 | REDACTED:441-447 — 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/services/provider/codex_live.rs:9 — src-tauri/src/services/provider/codex_live.rs:9-16 | src-tauri/src/services/skill.rs:1761-1767 — 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/cli/commands/config_openclaw.rs:839 — src-tauri/src/cli/commands/config_openclaw.rs:839-845 | src-tauri/src/cli/commands/config_openclaw.rs:847-853 — 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/cli/tui/app/helpers.rs:607 — src-tauri/src/cli/tui/app/helpers.rs:607-613 | src-tauri/src/cli/tui/ui/config.rs:2711-2720 — 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/cli/tui/app/types.rs:4859 — src-tauri/src/cli/tui/app/types.rs:4859-4865 | src-tauri/src/session_manager/recent_snapshot.rs:95-101 — 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/cli/tui/runtime_systems/handlers.rs:191 — src-tauri/src/cli/tui/runtime_systems/handlers.rs:191-198 | src-tauri/src/session_manager/query_manifest.rs:26-32 — 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/cli/tui/form/provider_state.rs:1867 — src-tauri/src/cli/tui/form/provider_state.rs:1867-1874 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1092-1098 — 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:233 — src-tauri/src/live/patch/json.rs:233-239 | 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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×10
  • Duplicated block (16 lines × 2) src-tauri/src/cli/tui/form/provider_json.rs:1378 — src-tauri/src/cli/tui/form/provider_json.rs:1378-1393 | src-tauri/src/services/provider/common.rs:159-174 — 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.
  • Duplicated block (16 lines × 2) src-tauri/src/cli/tui/ui/config.rs:403 — src-tauri/src/cli/tui/ui/config.rs:403-418 | src-tauri/src/cli/tui/ui/config.rs:431-446 — 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/cli/tui/ui/config.rs:403` 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/cli/tui/ui/overlay/pickers.rs:2007 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:2007-2022 | src-tauri/src/cli/tui/ui/shared.rs:422-437 — 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/cli/tui/ui/overlay/pickers.rs:2007` 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/database/dao/proxy.rs:80 — src-tauri/src/database/dao/proxy.rs:80-95 | src-tauri/src/database/dao/proxy.rs:111-126 — 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) src-tauri/src/mcp.rs:400 — src-tauri/src/mcp.rs:400-415 | src-tauri/src/mcp.rs:791-806 — 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.rs:400` 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/copilot_auth.rs:916 — src-tauri/src/proxy/providers/copilot_auth.rs:916-931 | src-tauri/src/proxy/providers/copilot_auth.rs:1030-1045 — 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:916` 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/services/s3.rs:282 — src-tauri/src/services/s3.rs:282-297 | src-tauri/src/services/s3.rs:398-413 — 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) src-tauri/src/services/usage_stats.rs:529 — src-tauri/src/services/usage_stats.rs:529-544 | src-tauri/src/services/usage_stats.rs:935-950 — 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) src-tauri/src/cli/commands/config.rs:184 — src-tauri/src/cli/commands/config.rs:184-201 | src-tauri/src/cli/commands/config.rs:310-325 — 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) src-tauri/src/cli/commands/env.rs:151 — src-tauri/src/cli/commands/env.rs:151-166 | src-tauri/src/cli/commands/env.rs:174-189 — 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/cli/commands/env.rs:151` 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.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×9
  • Edited copy of a member (23 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:399 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:399-421 | src-tauri/src/proxy/providers/copilot_auth.rs:437-459 — 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:252-276 — 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:168 — src-tauri/src/services/provider/pi.rs:168-191 | src-tauri/src/services/provider/pi.rs:193-215 — 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/cli/tui/app/types.rs:1941 — src-tauri/src/cli/tui/app/types.rs:1941-1963 | src-tauri/src/cli/tui/app/types.rs:2276-2298 — 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/s3_sync.rs:218 — src-tauri/src/services/s3_sync.rs:218-240 | REDACTED:310-334 — 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/cli/tui/app/overlay_handlers/pickers.rs:20 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:20-42 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:44-66 — 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/cli/tui/app/helpers.rs:141 — src-tauri/src/cli/tui/app/helpers.rs:141-163 | src-tauri/src/cli/tui/app/helpers.rs:387-409 — 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/managed_auth.rs:113 — src-tauri/src/codex_config/managed_auth.rs:113-136 | src-tauri/src/codex_config/managed_auth.rs:141-163 — 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/session_manager/providers/hermes.rs:811 — src-tauri/src/session_manager/providers/hermes.rs:811-833 | REDACTED:1193-1215 — 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 (21 corresponding lines) · ×9
  • Edited copy of a member (21 corresponding lines) src-tauri/src/openclaw_config.rs:818 — src-tauri/src/openclaw_config.rs:818-838 | src-tauri/src/openclaw_config.rs:897-917 — 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/cli/commands/provider.rs:340 — src-tauri/src/cli/commands/provider.rs:340-360 | src-tauri/src/cli/commands/provider_input.rs:4041-4066 — 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/pi_config/mod.rs:320 — src-tauri/src/pi_config/mod.rs:320-340 | src-tauri/src/services/pi_prompt_files.rs:299-319 — 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/cli/tui/app/form_handlers/provider.rs:1857 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:1857-1877 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1884-1905 — 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/deeplink/provider.rs:763 — src-tauri/src/deeplink/provider.rs:763-790 | src-tauri/src/services/provider/mod.rs:3605-3625 — 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:1038 — src-tauri/src/database/dao/proxy.rs:1038-1058 | src-tauri/src/database/dao/proxy.rs:1111-1133 — 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/key_field_live.rs:131 — src-tauri/src/services/provider/key_field_live.rs:131-151 | src-tauri/src/services/provider/key_field_live.rs:161-186 — 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/cli/tui/runtime_actions/editor.rs:374 — src-tauri/src/cli/tui/runtime_actions/editor.rs:374-395 | src-tauri/src/cli/tui/runtime_actions/prompts.rs:181-201 — 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/cli/tui/form/provider_json.rs:91 — src-tauri/src/cli/tui/form/provider_json.rs:91-117 | src-tauri/src/services/provider/common_config.rs:235-255 — 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 (17 corresponding lines) · ×9
  • Edited copy of a member (17 corresponding lines) src-tauri/src/services/provider/endpoints.rs:86 — src-tauri/src/services/provider/endpoints.rs:86-102 | src-tauri/src/services/provider/endpoints.rs:110-128 — 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/copilot_optimizer.rs:275 — src-tauri/src/proxy/copilot_optimizer.rs:275-295 | src-tauri/src/proxy/copilot_optimizer.rs:304-320 — 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/cli/tui/form/s3.rs:263 — src-tauri/src/cli/tui/form/s3.rs:263-281 | src-tauri/src/cli/tui/form/webdav.rs:173-189 — 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/database/mod.rs:132 — src-tauri/src/database/mod.rs:132-148 | src-tauri/src/database/mod.rs:151-167 — 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/provider/common_config.rs:283 — src-tauri/src/services/provider/common_config.rs:283-299 | src-tauri/src/services/provider/live_merge.rs:51-70 — 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:26 — src-tauri/src/proxy/providers/auth.rs:26-42 | src-tauri/src/proxy/providers/auth.rs:45-62 — 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/auth.rs:121 — src-tauri/src/services/auth.rs:121-137 | src-tauri/src/services/auth.rs:139-161 — 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/codex_config.rs:1481 — src-tauri/src/codex_config.rs:1481-1498 | src-tauri/src/codex_config.rs:1504-1520 — 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/cli/codex_temp_launch.rs:40 — src-tauri/src/cli/codex_temp_launch.rs:40-56 | src-tauri/src/cli/codex_temp_launch.rs:65-81 — 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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×9
  • Duplicated block (5 lines × 3) src-tauri/src/cli/claude_temp_launch.rs:273 — src-tauri/src/cli/claude_temp_launch.rs:273-277 | src-tauri/src/cli/codex_temp_launch.rs:314-318 | src-tauri/src/cli/commands/update.rs:1304-1308 — before extracting anything, compare `src-tauri/src/cli/claude_temp_launch.rs` and `src-tauri/src/cli/codex_temp_launch.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 41 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/cli/claude_temp_launch.rs:273` 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/cli/commands/provider.rs:1578 — src-tauri/src/cli/commands/provider.rs:1578-1582 | src-tauri/src/cli/commands/provider.rs:1714-1718 | src-tauri/src/cli/commands/provider.rs:1992-1996 — 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 (5 lines × 3) src-tauri/src/cli/tui/ui/forms/provider.rs:897 — src-tauri/src/cli/tui/ui/forms/provider.rs:897-902 | src-tauri/src/cli/tui/ui/forms/provider.rs:980-984 | src-tauri/src/cli/tui/ui/forms/provider.rs:1133-1138 — 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/cli/tui/ui/forms/provider.rs:897` 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 × 3) src-tauri/src/deeplink/provider.rs:518 — src-tauri/src/deeplink/provider.rs:518-522 | src-tauri/src/deeplink/provider.rs:619-624 | src-tauri/src/deeplink/provider.rs:666-673 — 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:518` 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 (5 lines × 3) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:531 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:531-535 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:567-572 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:589-594 — 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/session_manager/cache.rs:318 — src-tauri/src/session_manager/cache.rs:318-322 | src-tauri/src/session_manager/providers/gemini.rs:49-53 | src-tauri/src/session_manager/providers/openclaw.rs:77-81 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 70 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/cache.rs:318` 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/cli/commands/provider.rs:507 — src-tauri/src/cli/commands/provider.rs:507-511 | src-tauri/src/cli/commands/provider.rs:1168-1172 | src-tauri/src/cli/tui/data.rs:3534-3538 — 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.
  • Duplicated block (5 lines × 3) src-tauri/src/cli/commands/provider_input.rs:4111 — src-tauri/src/cli/commands/provider_input.rs:4111-4115 | src-tauri/src/cli/commands/provider_input.rs:4398-4402 | src-tauri/src/cli/commands/provider_input.rs:4417-4421 — 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/cli/commands/provider_input.rs:4111` 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 × 3) src-tauri/src/cli/commands/start.rs:409 — src-tauri/src/cli/commands/start.rs:409-413 | src-tauri/src/cli/tui/runtime_actions/claude_temp_launch.rs:93-97 | src-tauri/src/cli/tui/runtime_actions/codex_temp_launch.rs:94-98 — 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/cli/commands/start.rs:409` 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.
D2 · Cognitive Complexity · ProviderAddFormState · ×8
  • ProviderAddFormState::to_provider_json_value (cognitive 220) src-tauri/src/cli/tui/form/provider_json.rs:281 — ProviderAddFormState::to_provider_json_value has cognitive complexity 220 (threshold 15). Drivers by points: if/else 77 (188 pts), match/switch 8 (20 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 125). 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.
  • ProviderAddFormState::update_provider_meta (cognitive 99) src-tauri/src/cli/tui/form/provider_json.rs:844 — ProviderAddFormState::update_provider_meta has cognitive complexity 99 (threshold 15). Drivers by points: if/else 48 (82 pts), boolean chains 12, match/switch 2 (5 pts) (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.
  • ProviderAddFormState::apply_sponsor_preset (cognitive 34) src-tauri/src/cli/tui/form/provider_templates.rs:739 — ProviderAddFormState::apply_sponsor_preset has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (25 pts), match/switch 5 (8 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.
  • ProviderAddFormState::fields (cognitive 25) src-tauri/src/cli/tui/form/provider_state.rs:480 — ProviderAddFormState::fields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 2, 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.
  • ProviderAddFormState::apply_template_fields (cognitive 25) src-tauri/src/cli/tui/form/provider_templates.rs:501 — ProviderAddFormState::apply_template_fields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 3, 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.
  • ProviderAddFormState::normalized_codex_model_catalog_for_save (cognitive 21) src-tauri/src/cli/tui/form/provider_json.rs:1215 — ProviderAddFormState::normalized_codex_model_catalog_for_save has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 1, loops 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.
  • ProviderAddFormState::apply_provider_json_value_to_fields (cognitive 19) src-tauri/src/cli/tui/form/provider_state.rs:2788 — ProviderAddFormState::apply_provider_json_value_to_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). 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.
  • ProviderAddFormState::toggle_include_common_config (cognitive 16) src-tauri/src/cli/tui/form/provider_state.rs:2905 — ProviderAddFormState::toggle_include_common_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×8
  • Edited copy of a member (15 corresponding lines) src-tauri/src/cli/tui/ui/shared.rs:971 — src-tauri/src/cli/tui/ui/shared.rs:971-994 | src-tauri/src/cli/tui/ui/shared.rs:1039-1058 — 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:413 — src-tauri/src/pi_config/mod.rs:413-429 | src-tauri/src/services/pi_prompt_files.rs:278-292 — 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/cli/commands/failover.rs:236 — src-tauri/src/cli/commands/failover.rs:236-250 | src-tauri/src/cli/commands/failover.rs:252-270 — 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/provider/mod.rs:2083 — src-tauri/src/services/provider/mod.rs:2083-2099 | src-tauri/src/services/provider/mod.rs:2101-2115 — 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/cli/tui/runtime_actions/editor.rs:790 — src-tauri/src/cli/tui/runtime_actions/editor.rs:790-804 | src-tauri/src/cli/tui/runtime_actions/editor.rs:809-823 — 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:141 — src-tauri/src/session_manager/terminal/mod.rs:141-156 | src-tauri/src/session_manager/terminal/mod.rs:158-172 — 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/cli/commands/sessions.rs:882 — src-tauri/src/cli/commands/sessions.rs:882-896 | src-tauri/src/cli/tui/ui/sessions.rs:717-731 — 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/cli/commands/auth.rs:255 — src-tauri/src/cli/commands/auth.rs:255-270 | src-tauri/src/cli/commands/auth.rs:272-286 — 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 (25 corresponding lines) · ×8
  • Edited copy of a member (25 corresponding lines) src-tauri/src/proxy/providers/transform_responses.rs:12 — src-tauri/src/proxy/providers/transform_responses.rs:12-36 | src-tauri/src/proxy/providers/transform_responses.rs:38-68 — 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/services/codex_oauth.rs:247 — src-tauri/src/services/codex_oauth.rs:247-277 | src-tauri/src/services/codex_oauth.rs:281-305 — 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/services/s3.rs:280 — src-tauri/src/services/s3.rs:280-304 | src-tauri/src/services/s3.rs:311-337 — 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/claude.rs:82 — src-tauri/src/proxy/providers/claude.rs:82-106 | src-tauri/src/proxy/providers/claude.rs:112-138 — 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/cli/tui/app/editor_state.rs:662 — src-tauri/src/cli/tui/app/editor_state.rs:662-686 | src-tauri/src/cli/tui/app/editor_state.rs:688-713 — 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/cli/commands/config_openclaw.rs:992 — src-tauri/src/cli/commands/config_openclaw.rs:992-1016 | src-tauri/src/cli/commands/config_openclaw.rs:1033-1057 — 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/database/dao/proxy.rs:239 — src-tauri/src/database/dao/proxy.rs:239-270 | src-tauri/src/database/dao/proxy.rs:298-322 — 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/services/session_usage.rs:1163 — src-tauri/src/services/session_usage.rs:1163-1187 | src-tauri/src/services/session_usage.rs:1197-1226 — 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 (22 corresponding lines) · ×8
  • Edited copy of a member (22 corresponding lines) src-tauri/src/cli/tui/ui/config.rs:401 — src-tauri/src/cli/tui/ui/config.rs:401-422 | src-tauri/src/cli/tui/ui/config.rs:429-455 — 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/daemon/mod.rs:36 — src-tauri/src/daemon/mod.rs:36-57 | src-tauri/src/daemon/mod.rs:62-83 — 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/codex_history_migration.rs:547 — src-tauri/src/codex_history_migration.rs:547-568 | src-tauri/src/codex_history_migration.rs:1454-1475 — 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/cli/commands/provider_input.rs:136 — src-tauri/src/cli/commands/provider_input.rs:136-157 | src-tauri/src/cli/tui/form/provider_state.rs:349-374 — 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_chat.rs:1737 — src-tauri/src/proxy/providers/transform_codex_chat.rs:1737-1758 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1764-1792 — 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/cli/commands/env.rs:145 — src-tauri/src/cli/commands/env.rs:145-166 | src-tauri/src/cli/commands/env.rs:168-189 — 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:32 — src-tauri/src/session_manager/terminal/mod.rs:32-53 | src-tauri/src/session_manager/terminal/mod.rs:55-80 — 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/services/proxy.rs:348 — src-tauri/src/services/proxy.rs:348-369 | src-tauri/src/services/proxy.rs:2975-2998 — 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 (19 corresponding lines) · ×8
  • Edited copy of a member (19 corresponding lines) src-tauri/src/services/webdav.rs:255 — src-tauri/src/services/webdav.rs:255-273 | src-tauri/src/services/webdav.rs:413-435 — 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.rs:241 — src-tauri/src/proxy/providers/transform.rs:241-265 | src-tauri/src/proxy/providers/transform_responses.rs:391-409 — 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:313 — src-tauri/src/hermes_config.rs:313-331 | src-tauri/src/openclaw_config.rs:328-346 — 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/config.rs:537 — src-tauri/src/config.rs:537-558 | src-tauri/src/config.rs:560-578 — 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/cli/commands/provider_input.rs:2723 — src-tauri/src/cli/commands/provider_input.rs:2723-2742 | src-tauri/src/cli/commands/provider_input.rs:2749-2767 — 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/cli/tui/ui/config.rs:37 — src-tauri/src/cli/tui/ui/config.rs:37-55 | src-tauri/src/cli/tui/ui/config.rs:84-102 — 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/commands/workspace.rs:59 — src-tauri/src/commands/workspace.rs:59-77 | src-tauri/src/commands/workspace.rs:147-168 — 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:1051 — src-tauri/src/proxy/providers/transform_codex_chat.rs:1051-1069 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1074-1093 — 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 (11 corresponding lines) · ×8
  • Edited copy of a member (11 corresponding lines) src-tauri/src/proxy/copilot_optimizer.rs:486 — src-tauri/src/proxy/copilot_optimizer.rs:486-496 | src-tauri/src/proxy/copilot_optimizer.rs:592-608 — 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:492 — src-tauri/src/live/project/codex.rs:492-502 | src-tauri/src/live/project/codex.rs:505-518 — 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/cli/commands/provider_input.rs:4204 — src-tauri/src/cli/commands/provider_input.rs:4204-4214 | src-tauri/src/cli/tui/form/provider_json.rs:1442-1452 — 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/cli/claude_temp_launch.rs:135 — src-tauri/src/cli/claude_temp_launch.rs:135-145 | src-tauri/src/cli/codex_temp_launch.rs:112-124 — 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/app_config.rs:94 — src-tauri/src/app_config.rs:94-104 | src-tauri/src/settings.rs:124-134 — 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/cli/tui/ui/config.rs:1320 — src-tauri/src/cli/tui/ui/config.rs:1320-1330 | src-tauri/src/cli/tui/ui/config.rs:1332-1344 — 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/app_config.rs:344 — src-tauri/src/app_config.rs:344-355 | src-tauri/src/services/skill.rs:635-645 — 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/cli/tui/app/form_handlers/provider.rs:2114 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:2114-2126 | src-tauri/src/cli/tui/ui/forms/provider.rs:2281-2291 — 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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×8
  • Duplicated block (19 lines × 2) src-tauri/src/cli/commands/provider_input.rs:2700 — src-tauri/src/cli/commands/provider_input.rs:2700-2718 | src-tauri/src/cli/tui/form/provider_json.rs:430-448 — before extracting anything, compare `src-tauri/src/cli/commands/provider_input.rs` and `src-tauri/src/cli/tui/form/provider_json.rs` as WHOLE FILES: this scan already matched 6 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. 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/cli/commands/provider_input.rs:2700` 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 × 2) src-tauri/src/cli/tui/app/types.rs:1945 — src-tauri/src/cli/tui/app/types.rs:1945-1963 | src-tauri/src/cli/tui/app/types.rs:2280-2298 — 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/cli/tui/app/types.rs:1945` 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 (19 lines × 2) src-tauri/src/cli/tui/app/types.rs:3178 — src-tauri/src/cli/tui/app/types.rs:3178-3196 | src-tauri/src/cli/tui/app/types.rs:3294-3312 — 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 (19 lines × 2) src-tauri/src/cli/tui/form/provider_state.rs:2684 — src-tauri/src/cli/tui/form/provider_state.rs:2684-2702 | src-tauri/src/cli/tui/form/provider_state.rs:2792-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.
  • Duplicated block (19 lines × 2) src-tauri/src/proxy/providers/claude.rs:399 — src-tauri/src/proxy/providers/claude.rs:399-417 | src-tauri/src/proxy/providers/gemini.rs:53-71 — 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/claude.rs:399` 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 (19 lines × 2) src-tauri/src/session_manager/cache.rs:202 — src-tauri/src/session_manager/cache.rs:202-220 | src-tauri/src/session_manager/cache.rs:321-339 — 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/cache.rs:202` 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 (19 lines × 2) src-tauri/src/usage_script.rs:74 — src-tauri/src/usage_script.rs:74-92 | src-tauri/src/usage_script.rs:154-172 — 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:74` 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 (19 lines × 2) src-tauri/src/services/codex_oauth.rs:41 — src-tauri/src/services/codex_oauth.rs:41-59 | src-tauri/src/services/copilot_auth.rs:40-58 — 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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×8
  • Duplicated block (10 lines × 3) src-tauri/src/cli/tui/app/helpers.rs:1444 — src-tauri/src/cli/tui/app/helpers.rs:1444-1453 | src-tauri/src/cli/tui/ui/sessions.rs:734-743 | src-tauri/src/session_manager/query_manifest.rs:195-204 — before extracting anything, compare `src-tauri/src/cli/tui/app/helpers.rs` and `src-tauri/src/session_manager/query_manifest.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. 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 (10 lines × 3) src-tauri/src/cli/tui/ui/config.rs:870 — src-tauri/src/cli/tui/ui/config.rs:870-879 | src-tauri/src/cli/tui/ui/config.rs:1368-1377 | src-tauri/src/cli/tui/ui/config.rs:2262-2271 — 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/cli/tui/ui/config.rs:870` 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 `rows` to `&[OpenClawEnvStyledRow]` in one and `&[OpenClawAgentsStyledRow]` 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 (10 lines × 3) src-tauri/src/deeplink/provider.rs:405 — src-tauri/src/deeplink/provider.rs:405-414 | src-tauri/src/deeplink/provider.rs:433-442 | src-tauri/src/deeplink/provider.rs:729-738 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `request` to `&DeepLinkImportRequest` in one and `&mut DeepLinkImportRequest` 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/deeplink/provider.rs:431` calls `insert`, `to_string` and `src-tauri/src/deeplink/provider.rs:404` 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 lines × 3) src-tauri/src/proxy/handlers.rs:274 — src-tauri/src/proxy/handlers.rs:274-283 | src-tauri/src/proxy/handlers.rs:391-400 | src-tauri/src/proxy/handlers.rs:820-829 — 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:274` 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/proxy/providers/codex.rs:364 — src-tauri/src/proxy/providers/codex.rs:364-373 | src-tauri/src/proxy/providers/codex.rs:376-385 | src-tauri/src/proxy/providers/codex.rs:412-421 — 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:364` 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/response.rs:324 — src-tauri/src/proxy/response.rs:324-333 | src-tauri/src/proxy/response.rs:371-380 | src-tauri/src/proxy/response.rs:401-410 — 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/response.rs:324` 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 × 3) src-tauri/src/proxy/providers/streaming_responses.rs:356 — src-tauri/src/proxy/providers/streaming_responses.rs:356-365 | src-tauri/src/proxy/providers/streaming_responses.rs:562-571 | src-tauri/src/proxy/providers/streaming_responses.rs:707-716 — 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/streaming_responses.rs:353` calls `Some`, `get`, `and_then` and `src-tauri/src/proxy/providers/streaming_responses.rs:706` 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 lines × 3) src-tauri/src/services/s3.rs:283 — src-tauri/src/services/s3.rs:283-292 | src-tauri/src/services/s3.rs:346-355 | src-tauri/src/services/s3.rs:399-408 — 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.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×7
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src-tauri/src/cli/tui/ui/overlay/basic.rs:243 — src-tauri/src/cli/tui/ui/overlay/basic.rs:243-271 | src-tauri/src/cli/tui/ui/overlay/basic.rs:305-335 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2538-2582 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2589-2628 — 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/codex_config.rs:366 — src-tauri/src/codex_config.rs:366-391 | src-tauri/src/codex_config.rs:393-411 | src-tauri/src/codex_config.rs:3542-3573 | src-tauri/src/codex_config.rs:3616-3643 — 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/codex_history_migration.rs:900 — src-tauri/src/codex_history_migration.rs:900-959 | src-tauri/src/codex_history_migration.rs:972-1034 | src-tauri/src/codex_history_migration.rs:1042-1114 | src-tauri/src/codex_history_migration.rs:1122-1177 — 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/deeplink/provider.rs:508 — src-tauri/src/deeplink/provider.rs:508-563 | src-tauri/src/deeplink/provider.rs:610-651 | src-tauri/src/deeplink/provider.rs:656-694 | src-tauri/src/deeplink/provider.rs:699-746 — 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.rs:348 — src-tauri/src/mcp.rs:348-415 | src-tauri/src/mcp.rs:743-806 | src-tauri/src/mcp.rs:907-975 | src-tauri/src/mcp.rs:1630-1719 — 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.rs:809 — src-tauri/src/mcp.rs:809-856 | src-tauri/src/mcp.rs:859-904 | src-tauri/src/mcp.rs:1461-1507 | src-tauri/src/mcp.rs:1511-1552 — 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/session_manager/providers/claude.rs:57 — src-tauri/src/session_manager/providers/claude.rs:57-69 | src-tauri/src/session_manager/providers/codex.rs:683-695 | src-tauri/src/session_manager/providers/hermes.rs:757-769 | src-tauri/src/session_manager/providers/openclaw.rs:354-366 — 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) · ×7
  • Edited copy of a member (24 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1960 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1960-1983 | src-tauri/src/proxy/providers/copilot_auth.rs:1389-1421 — 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/cli/tui/ui/chrome.rs:636 — src-tauri/src/cli/tui/ui/chrome.rs:636-659 | src-tauri/src/cli/tui/ui/overlay/layout.rs:25-52 — 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/openclaw_config.rs:725 — src-tauri/src/openclaw_config.rs:725-748 | src-tauri/src/openclaw_config.rs:750-782 — 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/response.rs:370 — src-tauri/src/proxy/response.rs:370-393 | src-tauri/src/proxy/response.rs:400-424 — 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/cli/tui/app/types.rs:4099 — src-tauri/src/cli/tui/app/types.rs:4099-4122 | src-tauri/src/cli/tui/app/types.rs:4134-4161 — 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:1985 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1985-2009 | src-tauri/src/proxy/providers/copilot_auth.rs:1484-1507 — 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/database/dao/proxy.rs:605 — src-tauri/src/database/dao/proxy.rs:605-632 | src-tauri/src/database/dao/proxy.rs:979-1002 — 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.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×7
  • Edited copy of a member (18 corresponding lines) src-tauri/src/cli/tui/app/types.rs:1816 — src-tauri/src/cli/tui/app/types.rs:1816-1833 | src-tauri/src/cli/tui/app/types.rs:2176-2196 — 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/cli/tui/ui/providers.rs:128 — src-tauri/src/cli/tui/ui/providers.rs:128-145 | src-tauri/src/cli/tui/ui/shared.rs:535-557 — 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/streaming_codex_anthropic.rs:508 — src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:508-525 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:1001-1021 — 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:1403 — src-tauri/src/proxy/providers/transform_codex_chat.rs:1403-1422 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1424-1441 — 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/session_manager/providers/hermes.rs:392 — src-tauri/src/session_manager/providers/hermes.rs:392-409 | REDACTED:571-588 — 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/services/session_usage_codex.rs:930 — src-tauri/src/services/session_usage_codex.rs:930-947 | src-tauri/src/services/session_usage_codex.rs:1020-1041 — 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/cli/commands/deeplink.rs:39 — src-tauri/src/cli/commands/deeplink.rs:39-56 | src-tauri/src/cli/commands/deeplink.rs:81-98 — 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.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×7
  • Edited copy of a member (20 corresponding lines) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1137 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1137-1156 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:1158-1177 — 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/cli/tui/app/editor_state.rs:619 — src-tauri/src/cli/tui/app/editor_state.rs:619-638 | src-tauri/src/cli/tui/app/editor_state.rs:640-660 — 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/cli/tui/runtime_systems/workers.rs:2748 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2748-2767 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3252-3274 — 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/usage_stats.rs:1831 — src-tauri/src/services/usage_stats.rs:1831-1850 | src-tauri/src/services/usage_stats.rs:1855-1877 — 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/cli/tui/form/provider_state.rs:3237 — src-tauri/src/cli/tui/form/provider_state.rs:3237-3256 | src-tauri/src/services/coding_plan.rs:27-46 — 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/session_manager/providers/codex.rs:830 — src-tauri/src/session_manager/providers/codex.rs:830-849 | src-tauri/src/session_manager/providers/gemini.rs:398-421 — 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/cli/commands/config_s3.rs:146 — src-tauri/src/cli/commands/config_s3.rs:146-165 | src-tauri/src/cli/commands/config_webdav.rs:182-205 — 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 · Duplicated block (11–12 lines × 2) · ×7
  • Duplicated block (11–12 lines × 2) src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:813 — src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:813-823 | src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:827-838 — 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/cli/tui/app/overlay_handlers/dialogs.rs:827` 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 (11–12 lines × 2) src-tauri/src/cli/tui/mod.rs:1723 — src-tauri/src/cli/tui/mod.rs:1723-1734 | src-tauri/src/cli/tui/mod.rs:1806-1816 — 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/cli/tui/mod.rs:1723` 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/codex_history_migration.rs:917 — src-tauri/src/codex_history_migration.rs:917-927 | src-tauri/src/codex_history_migration.rs:1144-1155 — 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/codex_history_migration.rs:917` 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 (11–12 lines × 2) src-tauri/src/services/session_usage_codex.rs:1994 — src-tauri/src/services/session_usage_codex.rs:1994-2005 | src-tauri/src/services/session_usage_gemini.rs:354-364 — before extracting anything, compare `src-tauri/src/services/session_usage_codex.rs` and `src-tauri/src/services/session_usage_gemini.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/services/session_usage_codex.rs:1994` 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–12 lines × 2) src-tauri/src/session_manager/providers/codex.rs:870 — src-tauri/src/session_manager/providers/codex.rs:870-880 | src-tauri/src/session_manager/providers/openclaw.rs:525-536 — 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 10 separate duplicated blocks between them, totalling at least 125 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:870` 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–12 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:638 — src-tauri/src/session_manager/providers/hermes.rs:638-649 | src-tauri/src/session_manager/providers/hermes.rs:706-716 — 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–12 lines × 2) src-tauri/src/cli/commands/provider.rs:1829 — src-tauri/src/cli/commands/provider.rs:1829-1840 | src-tauri/src/cli/commands/provider.rs:2073-2083 — 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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×7
  • Duplicated block (11 lines × 3) src-tauri/src/cli/tui/runtime_actions/settings.rs:438 — src-tauri/src/cli/tui/runtime_actions/settings.rs:438-448 | src-tauri/src/cli/tui/runtime_actions/settings.rs:468-478 | src-tauri/src/cli/tui/runtime_actions/settings.rs:498-508 — 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 (11 lines × 3) src-tauri/src/cli/tui/ui/config.rs:946 — src-tauri/src/cli/tui/ui/config.rs:946-956 | src-tauri/src/cli/tui/ui/config.rs:1419-1429 | src-tauri/src/cli/tui/ui/config.rs:2314-2324 — 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/cli/tui/ui/config.rs:946` 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 × 3) src-tauri/src/cli/tui/ui/forms/mcp.rs:75 — src-tauri/src/cli/tui/ui/forms/mcp.rs:75-85 | src-tauri/src/cli/tui/ui/forms/provider.rs:500-510 | src-tauri/src/cli/tui/ui/forms/provider.rs:1543-1553 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 175 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/cli/tui/ui/forms/mcp.rs:75` 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 × 3) src-tauri/src/codex_history_migration.rs:1014 — src-tauri/src/codex_history_migration.rs:1014-1024 | src-tauri/src/codex_history_migration.rs:1094-1104 | src-tauri/src/codex_history_migration.rs:1157-1167 — 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 (11 lines × 3) src-tauri/src/proxy/error.rs:198 — src-tauri/src/proxy/error.rs:198-208 | src-tauri/src/proxy/response/error_summary.rs:31-41 | src-tauri/src/proxy/usage/parser.rs:269-279 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `body` to `&serde_json::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 (11 lines × 3) src-tauri/src/session_manager/providers/gemini.rs:67 — src-tauri/src/session_manager/providers/gemini.rs:67-77 | src-tauri/src/session_manager/providers/openclaw.rs:95-105 | src-tauri/src/session_manager/providers/pi.rs:374-384 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 70 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/gemini.rs:67` 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 × 3) src-tauri/src/cli/commands/mcp.rs:200 — src-tauri/src/cli/commands/mcp.rs:200-210 | src-tauri/src/cli/commands/prompts.rs:574-584 | src-tauri/src/cli/commands/provider.rs:1076-1086 — 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/cli/commands/mcp.rs:200` 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.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×7
  • Duplicated block (9 lines × 3) src-tauri/src/cli/tui/runtime_actions/editor.rs:687 — src-tauri/src/cli/tui/runtime_actions/editor.rs:687-695 | src-tauri/src/cli/tui/runtime_actions/editor.rs:757-765 | src-tauri/src/cli/tui/runtime_actions/editor.rs:850-858 — 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. 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 × 3) src-tauri/src/cli/tui/ui/overlay/mcp_key_value.rs:121 — src-tauri/src/cli/tui/ui/overlay/mcp_key_value.rs:121-129 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:255-263 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1143-1151 — 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/cli/tui/ui/overlay/mcp_key_value.rs:121` 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/services/session_usage.rs:1054 — src-tauri/src/services/session_usage.rs:1054-1062 | src-tauri/src/services/session_usage_codex.rs:1935-1943 | src-tauri/src/services/session_usage_gemini.rs:264-272 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_codex.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 84 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/session_usage.rs:1054` 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 × 3) src-tauri/src/session_manager/providers/claude.rs:239 — src-tauri/src/session_manager/providers/claude.rs:239-248 | src-tauri/src/session_manager/providers/codex.rs:870-878 | src-tauri/src/session_manager/providers/openclaw.rs:525-534 — 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 10 separate duplicated blocks between them, totalling at least 152 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: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. 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/codex.rs:752 — src-tauri/src/session_manager/providers/codex.rs:752-760 | src-tauri/src/session_manager/providers/hermes.rs:840-848 | src-tauri/src/session_manager/providers/openclaw.rs:402-410 — before extracting anything, compare `src-tauri/src/session_manager/providers/codex.rs` and `src-tauri/src/session_manager/providers/hermes.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 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:752` 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/session_manager/providers/hermes.rs:849` calls `trim`, `is_empty`, `Continue` and `src-tauri/src/session_manager/providers/codex.rs:761` 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/session_manager/providers/claude.rs:250 — src-tauri/src/session_manager/providers/claude.rs:250-258 | src-tauri/src/session_manager/providers/codex.rs:889-897 | src-tauri/src/session_manager/providers/openclaw.rs:544-552 — 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 10 separate duplicated blocks between them, totalling at least 152 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:250` 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 × 3) src-tauri/src/openclaw_config.rs:830 — src-tauri/src/openclaw_config.rs:830-838 | src-tauri/src/openclaw_config.rs:909-917 | src-tauri/src/openclaw_config.rs:946-954 — 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/openclaw_config.rs:830` 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.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×7
  • Duplicated block (6 lines × 3) src-tauri/src/cli/commands/provider.rs:351 — src-tauri/src/cli/commands/provider.rs:351-356 | src-tauri/src/cli/commands/provider.rs:604-609 | src-tauri/src/cli/commands/provider_input.rs:4055-4060 — 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/cli/commands/provider.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.
  • Duplicated block (6 lines × 3) src-tauri/src/cli/commands/provider_input.rs:4106 — src-tauri/src/cli/commands/provider_input.rs:4106-4111 | src-tauri/src/cli/commands/provider_input.rs:4412-4417 | src-tauri/src/cli/commands/provider_input.rs:4431-4436 — 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/cli/commands/provider_input.rs:4106` 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 × 3) src-tauri/src/proxy/providers/transform.rs:291 — src-tauri/src/proxy/providers/transform.rs:291-296 | src-tauri/src/proxy/providers/transform_gemini.rs:573-582 | src-tauri/src/proxy/providers/transform_responses.rs:540-546 — 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 5 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. 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:291` 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 × 3) src-tauri/src/services/session_usage.rs:687 — src-tauri/src/services/session_usage.rs:687-692 | src-tauri/src/services/session_usage_codex.rs:1514-1519 | src-tauri/src/services/session_usage_gemini.rs:140-145 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_codex.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 84 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 × 3) src-tauri/src/app_config.rs:745 — src-tauri/src/app_config.rs:745-751 | src-tauri/src/proxy/providers/gemini.rs:97-102 | src-tauri/src/proxy/usage/parser.rs:298-303 — 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/app_config.rs:745` 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 × 3) src-tauri/src/config.rs:654 — src-tauri/src/config.rs:654-659 | src-tauri/src/database/mod.rs:134-139 | src-tauri/src/database/mod.rs:153-158 — before extracting anything, compare `src-tauri/src/config.rs` and `src-tauri/src/database/mod.rs` as WHOLE FILES: this scan already matched 3 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. 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. 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:530 — src-tauri/src/deeplink/provider.rs:530-535 | src-tauri/src/deeplink/provider.rs:597-602 | src-tauri/src/deeplink/provider.rs:643-648 — 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:530` 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.
D35 · Change Coupling · Change coupling · ×6
  • Change coupling: basic.rs ↔ REDACTED src-tauri/src/cli/tui/ui/overlay/basic.rs:1 — `src-tauri/src/cli/tui/ui/overlay/basic.rs` and `src-tauri/src/cli/tui/ui/tests.rs` change together 79% of the time (11 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 — 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 `1902fca8` fix(tui): deduplicate action hints; `03094473` feat(codex): align unified session history; `241c387a` fix(tui): word-wrap dialog messages and size overlays to content — run `git show` on any of them.
  • Change coupling: pickers.rs ↔ REDACTED src-tauri/src/cli/tui/ui/overlay/pickers.rs:1 — `src-tauri/src/cli/tui/ui/overlay/pickers.rs` and `src-tauri/src/cli/tui/ui/tests.rs` change together 69% of the time (11 of the 16 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 `addeb1b5` fix(codex-oauth): isolate shared workspace accounts (#509); `8a5614db` feat(tui): configure per-model Codex reasoning levels (#442); `3c9a916f` feat(tui): expose Skills sync method setting (#430) — run `git show` on any of them.
  • Change coupling: handlers.rs ↔ workers.rs src-tauri/src/cli/tui/runtime_systems/handlers.rs:1 — `src-tauri/src/cli/tui/runtime_systems/handlers.rs` and `src-tauri/src/cli/tui/runtime_systems/workers.rs` change together 60% of the time (9 of the 15 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 `e6842167` fix(tui): refresh sessions on entry; `97b67bbd` perf(tui): move managed proxy refresh off UI thread; `03094473` feat(codex): align unified session history — run `git show` on any of them.
  • Change coupling: dialogs.rs ↔ basic.rs src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs:1 — `src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs` and `src-tauri/src/cli/tui/ui/overlay/basic.rs` change together 57% of the time (8 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 — 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 8 shared commits counted here, the most recent 3 are `03094473` feat(codex): align unified session history; `edbe0403` refactor: remove switch-path live-conflict surfacing; `8c208420` feat(tui): add Codex OAuth account manager (#243) — run `git show` on any of them.
  • Change coupling: REDACTED ↔ help.rs src-tauri/src/cli/tui/form/tests.rs:1 — `src-tauri/src/cli/tui/form/tests.rs` and `src-tauri/src/cli/tui/help.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 `8a038881` fix(codex): bind managed ChatGPT accounts to official providers (#550); `14d4b983` fix(codex): preserve provider authentication in forms; `db41f841` fix(tui): align managed OAuth quota controls with upstream — run `git show` on any of them.
  • Change coupling: REDACTED ↔ REDACTED REDACTED:1 — `REDACTED` and `REDACTED` change together 50% of the time (6 of the 12 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 6 shared commits counted here, the most recent 3 are `3fc71671` fix(database): support upstream schemas 23–26 for sync restore (#549); `654fc0f0` fix(config): support symlinked home directory ancestors (#490); `7f66cc01` feat(database): sync upstream schema v17 and pricing — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×6
  • Edited copy of a member (41 corresponding lines) src-tauri/src/session_manager/transcript.rs:1718 — src-tauri/src/session_manager/transcript.rs:1718-1759 | src-tauri/src/session_manager/transcript.rs:1765-1805 — These two members are one piece of code written twice and then edited apart: 41 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 (41 corresponding lines) src-tauri/src/cli/tui/runtime_actions/editor.rs:514 — src-tauri/src/cli/tui/runtime_actions/editor.rs:514-554 | src-tauri/src/cli/tui/runtime_actions/editor.rs:559-599 — These two members are one piece of code written twice and then edited apart: 41 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 (41 corresponding lines) src-tauri/src/session_manager/paged_manifest.rs:2504 — src-tauri/src/session_manager/paged_manifest.rs:2504-2544 | src-tauri/src/session_manager/paged_manifest.rs:2563-2603 — These two members are one piece of code written twice and then edited apart: 41 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 (41 corresponding lines) src-tauri/src/session_manager/providers/hermes.rs:170 — src-tauri/src/session_manager/providers/hermes.rs:170-210 | REDACTED:200-240 — These two members are one piece of code written twice and then edited apart: 41 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 (41 corresponding lines) src-tauri/src/cli/commands/config_s3.rs:87 — src-tauri/src/cli/commands/config_s3.rs:87-133 | src-tauri/src/cli/commands/config_webdav.rs:129-169 — These two members are one piece of code written twice and then edited apart: 41 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 (41 corresponding lines) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:478 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:478-518 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:858-911 — These two members are one piece of code written twice and then edited apart: 41 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) · ×6
  • Edited copy of a member (31 corresponding lines) src-tauri/src/hermes_config.rs:333 — src-tauri/src/hermes_config.rs:333-363 | src-tauri/src/openclaw_config.rs:348-378 — 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.
  • Edited copy of a member (31 corresponding lines) src-tauri/src/cli/tui/app/editor_state.rs:187 — src-tauri/src/cli/tui/app/editor_state.rs:187-217 | src-tauri/src/cli/tui/ui/forms/shared.rs:337-379 — 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.
  • Edited copy of a member (31 corresponding lines) src-tauri/src/proxy/http_client.rs:82 — src-tauri/src/proxy/http_client.rs:82-112 | src-tauri/src/proxy/http_client.rs:115-145 — 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.
  • Edited copy of a member (31 corresponding lines) src-tauri/src/cli/commands/hermes.rs:214 — src-tauri/src/cli/commands/hermes.rs:214-244 | src-tauri/src/cli/tui/runtime_actions/config.rs:426-456 — 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.
  • Edited copy of a member (31 corresponding lines) src-tauri/src/cli/tui/app/form_handlers/provider.rs:247 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:247-282 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1377-1407 — 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.
  • Edited copy of a member (31 corresponding lines) src-tauri/src/cli/tui/runtime_systems/workers.rs:550 — src-tauri/src/cli/tui/runtime_systems/workers.rs:550-581 | src-tauri/src/cli/tui/runtime_systems/workers.rs:2416-2446 — 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) · ×6
  • Edited copy of a member (36 corresponding lines) src-tauri/src/session_manager/paged_manifest.rs:1274 — src-tauri/src/session_manager/paged_manifest.rs:1274-1309 | src-tauri/src/session_manager/paged_manifest.rs:1355-1394 — 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.
  • Edited copy of a member (36 corresponding lines) src-tauri/src/services/mcp.rs:139 — src-tauri/src/services/mcp.rs:139-175 | src-tauri/src/services/skill.rs:3044-3079 — 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.
  • Edited copy of a member (36 corresponding lines) src-tauri/src/cli/tui/ui/forms/s3.rs:9 — src-tauri/src/cli/tui/ui/forms/s3.rs:9-51 | src-tauri/src/cli/tui/ui/forms/webdav.rs:9-44 — 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.
  • Edited copy of a member (36 corresponding lines) src-tauri/src/cli/commands/env.rs:31 — src-tauri/src/cli/commands/env.rs:31-89 | src-tauri/src/cli/commands/env.rs:322-357 — 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.
  • Edited copy of a member (36 corresponding lines) src-tauri/src/cli/tui/form/provider_state.rs:1338 — src-tauri/src/cli/tui/form/provider_state.rs:1338-1386 | src-tauri/src/cli/tui/form/provider_state.rs:1392-1427 — 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.
  • Edited copy of a member (36 corresponding lines) src-tauri/src/proxy/usage/logger.rs:81 — src-tauri/src/proxy/usage/logger.rs:81-116 | src-tauri/src/proxy/usage/logger.rs:123-158 — 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 · Duplicated block (18 lines × 2) · ×6
  • Duplicated block (18 lines × 2) src-tauri/src/cli/commands/update.rs:821 — src-tauri/src/cli/commands/update.rs:821-838 | src-tauri/src/cli/commands/update.rs:855-872 — 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/cli/commands/update.rs:852` calls `host_str`, `ok_or_else`, `Message` and `src-tauri/src/cli/commands/update.rs:819` 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 (18 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs:687 — src-tauri/src/cli/tui/runtime_actions/editor.rs:687-704 | src-tauri/src/cli/tui/runtime_actions/editor.rs:850-867 — 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/cli/tui/runtime_actions/editor.rs:687` 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/cli/tui/ui/forms/mcp.rs:316 — src-tauri/src/cli/tui/ui/forms/mcp.rs:316-333 | src-tauri/src/cli/tui/ui/forms/s3.rs:91-108 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/s3.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 110 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/cli/tui/ui/forms/mcp.rs:316` 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 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:814 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:814-831 | src-tauri/src/proxy/providers/transform_responses.rs:161-178 — 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/response_handler.rs:282 — src-tauri/src/proxy/response_handler.rs:282-300 | src-tauri/src/proxy/response_handler.rs:308-325 — 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_handler.rs:282` 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 (18 lines × 2) src-tauri/src/session_manager/transcript.rs:972 — src-tauri/src/session_manager/transcript.rs:972-989 | src-tauri/src/session_manager/transcript.rs:1071-1088 — 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/transcript.rs:972` 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/session_manager/transcript.rs:1089` calls `directory_size_no_symlinks` and `src-tauri/src/session_manager/transcript.rs:990` 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.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×6
  • Duplicated block (9–10 lines × 2) src-tauri/src/cli/tui/mod.rs:2156 — src-tauri/src/cli/tui/mod.rs:2156-2164 | src-tauri/src/cli/tui/mod.rs:2959-2968 — 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 (9–10 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs:987 — src-tauri/src/cli/tui/ui/forms/provider.rs:987-995 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1021-1030 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/provider.rs` and `src-tauri/src/cli/tui/ui/overlay/pickers.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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/cli/tui/ui/forms/provider.rs:987` 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–10 lines × 2) src-tauri/src/cli/tui/ui/overlay/pickers.rs:1831 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:1831-1840 | src-tauri/src/cli/tui/ui/sessions.rs:773-781 — 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 (9–10 lines × 2) src-tauri/src/config.rs:585 — src-tauri/src/config.rs:585-593 | src-tauri/src/database/mod.rs:282-291 — before extracting anything, compare `src-tauri/src/config.rs` and `src-tauri/src/database/mod.rs` as WHOLE FILES: this scan already matched 3 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. 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/config.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 (9–10 lines × 2) src-tauri/src/services/skill.rs:1262 — src-tauri/src/services/skill.rs:1262-1271 | src-tauri/src/services/skill.rs:1426-1434 — 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–10 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:375 — src-tauri/src/session_manager/providers/hermes.rs:375-384 | REDACTED:398-406 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:375` 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.
D1 · Cyclomatic Complexity · ProviderAddFormState · ×5
  • ProviderAddFormState::to_provider_json_value (cyclomatic 82) src-tauri/src/cli/tui/form/provider_json.rs:281 — ProviderAddFormState::to_provider_json_value 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.
  • ProviderAddFormState::update_provider_meta (cyclomatic 52) src-tauri/src/cli/tui/form/provider_json.rs:844 — ProviderAddFormState::update_provider_meta has cyclomatic complexity 52 (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.
  • ProviderAddFormState::apply_sponsor_preset (cyclomatic 28) src-tauri/src/cli/tui/form/provider_templates.rs:739 — ProviderAddFormState::apply_sponsor_preset 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.
  • ProviderAddFormState::fields (cyclomatic 22) src-tauri/src/cli/tui/form/provider_state.rs:480 — ProviderAddFormState::fields 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. This is NOT this file's highest cyclomatic complexity: ProviderAddFormState::input (cyclomatic 26) 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.
  • ProviderAddFormState::apply_template_fields (cyclomatic 20) src-tauri/src/cli/tui/form/provider_templates.rs:501 — ProviderAddFormState::apply_template_fields 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.
D1 · Cyclomatic Complexity · RequestForwarder · ×5
  • RequestForwarder::prepare_request_with_client (cyclomatic 43) src-tauri/src/proxy/forwarder/request_builder.rs:126 — RequestForwarder::prepare_request_with_client 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.
  • RequestForwarder::send_buffered_request (cyclomatic 26) src-tauri/src/proxy/forwarder.rs:903 — RequestForwarder::send_buffered_request 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.
  • RequestForwarder::forward_response_detailed (cyclomatic 24) src-tauri/src/proxy/forwarder.rs:244 — RequestForwarder::forward_response_detailed 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. This shape REPEATS in the file: one other method here (RequestForwarder::forward_buffered_response_detailed) 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.
  • RequestForwarder::forward_buffered_response_detailed (cyclomatic 24) src-tauri/src/proxy/forwarder.rs:489 — RequestForwarder::forward_buffered_response_detailed 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. This shape REPEATS in the file: one other method here (RequestForwarder::forward_response_detailed) 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.
  • RequestForwarder::send_streaming_request (cyclomatic 24) src-tauri/src/proxy/forwarder.rs:706 — RequestForwarder::send_streaming_request 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.
D2 · Cognitive Complexity · RequestForwarder · ×5
  • RequestForwarder::send_streaming_request (cognitive 84) src-tauri/src/proxy/forwarder.rs:706 — RequestForwarder::send_streaming_request has cognitive complexity 84 (threshold 15). Drivers by points: if/else 20 (69 pts), match/switch 3 (9 pts), boolean chains 3, loops 2 (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.
  • RequestForwarder::send_buffered_request (cognitive 83) src-tauri/src/proxy/forwarder.rs:903 — RequestForwarder::send_buffered_request has cognitive complexity 83 (threshold 15). Drivers by points: if/else 20 (63 pts), match/switch 4 (13 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 53). 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::prepare_request_with_client (cognitive 64) src-tauri/src/proxy/forwarder/request_builder.rs:126 — RequestForwarder::prepare_request_with_client has cognitive complexity 64 (threshold 15). Drivers by points: if/else 33 (50 pts), boolean chains 11, match/switch 2 (3 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.
  • RequestForwarder::forward_response_detailed (cognitive 59) src-tauri/src/proxy/forwarder.rs:244 — RequestForwarder::forward_response_detailed has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (47 pts), match/switch 3 (8 pts), boolean chains 3, loops 1 (nesting depth added 34). 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 (RequestForwarder::forward_buffered_response_detailed) 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.
  • RequestForwarder::forward_buffered_response_detailed (cognitive 59) src-tauri/src/proxy/forwarder.rs:489 — RequestForwarder::forward_buffered_response_detailed has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (47 pts), match/switch 3 (8 pts), boolean chains 3, loops 1 (nesting depth added 34). 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 (RequestForwarder::forward_response_detailed) 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.
D2 · Cognitive Complexity · Database · ×5
  • Database::apply_schema_migrations_on_conn (cognitive 64) src-tauri/src/database/schema.rs:442 — 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::dump_sql (cognitive 54) REDACTED:1221 — Database::dump_sql has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (45 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 32). 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_daily_trends (cognitive 40) src-tauri/src/services/usage_stats.rs:758 — 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::init_impl_inner (cognitive 27) src-tauri/src/database/mod.rs:509 — Database::init_impl_inner has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (23 pts), match/switch 2 (3 pts), boolean chains 1 (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.
  • Database::migrate_v5_to_v6 (cognitive 19) src-tauri/src/database/schema.rs:1354 — 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.
D2 · Cognitive Complexity · ProxyService · ×5
  • ProxyService::sync_live_config_to_current_provider (cognitive 37) src-tauri/src/services/proxy.rs:3053 — ProxyService::sync_live_config_to_current_provider has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 4, match/switch 3 (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.
  • ProxyService::proxy_status_from_daemon_response_for_app (cognitive 34) src-tauri/src/services/proxy.rs:1156 — ProxyService::proxy_status_from_daemon_response_for_app has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 1, 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.
  • ProxyService::get_status_with_cleanup_for_app (cognitive 32) src-tauri/src/services/proxy.rs:948 — ProxyService::get_status_with_cleanup_for_app has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (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.
  • ProxyService::preserve_toml_mcp_servers_from_existing_config (cognitive 19) src-tauri/src/services/proxy.rs:2235 — ProxyService::preserve_toml_mcp_servers_from_existing_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (4 pts), 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.
  • ProxyService::enable_takeover_for_app_unlocked_with_options (cognitive 17) src-tauri/src/services/proxy.rs:2719 — ProxyService::enable_takeover_for_app_unlocked_with_options has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 7. 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.
D3 · God Classes · TooManyFields · ×5
  • TooManyFields: ProviderAddFormState src-tauri/src/cli/tui/form.rs:541 — TooManyFields — 116 stored fields beside 206 methods. The bar is 30 stored fields; this is 86 over it, 3.87× 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: App src-tauri/src/cli/tui/app/app_state.rs:722 — TooManyFields — 78 stored fields beside 281 methods. The bar is 30 stored fields; this is 48 over it, 2.60× 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: SessionsState src-tauri/src/cli/tui/app/types.rs:1121 — TooManyFields — 69 stored fields beside 111 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: AppSettings src-tauri/src/settings.rs:514 — TooManyFields — 40 stored fields beside 6 methods. The bar is 30 stored fields; this is 10 over it, 1.33× 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:27 — TooManyFields — 31 stored fields. 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×5
  • Edited copy of a member (33 corresponding lines) src-tauri/src/proxy/providers/claude.rs:465 — src-tauri/src/proxy/providers/claude.rs:465-503 | src-tauri/src/proxy/providers/gemini.rs:132-164 — 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.
  • Edited copy of a member (33 corresponding lines) src-tauri/src/services/proxy.rs:3019 — src-tauri/src/services/proxy.rs:3019-3051 | src-tauri/src/services/proxy.rs:3736-3768 — 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.
  • Edited copy of a member (33 corresponding lines) src-tauri/src/cli/commands/config_s3.rs:214 — src-tauri/src/cli/commands/config_s3.rs:214-247 | src-tauri/src/cli/commands/config_webdav.rs:305-337 — 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.
  • Edited copy of a member (33 corresponding lines) src-tauri/src/services/prompt.rs:39 — src-tauri/src/services/prompt.rs:39-71 | src-tauri/src/services/provider/mod.rs:409-443 — 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.
  • Edited copy of a member (33 corresponding lines) src-tauri/src/services/usage_stats.rs:312 — src-tauri/src/services/usage_stats.rs:312-357 | src-tauri/src/services/usage_stats.rs:367-399 — 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 (26 corresponding lines) · ×5
  • Edited copy of a member (26 corresponding lines) src-tauri/src/cli/tui/app/editor_state.rs:746 — src-tauri/src/cli/tui/app/editor_state.rs:746-774 | src-tauri/src/cli/tui/app/editor_state.rs:776-801 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) src-tauri/src/services/codex_oauth.rs:40 — src-tauri/src/services/codex_oauth.rs:40-65 | src-tauri/src/services/copilot_auth.rs:39-64 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) src-tauri/src/database/dao/failover.rs:72 — src-tauri/src/database/dao/failover.rs:72-97 | src-tauri/src/database/dao/proxy.rs:1138-1165 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) src-tauri/src/proxy/usage/parser.rs:498 — src-tauri/src/proxy/usage/parser.rs:498-526 | src-tauri/src/proxy/usage/parser.rs:593-618 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) src-tauri/src/session_manager/providers/claude.rs:27 — src-tauri/src/session_manager/providers/claude.rs:27-52 | src-tauri/src/session_manager/providers/codex.rs:643-678 — These two members are one piece of code written twice and then edited apart: 26 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) · ×5
  • Edited copy of a member (8 corresponding lines) src-tauri/src/claude_mcp.rs:74 — src-tauri/src/claude_mcp.rs:74-81 | src-tauri/src/gemini_mcp.rs:33-40 — 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/provider/live_merge.rs:168 — src-tauri/src/services/provider/live_merge.rs:168-175 | src-tauri/src/services/provider/live_merge.rs:185-197 — 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/cli/commands/provider.rs:557 — src-tauri/src/cli/commands/provider.rs:557-566 | src-tauri/src/cli/tui/data.rs:3553-3560 — 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/workspace.rs:334 — src-tauri/src/commands/workspace.rs:334-341 | src-tauri/src/services/session_usage.rs:1146-1153 — 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/sync_protocol.rs:96 — src-tauri/src/services/sync_protocol.rs:96-103 | src-tauri/src/services/webdav_sync/archive.rs:27-34 — 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.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×5
  • Duplicated block (24 lines × 2) src-tauri/src/cli/tui/ui/config.rs:3000 — src-tauri/src/cli/tui/ui/config.rs:3000-3023 | src-tauri/src/cli/tui/ui/config.rs:3030-3053 — 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/cli/tui/ui/config.rs:3000` 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 (24 lines × 2) src-tauri/src/cli/tui/ui/forms/prompt.rs:119 — src-tauri/src/cli/tui/ui/forms/prompt.rs:119-142 | src-tauri/src/cli/tui/ui/forms/webdav.rs:82-105 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/prompt.rs` and `src-tauri/src/cli/tui/ui/forms/webdav.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 63 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/cli/tui/ui/forms/prompt.rs:119` 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 (24 lines × 2) src-tauri/src/cli/tui/ui/usage.rs:900 — src-tauri/src/cli/tui/ui/usage.rs:900-923 | src-tauri/src/cli/tui/ui/usage.rs:951-974 — 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/cli/tui/ui/usage.rs:900` 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 (24 lines × 2) src-tauri/src/proxy/providers/streaming_gemini.rs:375 — src-tauri/src/proxy/providers/streaming_gemini.rs:375-398 | src-tauri/src/proxy/providers/streaming_gemini.rs:445-468 — 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:375` 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/session_manager/providers/claude.rs:339 — src-tauri/src/session_manager/providers/claude.rs:339-362 | src-tauri/src/session_manager/providers/codex.rs:963-986 — 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 10 separate duplicated blocks between them, totalling at least 152 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:339` 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/session_manager/providers/claude.rs:338` calls `or_else`, `truncate_summary` and `src-tauri/src/session_manager/providers/codex.rs:962` 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.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×5
  • Duplicated block (22 lines × 2) src-tauri/src/proxy/http_client.rs:83 — src-tauri/src/proxy/http_client.rs:83-104 | src-tauri/src/proxy/http_client.rs:116-137 — 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/http_client.rs:83` 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 (22 lines × 2) src-tauri/src/services/codex_oauth.rs:248 — src-tauri/src/services/codex_oauth.rs:248-269 | src-tauri/src/services/codex_oauth.rs:282-303 — 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/services/session_usage.rs:1303 — src-tauri/src/services/session_usage.rs:1303-1324 | src-tauri/src/services/session_usage_codex.rs:2012-2033 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_codex.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 84 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/session_usage.rs:1303` 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 (22 lines × 2) src-tauri/src/session_manager/providers/codex.rs:807 — src-tauri/src/session_manager/providers/codex.rs:807-828 | src-tauri/src/session_manager/providers/openclaw.rs:438-459 — 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 10 separate duplicated blocks between them, totalling at least 125 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:807` 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 (22 lines × 2) src-tauri/src/services/provider/mod.rs:2947 — src-tauri/src/services/provider/mod.rs:2947-2968 | src-tauri/src/services/provider/mod.rs:4038-4059 — 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:2947` 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.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:489 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:489-509 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:868-888 — 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/cli/tui/app/overlay_handlers/pickers.rs:489` 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 lines × 2) src-tauri/src/cli/tui/mod.rs:1703 — src-tauri/src/cli/tui/mod.rs:1703-1723 | src-tauri/src/cli/tui/mod.rs:1780-1800 — 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/cli/tui/mod.rs:1703` 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 (21 lines × 2) src-tauri/src/proxy/handlers.rs:613 — src-tauri/src/proxy/handlers.rs:613-633 | src-tauri/src/proxy/handlers.rs:764-784 — 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:613` 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 lines × 2) src-tauri/src/hermes_config.rs:343 — src-tauri/src/hermes_config.rs:343-363 | src-tauri/src/openclaw_config.rs:358-378 — before extracting anything, compare `src-tauri/src/hermes_config.rs` and `src-tauri/src/openclaw_config.rs` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `src-tauri/src/hermes_config.rs:343` 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 (21 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:172 — src-tauri/src/session_manager/providers/hermes.rs:172-192 | REDACTED:202-222 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:172` 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.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×5
  • Duplicated block (17 lines × 2) src-tauri/src/cli/tui/app/form_handlers/provider.rs:248 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:248-264 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1378-1394 — 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/cli/tui/app/form_handlers/provider.rs:248` 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/cli/tui/app/overlay_handlers/pickers.rs:330 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:330-346 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:366-382 — 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/cli/tui/app/overlay_handlers/pickers.rs:330` 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 × 2) src-tauri/src/cli/tui/mod.rs:3614 — src-tauri/src/cli/tui/mod.rs:3614-3630 | src-tauri/src/cli/tui/mod.rs:3636-3652 — 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/cli/tui/mod.rs:3614` 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 × 2) src-tauri/src/deeplink/provider.rs:764 — src-tauri/src/deeplink/provider.rs:764-780 | src-tauri/src/services/provider/mod.rs:3606-3622 — 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 (17 lines × 2) src-tauri/src/usage_script.rs:116 — src-tauri/src/usage_script.rs:116-132 | src-tauri/src/usage_script.rs:215-231 — 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:116` 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.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×5
  • Duplicated block (12 lines × 3) src-tauri/src/cli/commands/provider_inspect.rs:1080 — src-tauri/src/cli/commands/provider_inspect.rs:1080-1091 | src-tauri/src/cli/commands/provider_inspect.rs:1100-1111 | src-tauri/src/cli/commands/provider_inspect.rs:1119-1130 — 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/cli/commands/provider_inspect.rs:1080` 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/cli/commands/provider_inspect.rs:1079` calls `and_then`, `get` and `src-tauri/src/cli/commands/provider_inspect.rs:1118` 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 (12 lines × 3) src-tauri/src/cli/tui/ui/forms/mcp.rs:318 — src-tauri/src/cli/tui/ui/forms/mcp.rs:318-329 | src-tauri/src/cli/tui/ui/forms/provider.rs:1632-1643 | src-tauri/src/cli/tui/ui/forms/s3.rs:93-104 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 175 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/cli/tui/ui/forms/mcp.rs:318` 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/cli/tui/ui/forms/mcp.rs:332 — src-tauri/src/cli/tui/ui/forms/mcp.rs:332-343 | src-tauri/src/cli/tui/ui/forms/provider.rs:1646-1657 | src-tauri/src/cli/tui/ui/forms/s3.rs:107-118 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 175 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/cli/tui/ui/forms/mcp.rs:332` 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/proxy/error.rs:136 — src-tauri/src/proxy/error.rs:136-147 | src-tauri/src/proxy/handlers.rs:1005-1016 | src-tauri/src/proxy/response.rs:875-886 — 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/proxy/error.rs:136` 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 `error` to `ProxyError` in one and `&ProxyError` 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 lines × 3) src-tauri/src/mcp.rs:609 — src-tauri/src/mcp.rs:609-621 | src-tauri/src/mcp.rs:942-953 | src-tauri/src/mcp.rs:1682-1693 — 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.rs:609` 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.
D1 · Cyclomatic Complexity · Database · ×4
  • Database::apply_schema_migrations_on_conn (cyclomatic 47) src-tauri/src/database/schema.rs:442 — 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::dump_sql (cyclomatic 21) REDACTED:1221 — Database::dump_sql 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::init_impl_inner (cyclomatic 20) src-tauri/src/database/mod.rs:509 — Database::init_impl_inner 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.
  • Database::get_daily_trends (cyclomatic 20) src-tauri/src/services/usage_stats.rs:758 — Database::get_daily_trends 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.
D1 · Cyclomatic Complexity · ProxyService · ×4
  • ProxyService::sync_live_config_to_current_provider (cyclomatic 28) src-tauri/src/services/proxy.rs:3053 — ProxyService::sync_live_config_to_current_provider 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.
  • ProxyService::proxy_status_from_daemon_response_for_app (cyclomatic 20) src-tauri/src/services/proxy.rs:1156 — ProxyService::proxy_status_from_daemon_response_for_app 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.
  • ProxyService::get_status_with_cleanup_for_app (cyclomatic 18) src-tauri/src/services/proxy.rs:948 — ProxyService::get_status_with_cleanup_for_app 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.
  • ProxyService::enable_takeover_for_app_unlocked_with_options (cyclomatic 16) src-tauri/src/services/proxy.rs:2719 — ProxyService::enable_takeover_for_app_unlocked_with_options 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.
D2 · Cognitive Complexity · TranscriptIndexStore · ×4
  • TranscriptIndexStore::enforce_cache_budget_with_limits (cognitive 31) src-tauri/src/session_manager/transcript.rs:1059 — TranscriptIndexStore::enforce_cache_budget_with_limits has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 6, loops 2 (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.
  • TranscriptIndexStore::reserve_build_budget (cognitive 20) src-tauri/src/session_manager/transcript.rs:960 — TranscriptIndexStore::reserve_build_budget has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, loops 2 (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.
  • TranscriptIndexStore::open_or_build (cognitive 17) src-tauri/src/session_manager/transcript.rs:456 — TranscriptIndexStore::open_or_build has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 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.
  • TranscriptIndexStore::open_current (cognitive 17) src-tauri/src/session_manager/transcript.rs:601 — TranscriptIndexStore::open_current has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 2, match/switch 2 (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.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×4
  • Edited copy of a member (39 corresponding lines) src-tauri/src/session_manager/transcript.rs:2774 — src-tauri/src/session_manager/transcript.rs:2774-2816 | src-tauri/src/session_manager/transcript.rs:2959-2997 — 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.
  • Edited copy of a member (39 corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs:1804 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:1804-1842 | src-tauri/src/cli/tui/ui/sessions.rs:745-783 — 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.
  • Edited copy of a member (39 corresponding lines) src-tauri/src/cli/tui/data.rs:3011 — src-tauri/src/cli/tui/data.rs:3011-3053 | src-tauri/src/cli/tui/data.rs:3060-3098 — 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.
  • Edited copy of a member (39 corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs:558 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:558-596 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2089-2143 — 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 (30 corresponding lines) · ×4
  • Edited copy of a member (30 corresponding lines) src-tauri/src/cli/commands/update.rs:817 — src-tauri/src/cli/commands/update.rs:817-846 | src-tauri/src/cli/commands/update.rs:848-891 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) src-tauri/src/cli/tui/app/form_handlers/provider.rs:854 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:854-899 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1414-1443 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) src-tauri/src/session_manager/scan_cache_store.rs:635 — src-tauri/src/session_manager/scan_cache_store.rs:635-669 | src-tauri/src/session_manager/scan_cache_store.rs:674-703 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) src-tauri/src/session_manager/providers/claude.rs:181 — src-tauri/src/session_manager/providers/claude.rs:181-214 | src-tauri/src/session_manager/providers/openclaw.rs:461-490 — These two members are one piece of code written twice and then edited apart: 30 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) · ×4
  • Edited copy of a member (28 corresponding lines) src-tauri/src/cli/tui/runtime_actions/settings.rs:92 — src-tauri/src/cli/tui/runtime_actions/settings.rs:92-122 | src-tauri/src/cli/tui/runtime_actions/settings.rs:644-671 — 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.
  • Edited copy of a member (28 corresponding lines) src-tauri/src/cli/commands/sessions.rs:222 — src-tauri/src/cli/commands/sessions.rs:222-251 | src-tauri/src/cli/commands/sessions.rs:490-517 — 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.
  • Edited copy of a member (28 corresponding lines) src-tauri/src/cli/tui/runtime_actions/settings.rs:128 — src-tauri/src/cli/tui/runtime_actions/settings.rs:128-168 | src-tauri/src/cli/tui/runtime_actions/settings.rs:173-200 — 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.
  • Edited copy of a member (28 corresponding lines) src-tauri/src/session_manager/terminal/mod.rs:82 — src-tauri/src/session_manager/terminal/mod.rs:82-114 | src-tauri/src/session_manager/terminal/mod.rs:248-275 — 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 (27 corresponding lines) · ×4
  • Edited copy of a member (27 corresponding lines) src-tauri/src/config.rs:721 — src-tauri/src/config.rs:721-747 | src-tauri/src/database/mod.rs:252-278 — 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:72 — src-tauri/src/services/env_manager.rs:72-98 | src-tauri/src/services/env_manager.rs:166-193 — 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/cli/commands/update.rs:365 — src-tauri/src/cli/commands/update.rs:365-397 | src-tauri/src/cli/commands/update.rs:745-771 — 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:813 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:813-844 | src-tauri/src/proxy/providers/transform_responses.rs:160-186 — 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 copies of one member (3 members, 16+ corresponding lines) · ×4
  • 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.
  • Edited copies of one member (3 members, 16+ corresponding lines) src-tauri/src/cli/commands/update.rs:777 — src-tauri/src/cli/commands/update.rs:777-792 | src-tauri/src/cli/commands/update.rs:797-815 | src-tauri/src/cli/commands/update.rs:1063-1078 — 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.
  • Edited copies of one member (3 members, 16+ corresponding lines) src-tauri/src/codex_history_migration.rs:527 — src-tauri/src/codex_history_migration.rs:527-542 | src-tauri/src/codex_history_migration.rs:1361-1385 | REDACTED:1908-1926 — 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.
  • Edited copies of one member (3 members, 16+ corresponding lines) src-tauri/src/database/dao/proxy.rs:193 — src-tauri/src/database/dao/proxy.rs:193-211 | src-tauri/src/database/dao/proxy.rs:217-232 | src-tauri/src/database/dao/proxy.rs:273-291 — 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 copy of a member (6 corresponding lines) · ×4
  • Edited copy of a member (6 corresponding lines) src-tauri/src/session_manager/paged_manifest.rs:299 — src-tauri/src/session_manager/paged_manifest.rs:299-304 | src-tauri/src/session_manager/transcript.rs:2667-2672 — 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/paged_manifest.rs:306 — src-tauri/src/session_manager/paged_manifest.rs:306-311 | src-tauri/src/session_manager/transcript.rs:2674-2679 — 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/cli/tui/form/s3.rs:19 — src-tauri/src/cli/tui/form/s3.rs:19-24 | src-tauri/src/services/local_env_check.rs:93-98 — 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/live/project/claude.rs:402 — src-tauri/src/live/project/claude.rs:402-407 | src-tauri/src/services/session_usage_pi.rs:577-582 — 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.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×4
  • Duplicated block (26 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs:1222 — src-tauri/src/cli/tui/ui/forms/provider.rs:1222-1247 | src-tauri/src/cli/tui/ui/forms/provider.rs:1342-1367 — 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/cli/tui/ui/forms/provider.rs:1222` 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 (26 lines × 2) src-tauri/src/services/usage_stats.rs:1060 — src-tauri/src/services/usage_stats.rs:1060-1085 | src-tauri/src/services/usage_stats.rs:1186-1211 — 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/usage_stats.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/services/usage_stats.rs:1088` calls `provider_name_coalesce` and `src-tauri/src/services/usage_stats.rs:1214` 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 (26 lines × 2) src-tauri/src/session_manager/providers/codex.rs:706 — src-tauri/src/session_manager/providers/codex.rs:706-731 | src-tauri/src/session_manager/providers/codex.rs:772-797 — 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/codex.rs:706` 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 (26 lines × 2) src-tauri/src/services/usage_stats.rs:788 — src-tauri/src/services/usage_stats.rs:788-813 | src-tauri/src/services/usage_stats.rs:878-903 — 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/usage_stats.rs:788` 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.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×4
  • Duplicated block (18–19 lines × 2) src-tauri/src/cli/commands/skills.rs:668 — src-tauri/src/cli/commands/skills.rs:668-686 | src-tauri/src/cli/tui/runtime_skills.rs:85-102 — 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/cli/commands/skills.rs:668` 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 (18–19 lines × 2) src-tauri/src/cli/tui/ui/forms/s3.rs:125 — src-tauri/src/cli/tui/ui/forms/s3.rs:125-142 | src-tauri/src/cli/tui/ui/forms/webdav.rs:111-129 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/s3.rs` and `src-tauri/src/cli/tui/ui/forms/webdav.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 97 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/cli/tui/ui/forms/s3.rs:125` 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 (18–19 lines × 2) src-tauri/src/services/skill.rs:1126 — src-tauri/src/services/skill.rs:1126-1143 | src-tauri/src/services/skill.rs:2333-2351 — 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:1126` 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–19 lines × 2) src-tauri/src/session_manager/providers/claude.rs:29 — src-tauri/src/session_manager/providers/claude.rs:29-46 | src-tauri/src/session_manager/providers/codex.rs:644-662 — 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 10 separate duplicated blocks between them, totalling at least 152 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:29` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/session_manager/providers/claude.rs:28` calls `get_claude_config_dir`, `join` and `src-tauri/src/session_manager/providers/codex.rs:643` 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.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×4
  • Duplicated block (13 lines × 3) src-tauri/src/cli/commands/provider.rs:1922 — src-tauri/src/cli/commands/provider.rs:1922-1934 | src-tauri/src/cli/tui/form/provider_state.rs:30-42 | src-tauri/src/services/provider/mod.rs:431-443 — 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/cli/commands/provider.rs:1922` 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 × 3) src-tauri/src/proxy/handlers.rs:129 — src-tauri/src/proxy/handlers.rs:129-141 | src-tauri/src/proxy/handlers.rs:153-165 | src-tauri/src/proxy/handlers.rs:177-189 — 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: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 (13 lines × 3) src-tauri/src/proxy/handlers.rs:616 — src-tauri/src/proxy/handlers.rs:616-628 | src-tauri/src/proxy/handlers.rs:767-779 | src-tauri/src/proxy/handlers.rs:813-825 — 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:616` 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 lines × 3) src-tauri/src/proxy/response.rs:524 — src-tauri/src/proxy/response.rs:524-536 | src-tauri/src/proxy/response.rs:601-613 | src-tauri/src/proxy/response.rs:853-865 — 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/response.rs:524` 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.
D1 · Cyclomatic Complexity · SkillService · ×3
  • SkillService::migrate_storage (cyclomatic 48) src-tauri/src/services/skill.rs:2025 — SkillService::migrate_storage 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.
  • SkillService::migrate_ssot_if_pending (cyclomatic 29) src-tauri/src/services/skill.rs:893 — SkillService::migrate_ssot_if_pending 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.
  • SkillService::update_skill (cyclomatic 18) src-tauri/src/services/skill.rs:2679 — SkillService::update_skill 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.
D1 · Cyclomatic Complexity · CodexOAuthManager · ×3
  • CodexOAuthManager::adopt_account_refresh_token_under_lock (cyclomatic 25) src-tauri/src/proxy/providers/codex_oauth_auth.rs:935 — CodexOAuthManager::adopt_account_refresh_token_under_lock 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.
  • CodexOAuthManager::add_account_internal (cyclomatic 19) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1654 — 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:1151 — 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.
D2 · Cognitive Complexity · CodexOAuthManager · ×3
  • CodexOAuthManager::adopt_account_refresh_token_under_lock (cognitive 36) src-tauri/src/proxy/providers/codex_oauth_auth.rs:935 — CodexOAuthManager::adopt_account_refresh_token_under_lock has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (30 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:1654 — 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:1151 — 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.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src-tauri/src/cli/tui/runtime_actions/editor.rs:1023 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1023-1114 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1121-1182 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1198-1271 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1273-1311 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1317-1348 — 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/cli/tui/ui/config.rs:3061 — src-tauri/src/cli/tui/ui/config.rs:3061-3198 | src-tauri/src/cli/tui/ui/config.rs:3206-3299 | src-tauri/src/cli/tui/ui/config.rs:3307-3405 | src-tauri/src/cli/tui/ui/config.rs:4223-4296 | src-tauri/src/cli/tui/ui/skills/repos.rs:9-111 — 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/cli/tui/ui/overlay/pickers.rs:347 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:347-405 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:413-459 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:905-937 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2359-2394 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2645-2682 — 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 (29 corresponding lines) · ×3
  • Edited copy of a member (29 corresponding lines) src-tauri/src/cli/commands/config_common.rs:241 — src-tauri/src/cli/commands/config_common.rs:241-272 | src-tauri/src/cli/commands/config_common.rs:332-360 — 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/providers/codex.rs:37 — src-tauri/src/proxy/providers/codex.rs:37-70 | src-tauri/src/proxy/providers/codex.rs:89-117 — 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/session.rs:63 — src-tauri/src/proxy/session.rs:63-91 | src-tauri/src/proxy/session.rs:93-123 — 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, 15+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 15+ corresponding lines) src-tauri/src/cli/tui/runtime_actions/skills.rs:85 — src-tauri/src/cli/tui/runtime_actions/skills.rs:85-99 | src-tauri/src/cli/tui/runtime_actions/skills.rs:101-118 | src-tauri/src/cli/tui/runtime_actions/skills.rs:170-188 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) src-tauri/src/cli/tui/runtime_actions/config.rs:482 — src-tauri/src/cli/tui/runtime_actions/config.rs:482-497 | src-tauri/src/cli/tui/runtime_actions/editor.rs:448-462 | src-tauri/src/cli/tui/runtime_actions/editor.rs:468-484 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) src-tauri/src/cli/commands/provider.rs:1920 — src-tauri/src/cli/commands/provider.rs:1920-1934 | src-tauri/src/cli/tui/form/provider_state.rs:28-42 | src-tauri/src/services/provider/mod.rs:455-470 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 18+ corresponding lines) src-tauri/src/proxy/handlers.rs:128 — src-tauri/src/proxy/handlers.rs:128-145 | src-tauri/src/proxy/handlers.rs:152-169 | src-tauri/src/proxy/handlers.rs:176-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 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, 18+ corresponding lines) src-tauri/src/services/subscription.rs:137 — src-tauri/src/services/subscription.rs:137-159 | src-tauri/src/services/subscription.rs:435-452 | src-tauri/src/services/subscription.rs:1035-1059 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 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, 18+ corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs:2335 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:2335-2352 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2402-2421 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2430-2448 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 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, 10+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 10+ corresponding lines) src-tauri/src/cli/commands/config_s3.rs:191 — src-tauri/src/cli/commands/config_s3.rs:191-200 | src-tauri/src/cli/commands/config_webdav.rs:271-280 | src-tauri/src/cli/commands/config_webdav.rs:282-291 — 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.
  • Edited copies of one member (3 members, 10+ corresponding lines) src-tauri/src/cli/tui/form/provider_state.rs:1096 — src-tauri/src/cli/tui/form/provider_state.rs:1096-1105 | src-tauri/src/cli/tui/form/provider_state.rs:1156-1165 | src-tauri/src/cli/tui/form/provider_state.rs:1557-1568 — 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.
  • Edited copies of one member (3 members, 10+ corresponding lines) src-tauri/src/cli/tui/app/types.rs:2669 — src-tauri/src/cli/tui/app/types.rs:2669-2678 | src-tauri/src/cli/tui/app/types.rs:2841-2854 | src-tauri/src/cli/tui/app/types.rs:3544-3554 — 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, 8+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 8+ corresponding lines) src-tauri/src/claude_mcp.rs:65 — src-tauri/src/claude_mcp.rs:65-72 | src-tauri/src/codex_config.rs:781-791 | src-tauri/src/gemini_mcp.rs:24-31 — 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/cli/tui/runtime_actions/prompts.rs:13 — src-tauri/src/cli/tui/runtime_actions/prompts.rs:13-20 | src-tauri/src/cli/tui/runtime_actions/prompts.rs:22-29 | src-tauri/src/cli/tui/runtime_actions/prompts.rs:138-145 — 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/cli/commands/provider.rs:1316 — src-tauri/src/cli/commands/provider.rs:1316-1324 | src-tauri/src/proxy/providers/codex_chat_common.rs:192-199 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1315-1323 — 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 copies of one member (4 members, 11+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 11+ corresponding lines) src-tauri/src/app_config.rs:37 — src-tauri/src/app_config.rs:37-47 | src-tauri/src/app_config.rs:106-116 | src-tauri/src/app_config.rs:427-437 | src-tauri/src/settings.rs:136-146 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 11+ corresponding lines) src-tauri/src/cli/tui/data.rs:1086 — src-tauri/src/cli/tui/data.rs:1086-1096 | src-tauri/src/cli/tui/data.rs:1098-1108 | src-tauri/src/cli/tui/data.rs:1110-1120 | src-tauri/src/cli/tui/data.rs:1122-1132 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 11+ corresponding lines) src-tauri/src/database/dao/proxy.rs:892 — src-tauri/src/database/dao/proxy.rs:892-904 | src-tauri/src/database/dao/proxy.rs:1011-1024 | src-tauri/src/database/dao/proxy.rs:1092-1105 | src-tauri/src/session_manager/scan_cache_store.rs:605-615 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×3
  • Duplicated block (29 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs:180 — src-tauri/src/cli/tui/runtime_actions/editor.rs:180-208 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1362-1390 — 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/cli/tui/runtime_actions/editor.rs:180` 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 (29 lines × 2) src-tauri/src/cli/tui/ui/config.rs:1366 — src-tauri/src/cli/tui/ui/config.rs:1366-1394 | src-tauri/src/cli/tui/ui/config.rs:2260-2288 — 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/cli/tui/ui/config.rs:1366` 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 (29 lines × 2) src-tauri/src/proxy/providers/transform_codex_chat.rs:808 — src-tauri/src/proxy/providers/transform_codex_chat.rs:808-836 | src-tauri/src/proxy/providers/transform_codex_chat.rs:838-866 — 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.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×3
  • Duplicated block (28 lines × 2) src-tauri/src/cli/commands/auth.rs:435 — src-tauri/src/cli/commands/auth.rs:435-462 | src-tauri/src/cli/commands/provider_inspect.rs:540-567 — before extracting anything, compare `src-tauri/src/cli/commands/auth.rs` and `src-tauri/src/cli/commands/provider_inspect.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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/cli/commands/auth.rs:435` 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 (28 lines × 2) src-tauri/src/cli/provider_quota.rs:203 — src-tauri/src/cli/provider_quota.rs:203-230 | src-tauri/src/cli/tui/ui/shared.rs:893-920 — before extracting anything, compare `src-tauri/src/cli/provider_quota.rs` and `src-tauri/src/cli/tui/ui/shared.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 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 (28 lines × 2) src-tauri/src/database/dao/proxy.rs:330 — src-tauri/src/database/dao/proxy.rs:330-357 | src-tauri/src/database/dao/proxy.rs:376-403 — 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.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) src-tauri/src/cli/tui/ui/config.rs:3243 — src-tauri/src/cli/tui/ui/config.rs:3243-3266 | src-tauri/src/cli/tui/ui/config.rs:3316-3338 — 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/cli/tui/ui/config.rs:3243` 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 (23 lines × 2) src-tauri/src/services/proxy.rs:3567 — src-tauri/src/services/proxy.rs:3567-3589 | src-tauri/src/services/proxy.rs:3661-3683 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `provider` to `Option<&Provider>` in one and `&Provider` 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 (23 lines × 2) src-tauri/src/cli/tui/data.rs:3016 — src-tauri/src/cli/tui/data.rs:3016-3040 | src-tauri/src/cli/tui/data.rs:3064-3086 — 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/cli/tui/data.rs:3016` 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.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×3
  • Duplicated block (21–22 lines × 2) src-tauri/src/cli/commands/auth.rs:467 — src-tauri/src/cli/commands/auth.rs:467-488 | src-tauri/src/cli/commands/provider_inspect.rs:569-589 — before extracting anything, compare `src-tauri/src/cli/commands/auth.rs` and `src-tauri/src/cli/commands/provider_inspect.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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/cli/commands/auth.rs:467` 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 (21–22 lines × 2) src-tauri/src/proxy/response.rs:519 — src-tauri/src/proxy/response.rs:519-539 | src-tauri/src/proxy/response.rs:595-616 — 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.rs:519` 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–22 lines × 2) src-tauri/src/session_manager/providers/gemini.rs:283 — src-tauri/src/session_manager/providers/gemini.rs:283-304 | src-tauri/src/session_manager/providers/gemini.rs:351-371 — 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/gemini.rs:283` 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.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×3
  • Duplicated block (13–14 lines × 2) src-tauri/src/deeplink/provider.rs:405 — src-tauri/src/deeplink/provider.rs:405-417 | src-tauri/src/deeplink/provider.rs:729-742 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `request` to `&DeepLinkImportRequest` in one and `&mut DeepLinkImportRequest` 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 (13–14 lines × 2) src-tauri/src/proxy/forwarder.rs:368 — src-tauri/src/proxy/forwarder.rs:368-380 | src-tauri/src/proxy/forwarder.rs:613-626 — 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:368` 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/forwarder.rs:381` calls `status` and `src-tauri/src/proxy/forwarder.rs:627` 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 (13–14 lines × 2) src-tauri/src/proxy/providers/streaming_gemini.rs:53 — src-tauri/src/proxy/providers/streaming_gemini.rs:53-66 | src-tauri/src/proxy/providers/transform_gemini.rs:1010-1022 — 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:53` 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×3
  • Duplicated block (12–13 lines × 2) src-tauri/src/cli/commands/config.rs:212 — src-tauri/src/cli/commands/config.rs:212-224 | src-tauri/src/cli/commands/config.rs:336-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/cli/commands/config.rs:212` 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–13 lines × 2) src-tauri/src/codex_config/managed_auth.rs:121 — src-tauri/src/codex_config/managed_auth.rs:121-132 | src-tauri/src/codex_config/managed_auth.rs:149-161 — 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/session_manager/providers/claude.rs:236 — src-tauri/src/session_manager/providers/claude.rs:236-248 | src-tauri/src/session_manager/providers/codex.rs:867-878 — 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 10 separate duplicated blocks between them, totalling at least 152 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:236` 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×3
  • Duplicated block (10–11 lines × 3) src-tauri/src/mcp.rs:747 — src-tauri/src/mcp.rs:747-757 | src-tauri/src/mcp.rs:911-920 | src-tauri/src/mcp.rs:1634-1643 — 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 × 3) src-tauri/src/services/proxy.rs:743 — src-tauri/src/services/proxy.rs:743-753 | src-tauri/src/services/proxy.rs:799-808 | src-tauri/src/services/proxy.rs:2828-2838 — 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 (10–11 lines × 3) src-tauri/src/services/session_usage.rs:1252 — src-tauri/src/services/session_usage.rs:1252-1261 | src-tauri/src/services/session_usage_codex.rs:553-563 | src-tauri/src/services/session_usage_gemini.rs:307-316 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_codex.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 84 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/session_usage.rs:1252` 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×3
  • Duplicated block (10–11 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs:893 — src-tauri/src/cli/tui/ui/forms/provider.rs:893-902 | src-tauri/src/cli/tui/ui/forms/provider.rs:974-984 — 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/cli/tui/ui/forms/provider.rs:974` 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–11 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1865 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1865-1874 | src-tauri/src/proxy/providers/copilot_auth.rs:1191-1201 — 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 8 separate duplicated blocks between them, totalling at least 110 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:1865` 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/proxy/providers/streaming_responses.rs:424 — src-tauri/src/proxy/providers/streaming_responses.rs:424-434 | src-tauri/src/proxy/providers/streaming_responses.rs:484-493 — 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:423` calls `Some`, `get`, `and_then` and `src-tauri/src/proxy/providers/streaming_responses.rs:483` 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.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×3
  • Duplicated block (8–10 lines × 2) src-tauri/src/codex_history_migration.rs:548 — src-tauri/src/codex_history_migration.rs:548-555 | src-tauri/src/codex_history_migration.rs:1455-1464 — 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:556` calls `get`, `as_str` and `src-tauri/src/codex_history_migration.rs:1465` 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/codex_history_migration.rs:1005 — src-tauri/src/codex_history_migration.rs:1005-1012 | src-tauri/src/codex_history_migration.rs:1081-1090 — 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/codex_history_migration.rs:1005` 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 after the matched lines, `src-tauri/src/codex_history_migration.rs:1012` calls `and_then`, `as_table`, `get` and `src-tauri/src/codex_history_migration.rs:1090` 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/session_manager/providers/claude.rs:78 — src-tauri/src/session_manager/providers/claude.rs:78-87 | src-tauri/src/session_manager/providers/claude.rs:133-140 — 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:78` 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.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×3
  • Duplicated block (9 lines × 5) src-tauri/src/cli/tui/ui/forms/mcp.rs:69 — src-tauri/src/cli/tui/ui/forms/mcp.rs:69-77 | src-tauri/src/cli/tui/ui/forms/prompt.rs:87-95 | src-tauri/src/cli/tui/ui/forms/provider.rs:904-912 | src-tauri/src/cli/tui/ui/forms/provider.rs:1140-1148 | src-tauri/src/cli/tui/ui/forms/provider.rs:1537-1545 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.rs:69` 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 × 5) src-tauri/src/cli/tui/ui/forms/mcp.rs:331 — src-tauri/src/cli/tui/ui/forms/mcp.rs:331-339 | src-tauri/src/cli/tui/ui/forms/prompt.rs:129-137 | src-tauri/src/cli/tui/ui/forms/provider.rs:1645-1653 | src-tauri/src/cli/tui/ui/forms/s3.rs:106-114 | src-tauri/src/cli/tui/ui/forms/webdav.rs:92-100 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.rs:331` 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 × 5) src-tauri/src/services/provider/mod.rs:1400 — src-tauri/src/services/provider/mod.rs:1400-1408 | src-tauri/src/services/provider/mod.rs:1603-1611 | src-tauri/src/services/provider/mod.rs:1623-1631 | src-tauri/src/services/provider/mod.rs:1643-1651 | src-tauri/src/services/provider/mod.rs:1663-1671 — 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/services/provider/mod.rs: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.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×3
  • Duplicated block (9 lines × 4) src-tauri/src/cli/tui/ui/forms/mcp.rs:341 — src-tauri/src/cli/tui/ui/forms/mcp.rs:341-349 | src-tauri/src/cli/tui/ui/forms/provider.rs:646-654 | src-tauri/src/cli/tui/ui/forms/provider.rs:1655-1663 | src-tauri/src/cli/tui/ui/forms/s3.rs:116-124 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 175 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/cli/tui/ui/forms/mcp.rs:341` 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/cli/tui/ui/forms/mcp.rs:350` calls `block`, `default`, `borders` and `src-tauri/src/cli/tui/ui/forms/s3.rs:125` 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 (9 lines × 4) src-tauri/src/session_manager/providers/gemini.rs:52 — src-tauri/src/session_manager/providers/gemini.rs:52-63 | src-tauri/src/session_manager/providers/hermes.rs:97-108 | src-tauri/src/session_manager/providers/openclaw.rs:80-91 | src-tauri/src/session_manager/providers/pi.rs:331-339 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 70 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/gemini.rs:52` 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 × 4) src-tauri/src/session_manager/providers/gemini.rs:64 — src-tauri/src/session_manager/providers/gemini.rs:64-72 | src-tauri/src/session_manager/providers/openclaw.rs:92-100 | src-tauri/src/session_manager/providers/pi.rs:340-348 | src-tauri/src/session_manager/providers/pi.rs:371-379 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `src-tauri/src/session_manager/providers/openclaw.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 70 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/gemini.rs:64` 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.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×3
  • Duplicated block (8 lines × 3) src-tauri/src/mcp.rs:362 — src-tauri/src/mcp.rs:362-369 | src-tauri/src/mcp.rs:753-760 | src-tauri/src/mcp.rs:916-923 — 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.rs:362` 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/paged_manifest.rs:526 — src-tauri/src/session_manager/paged_manifest.rs:526-533 | src-tauri/src/session_manager/paged_manifest.rs:618-625 | src-tauri/src/session_manager/paged_manifest.rs:1020-1027 — 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/paged_manifest.rs:526` 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 × 3) src-tauri/src/cli/commands/provider_input.rs:3646 — src-tauri/src/cli/commands/provider_input.rs:3646-3653 | src-tauri/src/cli/tui/form/provider_json.rs:1526-1533 | src-tauri/src/cli/tui/form/provider_json.rs:1535-1542 — before extracting anything, compare `src-tauri/src/cli/commands/provider_input.rs` and `src-tauri/src/cli/tui/form/provider_json.rs` as WHOLE FILES: this scan already matched 6 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. 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×3
  • Duplicated block (7–8 lines × 2) src-tauri/src/cli/commands/provider.rs:1711 — src-tauri/src/cli/commands/provider.rs:1711-1718 | src-tauri/src/cli/commands/provider.rs:1990-1996 — 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/codex_config.rs:193 — src-tauri/src/codex_config.rs:193-199 | src-tauri/src/codex_config.rs:310-317 — 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/proxy/copilot_optimizer.rs:429 — src-tauri/src/proxy/copilot_optimizer.rs:429-435 | src-tauri/src/proxy/copilot_optimizer.rs:488-495 — 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:488` 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.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) src-tauri/src/cli/tui/ui/forms/provider.rs:910 — src-tauri/src/cli/tui/ui/forms/provider.rs:910-917 | src-tauri/src/cli/tui/ui/forms/provider.rs:991-997 | src-tauri/src/cli/tui/ui/forms/provider.rs:1146-1153 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:1025-1032 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/provider.rs` and `src-tauri/src/cli/tui/ui/overlay/pickers.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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/cli/tui/ui/forms/provider.rs:910` 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 × 4) src-tauri/src/cli/tui/ui/overlay/basic.rs:264 — src-tauri/src/cli/tui/ui/overlay/basic.rs:264-271 | src-tauri/src/cli/tui/ui/overlay/basic.rs:328-335 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2575-2582 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2622-2628 — 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/cli/tui/ui/overlay/basic.rs:264` 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 × 4) src-tauri/src/mcp.rs:361 — src-tauri/src/mcp.rs:361-367 | src-tauri/src/mcp.rs:752-758 | src-tauri/src/mcp.rs:915-921 | src-tauri/src/mcp.rs:1638-1644 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) src-tauri/src/proxy/providers/copilot_auth.rs:759 — src-tauri/src/proxy/providers/copilot_auth.rs:759-765 | src-tauri/src/proxy/providers/copilot_auth.rs:906-912 | src-tauri/src/proxy/providers/copilot_auth.rs:1020-1026 — 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:1019` calls `fetch_and_cache_endpoint` and `src-tauri/src/proxy/providers/copilot_auth.rs:756` 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/services/usage_stats.rs:537 — src-tauri/src/services/usage_stats.rs:537-544 | src-tauri/src/services/usage_stats.rs:943-950 | src-tauri/src/services/usage_stats.rs:1205-1211 — 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/usage_stats.rs:537` 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/services/usage_stats.rs:1215` calls `fresh_input_sql` and `src-tauri/src/services/usage_stats.rs:953` 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 × 3) src-tauri/src/cli/commands/config.rs:208 — src-tauri/src/cli/commands/config.rs:208-214 | src-tauri/src/cli/commands/config.rs:274-281 | src-tauri/src/cli/commands/config.rs:499-505 — 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/cli/commands/config.rs:208` 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×3
  • Duplicated block (6–7 lines × 2) src-tauri/src/cli/tui/runtime_actions/settings.rs:93 — src-tauri/src/cli/tui/runtime_actions/settings.rs:93-98 | src-tauri/src/cli/tui/runtime_actions/settings.rs:645-651 — 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–7 lines × 2) src-tauri/src/cli/tui/ui/config.rs:285 — src-tauri/src/cli/tui/ui/config.rs:285-291 | src-tauri/src/cli/tui/ui/forms/webdav.rs:109-114 — 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/cli/tui/ui/config.rs:285` 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/session_manager/providers/gemini.rs:188 — src-tauri/src/session_manager/providers/gemini.rs:188-194 | REDACTED:1678-1683 — before extracting anything, compare `src-tauri/src/session_manager/providers/gemini.rs` and `REDACTED` 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/session_manager/providers/gemini.rs:188` 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.
D1 · Cyclomatic Complexity · CodexConfigPatch · ×2
  • CodexConfigPatch::write_route (cyclomatic 24) src-tauri/src/live/project/codex.rs:706 — 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:605 — 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.
D1 · Cyclomatic Complexity · TranscriptIndexStore · ×2
  • TranscriptIndexStore::enforce_cache_budget_with_limits (cyclomatic 20) src-tauri/src/session_manager/transcript.rs:1059 — TranscriptIndexStore::enforce_cache_budget_with_limits 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.
  • TranscriptIndexStore::open_current (cyclomatic 16) src-tauri/src/session_manager/transcript.rs:601 — TranscriptIndexStore::open_current 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.
D1 · Cyclomatic Complexity · Supervisor · ×2
  • Supervisor::ensure_worker_locked (cyclomatic 16) src-tauri/src/daemon/supervisor.rs:164 — Supervisor::ensure_worker_locked 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.
  • Supervisor::watch_worker (cyclomatic 16) src-tauri/src/daemon/supervisor.rs:927 — Supervisor::watch_worker 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.
D2 · Cognitive Complexity · CodexConfigPatch · ×2
  • CodexConfigPatch::apply_to (cognitive 27) src-tauri/src/live/project/codex.rs:605 — 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:706 — 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.
D2 · Cognitive Complexity · ChatToResponsesState · ×2
  • ChatToResponsesState::finalize_tools (cognitive 27) src-tauri/src/proxy/providers/streaming_codex_chat.rs:695 — ChatToResponsesState::finalize_tools has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 1, loops 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.
  • ChatToResponsesState::handle_chat_chunk (cognitive 21) src-tauri/src/proxy/providers/streaming_codex_chat.rs:115 — 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.
D2 · Cognitive Complexity · MultiAppConfig · ×2
  • MultiAppConfig::load (cognitive 21) src-tauri/src/app_config.rs:494 — MultiAppConfig::load has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 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:683 — 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.
D2 · Cognitive Complexity · Supervisor · ×2
  • Supervisor::watch_worker (cognitive 21) src-tauri/src/daemon/supervisor.rs:927 — Supervisor::watch_worker has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 4, 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.
  • Supervisor::ensure_worker_locked (cognitive 16) src-tauri/src/daemon/supervisor.rs:164 — Supervisor::ensure_worker_locked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5, boolean chains 2 (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.
D2 · Cognitive Complexity · PagedManifestBuilder · ×2
  • PagedManifestBuilder::publish (cognitive 18) src-tauri/src/session_manager/paged_manifest.rs:1621 — PagedManifestBuilder::publish has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2, match/switch 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.
  • PagedManifestBuilder::build_deduplicated_recency_runs (cognitive 17) src-tauri/src/session_manager/paged_manifest.rs:1885 — PagedManifestBuilder::build_deduplicated_recency_runs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 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.
D2 · Cognitive Complexity · PagedManifestStore · ×2
  • PagedManifestStore::validate_generation_pages_in (cognitive 16) src-tauri/src/session_manager/paged_manifest.rs:786 — PagedManifestStore::validate_generation_pages_in has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), 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.
  • PagedManifestStore::read_or_recover_coordinator_locked (cognitive 16) src-tauri/src/session_manager/paged_manifest.rs:910 — PagedManifestStore::read_or_recover_coordinator_locked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, match/switch 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.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · TooManyFunctions · ×2
  • TooManyFunctions: cc_switch::cli::tui::runtime_actions::config src-tauri/src/cli/tui/runtime_actions/config.rs:24 — 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 — 34 free functions. The bar is 30 free functions; this is 4 over it, 1.13× 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.
D35 · Change Coupling · Change-coupling hub · ×2
  • Change-coupling hub: REDACTED → basic.rs, pickers.rs, render.rs src-tauri/src/cli/tui/app/tests.rs — `src-tauri/src/cli/tui/app/tests.rs` changes together with 3 other files — `src-tauri/src/cli/tui/ui/overlay/basic.rs`, `src-tauri/src/cli/tui/ui/overlay/pickers.rs`, `src-tauri/src/cli/tui/ui/overlay/render.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: i18n.rs → types.rs, form.rs, provider.rs, main_page.rs, basic.rs, pickers.rs, render.rs src-tauri/src/cli/i18n.rs — `src-tauri/src/cli/i18n.rs` changes together with 7 other files — `src-tauri/src/cli/tui/app/types.rs`, `src-tauri/src/cli/tui/form.rs`, `src-tauri/src/cli/tui/ui/forms/provider.rs`, `src-tauri/src/cli/tui/ui/main_page.rs`, `src-tauri/src/cli/tui/ui/overlay/basic.rs`, `src-tauri/src/cli/tui/ui/overlay/pickers.rs`, `src-tauri/src/cli/tui/ui/overlay/render.rs` — 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.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×2
  • Edited copy of a member (54 corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1905 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1905-1958 | src-tauri/src/proxy/providers/copilot_auth.rs:1246-1299 — 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.
  • Edited copy of a member (54 corresponding lines) src-tauri/src/session_manager/providers/gemini.rs:45 — src-tauri/src/session_manager/providers/gemini.rs:45-106 | src-tauri/src/session_manager/providers/openclaw.rs:73-126 — 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 (48 corresponding lines) · ×2
  • Edited copy of a member (48 corresponding lines) src-tauri/src/cli/tui/app/form_handlers/provider.rs:747 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:747-795 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:801-848 — 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.
  • Edited copy of a member (48 corresponding lines) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1535 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1535-1582 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1682-1735 — 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 copy of a member (43 corresponding lines) · ×2
  • Edited copy of a member (43 corresponding lines) src-tauri/src/cli/tui/ui/usage.rs:876 — src-tauri/src/cli/tui/ui/usage.rs:876-923 | src-tauri/src/cli/tui/ui/usage.rs:932-974 — These two members are one piece of code written twice and then edited apart: 43 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 (43 corresponding lines) src-tauri/src/services/provider/common_config.rs:644 — src-tauri/src/services/provider/common_config.rs:644-686 | src-tauri/src/services/provider/common_config.rs:692-737 — These two members are one piece of code written twice and then edited apart: 43 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) · ×2
  • Edited copy of a member (44 corresponding lines) REDACTED:903 — REDACTED:903-948 | src-tauri/src/services/config.rs:190-233 — 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.
  • Edited copy of a member (44 corresponding lines) src-tauri/src/services/provider/live.rs:210 — src-tauri/src/services/provider/live.rs:210-256 | src-tauri/src/services/provider/live.rs:440-483 — 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 (53 corresponding lines) · ×2
  • Edited copy of a member (53 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_chat.rs:292 — src-tauri/src/proxy/providers/streaming_codex_chat.rs:292-344 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:346-400 — These two members are one piece of code written twice and then edited apart: 53 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 (53 corresponding lines) src-tauri/src/proxy/providers/streaming_codex_chat.rs:585 — src-tauri/src/proxy/providers/streaming_codex_chat.rs:585-637 | src-tauri/src/proxy/providers/streaming_codex_chat.rs:639-693 — These two members are one piece of code written twice and then edited apart: 53 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/session_manager/providers/hermes.rs:350 — src-tauri/src/session_manager/providers/hermes.rs:350-384 | REDACTED:370-413 — 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/services/proxy.rs:309 — src-tauri/src/services/proxy.rs:309-343 | src-tauri/src/services/proxy.rs:609-648 — 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 (34 corresponding lines) · ×2
  • Edited copy of a member (34 corresponding lines) src-tauri/src/cli/commands/skills.rs:663 — src-tauri/src/cli/commands/skills.rs:663-697 | src-tauri/src/cli/tui/runtime_skills.rs:80-113 — 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/cli/tui/mod.rs:760 — src-tauri/src/cli/tui/mod.rs:760-793 | src-tauri/src/cli/tui/mod.rs:800-839 — 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 (32 corresponding lines) · ×2
  • Edited copy of a member (32 corresponding lines) src-tauri/src/proxy/providers/streaming_gemini.rs:49 — src-tauri/src/proxy/providers/streaming_gemini.rs:49-84 | src-tauri/src/proxy/providers/transform_gemini.rs:1009-1040 — 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/cli/tui/ui/usage.rs:15 — src-tauri/src/cli/tui/ui/usage.rs:15-46 | src-tauri/src/cli/tui/ui/usage.rs:54-97 — 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 copies of one member (3 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 13+ corresponding lines) src-tauri/src/cli/tui/runtime_actions/config.rs:80 — src-tauri/src/cli/tui/runtime_actions/config.rs:80-92 | src-tauri/src/cli/tui/runtime_actions/config.rs:97-111 | src-tauri/src/cli/tui/runtime_actions/mcp.rs:88-100 — 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.
  • Edited copies of one member (3 members, 13+ corresponding lines) src-tauri/src/openclaw_config.rs:695 — src-tauri/src/openclaw_config.rs:695-707 | src-tauri/src/openclaw_config.rs:878-892 | src-tauri/src/openclaw_config.rs:919-932 — 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 (3 members, 14+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 14+ corresponding lines) src-tauri/src/cli/tui/app/content_config.rs:1625 — src-tauri/src/cli/tui/app/content_config.rs:1625-1638 | src-tauri/src/cli/tui/app/content_config.rs:1644-1658 | src-tauri/src/cli/tui/app/content_config.rs:1664-1679 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) src-tauri/src/cli/commands/config_openclaw.rs:484 — src-tauri/src/cli/commands/config_openclaw.rs:484-497 | src-tauri/src/cli/tui/data.rs:2020-2036 | src-tauri/src/cli/tui/data.rs:2047-2063 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 6+ corresponding lines) src-tauri/src/cli/tui/ui/pricing.rs:233 — src-tauri/src/cli/tui/ui/pricing.rs:233-238 | src-tauri/src/cli/tui/ui/skills/discover.rs:134-139 | src-tauri/src/cli/tui/ui/usage.rs:1371-1376 — 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.
  • Edited copies of one member (3 members, 6+ corresponding lines) src-tauri/src/cli/commands/auth.rs:96 — src-tauri/src/cli/commands/auth.rs:96-101 | src-tauri/src/cli/commands/skills.rs:179-185 | src-tauri/src/cli/commands/update.rs:336-341 — 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.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 9+ corresponding lines) src-tauri/src/database/dao/failover.rs:153 — src-tauri/src/database/dao/failover.rs:153-164 | src-tauri/src/database/dao/proxy.rs:1184-1192 | src-tauri/src/session_manager/scan_cache_store.rs:619-627 — 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.
  • Edited copies of one member (3 members, 9+ corresponding lines) src-tauri/src/cli/tui/ui/forms/shared.rs:4 — src-tauri/src/cli/tui/ui/forms/shared.rs:4-12 | src-tauri/src/cli/tui/ui/sessions.rs:675-683 | src-tauri/src/cli/tui/ui/shared.rs:4-12 — 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 copy of a member (5 corresponding lines) · ×2
  • Edited copy of a member (5 corresponding lines) src-tauri/src/session_manager/paged_manifest.rs:2017 — src-tauri/src/session_manager/paged_manifest.rs:2017-2021 | src-tauri/src/session_manager/providers/codex.rs:245-249 — 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/openclaw_config.rs:862 — src-tauri/src/openclaw_config.rs:862-866 | src-tauri/src/opencode_config.rs:224-228 — 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.
D4 · Code Duplication · Duplicated block (20–23 lines × 2) · ×2
  • Duplicated block (20–23 lines × 2) src-tauri/src/cli/tui/ui/config.rs:2382 — src-tauri/src/cli/tui/ui/config.rs:2382-2401 | src-tauri/src/cli/tui/ui/config.rs:2647-2669 — 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/cli/tui/ui/config.rs:2647` 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 (20–23 lines × 2) src-tauri/src/cli/tui/ui/usage.rs:1020 — src-tauri/src/cli/tui/ui/usage.rs:1020-1039 | src-tauri/src/cli/tui/ui/usage.rs:1070-1092 — 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/cli/tui/ui/usage.rs:1020` 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.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×2
  • Duplicated block (20 lines × 2) src-tauri/src/services/coding_plan.rs:116 — src-tauri/src/services/coding_plan.rs:116-135 | src-tauri/src/services/coding_plan.rs:372-391 — 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:116` 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/proxy/providers/transform_gemini.rs:590 — src-tauri/src/proxy/providers/transform_gemini.rs:590-609 | src-tauri/src/proxy/providers/transform_gemini.rs:613-632 — 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:590` 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.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) src-tauri/src/daemon/migration.rs:473 — src-tauri/src/daemon/migration.rs:473-489 | src-tauri/src/daemon/migration.rs:538-553 — 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/daemon/migration.rs:473` 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 (16–17 lines × 2) src-tauri/src/proxy/providers/streaming.rs:237 — src-tauri/src/proxy/providers/streaming.rs:237-252 | src-tauri/src/proxy/providers/streaming.rs:288-304 — 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:237` 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.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) src-tauri/src/cli/commands/auth.rs:412 — src-tauri/src/cli/commands/auth.rs:412-426 | src-tauri/src/cli/commands/provider_inspect.rs:514-527 — before extracting anything, compare `src-tauri/src/cli/commands/auth.rs` and `src-tauri/src/cli/commands/provider_inspect.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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/cli/commands/auth.rs:412` 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 after the matched lines, `src-tauri/src/cli/commands/provider_inspect.rs:527` calls `highlight`, `Some` and `src-tauri/src/cli/commands/auth.rs:426` 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 (14–15 lines × 2) src-tauri/src/cli/tui/app/types.rs:4944 — src-tauri/src/cli/tui/app/types.rs:4944-4958 | src-tauri/src/cli/tui/app/types.rs:4994-5007 — 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/cli/tui/app/types.rs:4961` calls `SessionProjectPicker` and `src-tauri/src/cli/tui/app/types.rs:5008` 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.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) src-tauri/src/cli/commands/provider_input.rs:2872 — src-tauri/src/cli/commands/provider_input.rs:2872-2885 | src-tauri/src/cli/commands/provider_input.rs:3236-3249 | src-tauri/src/cli/commands/provider_input.rs:3443-3456 — 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/cli/commands/provider_input.rs:2872` 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/services/provider/mod.rs:1376 — src-tauri/src/services/provider/mod.rs:1376-1389 | src-tauri/src/services/provider/mod.rs:1417-1430 | src-tauri/src/services/provider/mod.rs:1578-1591 — 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:1376` 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.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×2
  • Duplicated block (12 lines × 4) src-tauri/src/cli/tui/ui/forms/mcp.rs:327 — src-tauri/src/cli/tui/ui/forms/mcp.rs:327-338 | src-tauri/src/cli/tui/ui/forms/prompt.rs:125-136 | src-tauri/src/cli/tui/ui/forms/s3.rs:102-113 | src-tauri/src/cli/tui/ui/forms/webdav.rs:88-99 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.rs:327` 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 × 4) src-tauri/src/session_manager/providers/claude.rs:58 — src-tauri/src/session_manager/providers/claude.rs:58-69 | src-tauri/src/session_manager/providers/codex.rs:684-695 | src-tauri/src/session_manager/providers/hermes.rs:758-769 | src-tauri/src/session_manager/providers/openclaw.rs:355-366 — 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 10 separate duplicated blocks between them, totalling at least 152 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.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×2
  • Duplicated block (11–12 lines × 3) src-tauri/src/cli/commands/config.rs:208 — src-tauri/src/cli/commands/config.rs:208-219 | src-tauri/src/cli/commands/config.rs:275-285 | src-tauri/src/cli/commands/config.rs:332-342 — 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/cli/commands/config.rs:208` 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 × 3) src-tauri/src/cli/tui/ui/forms/provider.rs:878 — src-tauri/src/cli/tui/ui/forms/provider.rs:878-889 | src-tauri/src/cli/tui/ui/forms/s3.rs:16-26 | src-tauri/src/cli/tui/ui/forms/webdav.rs:16-26 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/provider.rs` and `src-tauri/src/cli/tui/ui/forms/s3.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 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.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) src-tauri/src/cli/tui/ui/config.rs:1422 — src-tauri/src/cli/tui/ui/config.rs:1422-1431 | src-tauri/src/cli/tui/ui/config.rs:2317-2328 — 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/cli/tui/ui/config.rs:1422` 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–12 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1399 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1399-1408 | src-tauri/src/proxy/providers/copilot_auth.rs:511-522 — 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 8 separate duplicated blocks between them, totalling at least 110 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:1399` 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.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) src-tauri/src/cli/commands/provider_input.rs:3810 — src-tauri/src/cli/commands/provider_input.rs:3810-3818 | src-tauri/src/cli/commands/provider_input.rs:4475-4482 — 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/cli/commands/provider_input.rs:3810` 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/cli/tui/app/helpers.rs:1619 — src-tauri/src/cli/tui/app/helpers.rs:1619-1626 | src-tauri/src/cli/tui/app/helpers.rs:1656-1664 — 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/cli/tui/app/helpers.rs:1619` 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 `skills` to `&'a [crate::services::skill::Skill]` in one and `&'a [crate::services::skill::UnmanagedSkill]` 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.
D1 · Cyclomatic Complexity · TokenUsage · ×1
  • TokenUsage::from_claude_stream_events (cyclomatic 26) src-tauri/src/proxy/usage/parser.rs:323 — 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.
D1 · Cyclomatic Complexity · LiveSnapshot · ×1
  • LiveSnapshot::restore (cyclomatic 25) src-tauri/src/services/provider/live.rs:41 — LiveSnapshot::restore 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.
D1 · Cyclomatic Complexity · ProviderType · ×1
  • ProviderType::from_app_type_and_config (cyclomatic 20) src-tauri/src/proxy/providers/mod.rs:88 — ProviderType::from_app_type_and_config 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.
D1 · Cyclomatic Complexity · EditorState · ×1
  • EditorState::push_visible_line_segments (cyclomatic 19) src-tauri/src/cli/tui/app/editor_state.rs:393 — EditorState::push_visible_line_segments 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.
D1 · Cyclomatic Complexity · DotenvPatch · ×1
  • 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.
D1 · Cyclomatic Complexity · CodexChatHistoryStore · ×1
  • CodexChatHistoryStore::enrich_request (cyclomatic 18) src-tauri/src/proxy/providers/codex_chat_history.rs:89 — CodexChatHistoryStore::enrich_request 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.
D1 · Cyclomatic Complexity · StreamingOutcomeRecorder · ×1
  • StreamingOutcomeRecorder::finish (cyclomatic 18) src-tauri/src/proxy/response_handler.rs:209 — StreamingOutcomeRecorder::finish 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.
D1 · Cyclomatic Complexity · MultiAppConfig · ×1
  • MultiAppConfig::load (cyclomatic 16) src-tauri/src/app_config.rs:494 — MultiAppConfig::load 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.
D1 · Cyclomatic Complexity · TranscriptRemotePager · ×1
  • TranscriptRemotePager::refresh_source_if_pending (cyclomatic 16) src-tauri/src/cli/tui/app/types.rs:1535 — TranscriptRemotePager::refresh_source_if_pending 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.
D1 · Cyclomatic Complexity · JsonPatch · ×1
  • JsonPatch::apply_to (cyclomatic 16) src-tauri/src/live/patch/json.rs:41 — JsonPatch::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.
D1 · Cyclomatic Complexity · TomlPatch · ×1
  • 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.
D2 · Cognitive Complexity · TokenUsage · ×1
  • TokenUsage::from_claude_stream_events (cognitive 102) src-tauri/src/proxy/usage/parser.rs:323 — 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.
D2 · Cognitive Complexity · ProviderType · ×1
  • ProviderType::from_app_type_and_config (cognitive 42) src-tauri/src/proxy/providers/mod.rs:88 — ProviderType::from_app_type_and_config has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (37 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 25). 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.
D2 · Cognitive Complexity · CodexChatHistoryStore · ×1
  • CodexChatHistoryStore::enrich_request (cognitive 40) src-tauri/src/proxy/providers/codex_chat_history.rs:89 — CodexChatHistoryStore::enrich_request has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 2 (5 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 24). 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.
D2 · Cognitive Complexity · EditorState · ×1
  • EditorState::push_visible_line_segments (cognitive 34) src-tauri/src/cli/tui/app/editor_state.rs:393 — EditorState::push_visible_line_segments has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 2 (3 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · LiveSnapshot · ×1
  • LiveSnapshot::restore (cognitive 29) src-tauri/src/services/provider/live.rs:41 — LiveSnapshot::restore has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 3 (5 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.
D2 · Cognitive Complexity · StreamingOutcomeRecorder · ×1
  • StreamingOutcomeRecorder::finish (cognitive 28) src-tauri/src/proxy/response_handler.rs:209 — StreamingOutcomeRecorder::finish has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (27 pts), match/switch 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.
D2 · Cognitive Complexity · TranscriptRemotePager · ×1
  • TranscriptRemotePager::refresh_source_if_pending (cognitive 26) src-tauri/src/cli/tui/app/types.rs:1535 — TranscriptRemotePager::refresh_source_if_pending has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · DotenvPatch · ×1
  • 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.
D2 · Cognitive Complexity · JsonPatch · ×1
  • JsonPatch::apply_to (cognitive 24) src-tauri/src/live/patch/json.rs:41 — JsonPatch::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.
D2 · Cognitive Complexity · TomlPatch · ×1
  • 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.
D2 · Cognitive Complexity · AnthropicToResponsesState · ×1
  • AnthropicToResponsesState::close_block (cognitive 23) src-tauri/src/proxy/providers/streaming_codex_anthropic.rs:337 — 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.
D2 · Cognitive Complexity · OpenClawRenderModelPreview · ×1
  • OpenClawRenderModelPreview::from_data (cognitive 22) src-tauri/src/cli/tui/ui/config.rs:1733 — OpenClawRenderModelPreview::from_data has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 pts) (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.
D2 · Cognitive Complexity · PagedListState · ×1
  • PagedListState::wheel (cognitive 21) src-tauri/src/cli/tui/app/paged_list.rs:316 — PagedListState::wheel has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · ScanCacheStore · ×1
  • ScanCacheStore::delete_missing_for_provider_bounded (cognitive 21) src-tauri/src/session_manager/scan_cache_store.rs:374 — ScanCacheStore::delete_missing_for_provider_bounded has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 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.
D2 · Cognitive Complexity · PromptService · ×1
  • PromptService::enable_prompt (cognitive 20) src-tauri/src/services/prompt.rs:260 — PromptService::enable_prompt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (nesting depth added 10). 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.
D2 · Cognitive Complexity · StreamLogCollector · ×1
  • StreamLogCollector::record_chunk (cognitive 19) src-tauri/src/proxy/usage/parser.rs:155 — StreamLogCollector::record_chunk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 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.
D2 · Cognitive Complexity · ModelMapping · ×1
  • ModelMapping::map_model (cognitive 18) src-tauri/src/proxy/model_mapper.rs:51 — ModelMapping::map_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 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.
D2 · Cognitive Complexity · UsageLogPager · ×1
  • UsageLogPager::finish_request (cognitive 16) src-tauri/src/cli/tui/app/types.rs:495 — UsageLogPager::finish_request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 1 (2 pts), boolean chains 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.
D2 · Cognitive Complexity · ClaudeProjection · ×1
  • 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.
D2 · Cognitive Complexity · ProviderRouter · ×1
  • ProviderRouter::select_providers (cognitive 16) src-tauri/src/proxy/provider_router.rs:27 — ProviderRouter::select_providers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (2 pts), 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.
D2 · Cognitive Complexity · CopilotAuthManager · ×1
  • CopilotAuthManager::load_from_disk_sync (cognitive 16) src-tauri/src/proxy/providers/copilot_auth.rs:1389 — 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.
D2 · Cognitive Complexity · ConfigService · ×1
  • ConfigService::sync_codex_live (cognitive 16) src-tauri/src/services/config.rs:324 — ConfigService::sync_codex_live 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (5 members, 25 shared lines) · ×1
  • Near-duplicate member family (5 members, 25 shared lines) src-tauri/src/cli/tui/ui/forms/mcp.rs:282 — src-tauri/src/cli/tui/ui/forms/mcp.rs:282-370 | src-tauri/src/cli/tui/ui/forms/prompt.rs:72-165 | src-tauri/src/cli/tui/ui/forms/provider.rs:1596-1684 | src-tauri/src/cli/tui/ui/forms/s3.rs:58-142 | src-tauri/src/cli/tui/ui/forms/webdav.rs:51-129 — These 5 members are variants of one another: a block of 25 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 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 · Near-duplicate member family (4 members, 46 shared lines) · ×1
  • Near-duplicate member family (4 members, 46 shared lines) src-tauri/src/cli/tui/ui/forms/mcp.rs:282 — src-tauri/src/cli/tui/ui/forms/mcp.rs:282-370 | src-tauri/src/cli/tui/ui/forms/prompt.rs:72-165 | src-tauri/src/cli/tui/ui/forms/provider.rs:550-675 | src-tauri/src/cli/tui/ui/forms/provider.rs:1596-1684 — These 4 members are variants of one another: a block of 46 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 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 · Near-duplicate member pair (140 shared lines) · ×1
  • Near-duplicate member pair (140 shared lines) src-tauri/src/proxy/forwarder.rs:253 — src-tauri/src/proxy/forwarder.rs:253-455 | src-tauri/src/proxy/forwarder.rs:498-700 — These two members are variants of one another: 140 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (82 shared lines) · ×1
  • Near-duplicate member pair (82 shared lines) src-tauri/src/cli/tui/ui/config.rs:1409 — src-tauri/src/cli/tui/ui/config.rs:1409-1660 | src-tauri/src/cli/tui/ui/config.rs:2303-2680 — These two members are variants of one another: 82 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (80 shared lines) · ×1
  • Near-duplicate member pair (80 shared lines) src-tauri/src/session_manager/providers/claude.rs:235 — src-tauri/src/session_manager/providers/claude.rs:235-367 | src-tauri/src/session_manager/providers/codex.rs:866-991 — These two members are variants of one another: 80 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (66 shared lines) · ×1
  • Near-duplicate member pair (66 shared lines) src-tauri/src/cli/commands/provider.rs:1706 — src-tauri/src/cli/commands/provider.rs:1706-1868 | src-tauri/src/cli/commands/provider.rs:1986-2106 — These two members are variants of one another: 66 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (63 shared lines) · ×1
  • Near-duplicate member pair (63 shared lines) src-tauri/src/cli/commands/auth.rs:378 — src-tauri/src/cli/commands/auth.rs:378-490 | src-tauri/src/cli/commands/provider_inspect.rs:435-646 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (38 shared lines) · ×1
  • Near-duplicate member pair (38 shared lines) src-tauri/src/session_manager/providers/hermes.rs:902 — src-tauri/src/session_manager/providers/hermes.rs:902-966 | REDACTED:1296-1410 — These two members are variants of one another: 38 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (36 shared lines) · ×1
  • Near-duplicate member pair (36 shared lines) src-tauri/src/services/usage_stats.rs:498 — src-tauri/src/services/usage_stats.rs:498-619 | src-tauri/src/services/usage_stats.rs:630-755 — These two members are variants of one another: 36 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (28 shared lines) · ×1
  • Near-duplicate member pair (28 shared lines) src-tauri/src/session_manager/providers/hermes.rs:415 — src-tauri/src/session_manager/providers/hermes.rs:415-492 | REDACTED:594-714 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (27 shared lines) · ×1
  • Near-duplicate member pair (27 shared lines) src-tauri/src/cli/tui/ui/forms/provider.rs:872 — src-tauri/src/cli/tui/ui/forms/provider.rs:872-946 | src-tauri/src/cli/tui/ui/forms/provider.rs:954-1034 — These two members are variants of one another: 27 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (104 corresponding lines) · ×1
  • Edited copy of a member (104 corresponding lines) src-tauri/src/cli/tui/form/provider_state.rs:2683 — src-tauri/src/cli/tui/form/provider_state.rs:2683-2786 | src-tauri/src/cli/tui/form/provider_state.rs:2791-2903 — These two members are one piece of code written twice and then edited apart: 104 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 (103 corresponding lines) · ×1
  • Edited copy of a member (103 corresponding lines) src-tauri/src/services/usage_stats.rs:1045 — src-tauri/src/services/usage_stats.rs:1045-1163 | src-tauri/src/services/usage_stats.rs:1171-1273 — These two members are one piece of code written twice and then edited apart: 103 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 (97 corresponding lines) · ×1
  • Edited copy of a member (97 corresponding lines) src-tauri/src/services/coding_plan.rs:99 — src-tauri/src/services/coding_plan.rs:99-195 | src-tauri/src/services/coding_plan.rs:348-467 — These two members are one piece of code written twice and then edited apart: 97 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 (81 corresponding lines) · ×1
  • Edited copy of a member (81 corresponding lines) src-tauri/src/cli/commands/provider_input.rs:2863 — src-tauri/src/cli/commands/provider_input.rs:2863-2963 | src-tauri/src/cli/commands/provider_input.rs:3206-3286 — These two members are one piece of code written twice and then edited apart: 81 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 (111 corresponding lines) · ×1
  • Edited copy of a member (111 corresponding lines) src-tauri/src/services/session_usage.rs:1248 — src-tauri/src/services/session_usage.rs:1248-1358 | src-tauri/src/services/session_usage_gemini.rs:305-450 — These two members are one piece of code written twice and then edited apart: 111 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 (90 corresponding lines) · ×1
  • Edited copy of a member (90 corresponding lines) src-tauri/src/cli/tui/ui/forms/provider.rs:1200 — src-tauri/src/cli/tui/ui/forms/provider.rs:1200-1289 | src-tauri/src/cli/tui/ui/forms/provider.rs:1297-1426 — These two members are one piece of code written twice and then edited apart: 90 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 (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) src-tauri/src/live/patch/json.rs:41 — src-tauri/src/live/patch/json.rs:41-101 | src-tauri/src/live/patch/toml.rs:33-102 — These two members are one piece of code written twice and then edited apart: 61 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 (67 corresponding lines) · ×1
  • Edited copy of a member (67 corresponding lines) src-tauri/src/session_manager/transcript.rs:965 — src-tauri/src/session_manager/transcript.rs:965-1031 | src-tauri/src/session_manager/transcript.rs:1064-1135 — These two members are one piece of code written twice and then edited apart: 67 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, 58+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 58+ corresponding lines) src-tauri/src/session_manager/providers/claude.rs:112 — src-tauri/src/session_manager/providers/claude.rs:112-179 | src-tauri/src/session_manager/providers/codex.rs:751-828 | src-tauri/src/session_manager/providers/hermes.rs:839-896 | src-tauri/src/session_manager/providers/openclaw.rs:401-459 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 58 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 (72 corresponding lines) · ×1
  • Edited copy of a member (72 corresponding lines) src-tauri/src/services/coding_plan.rs:268 — src-tauri/src/services/coding_plan.rs:268-344 | src-tauri/src/services/coding_plan.rs:515-586 — These two members are one piece of code written twice and then edited apart: 72 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 (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) src-tauri/src/config.rs:584 — src-tauri/src/config.rs:584-647 | src-tauri/src/database/mod.rs:281-331 — These two members are one piece of code written twice and then edited apart: 51 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 (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) src-tauri/src/cli/commands/provider_input.rs:3773 — src-tauri/src/cli/commands/provider_input.rs:3773-3821 | src-tauri/src/cli/commands/provider_input.rs:4461-4516 — These two members are one piece of code written twice and then edited apart: 49 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/database/dao/proxy.rs:328 — src-tauri/src/database/dao/proxy.rs:328-369 | src-tauri/src/database/dao/proxy.rs:375-412 — 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 (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) src-tauri/src/cli/tui/ui/overlay/pickers.rs:1971 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:1971-2033 | src-tauri/src/cli/tui/ui/shared.rs:391-447 — These two members are one piece of code written twice and then edited apart: 57 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:905 — src-tauri/src/proxy/providers/copilot_auth.rs:905-959 | src-tauri/src/proxy/providers/copilot_auth.rs:1019-1068 — 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 (62 corresponding lines) · ×1
  • Edited copy of a member (62 corresponding lines) src-tauri/src/cli/tui/runtime_systems/workers.rs:2842 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2842-2903 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3351-3413 — 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 copies of one member (4 members, 47+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 47+ corresponding lines) src-tauri/src/services/balance.rs:140 — src-tauri/src/services/balance.rs:140-186 | src-tauri/src/services/balance.rs:192-250 | src-tauri/src/services/balance.rs:256-309 | src-tauri/src/services/balance.rs:316-367 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 47 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 (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:850 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:850-897 | src-tauri/src/proxy/providers/transform_responses.rs:188-224 — 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 copy of a member (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) src-tauri/src/deeplink/parser.rs:185 — src-tauri/src/deeplink/parser.rs:185-249 | src-tauri/src/deeplink/parser.rs:256-315 — These two members are one piece of code written twice and then edited apart: 60 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, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) src-tauri/src/cli/tui/ui/config.rs:861 — src-tauri/src/cli/tui/ui/config.rs:861-890 | src-tauri/src/cli/tui/ui/config.rs:1353-1394 | src-tauri/src/cli/tui/ui/config.rs:2247-2288 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 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 (58 corresponding lines) · ×1
  • Edited copy of a member (58 corresponding lines) src-tauri/src/services/subscription.rs:184 — src-tauri/src/services/subscription.rs:184-241 | src-tauri/src/services/subscription.rs:476-539 — These two members are one piece of code written twice and then edited apart: 58 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 (42 corresponding lines) · ×1
  • Edited copy of a member (42 corresponding lines) src-tauri/src/services/s3_sync.rs:92 — src-tauri/src/services/s3_sync.rs:92-139 | REDACTED:125-166 — These two members are one piece of code written twice and then edited apart: 42 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) · ×1
  • Edited copy of a member (45 corresponding lines) src-tauri/src/cli/tui/terminal.rs:263 — src-tauri/src/cli/tui/terminal.rs:263-307 | src-tauri/src/cli/tui/terminal.rs:309-355 — 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 copies of one member (3 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 24+ corresponding lines) src-tauri/src/database/dao/proxy.rs:78 — src-tauri/src/database/dao/proxy.rs:78-107 | src-tauri/src/database/dao/proxy.rs:110-133 | src-tauri/src/database/dao/proxy.rs:939-970 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 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, 22+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 22+ corresponding lines) src-tauri/src/cli/tui/runtime_actions/config.rs:527 — src-tauri/src/cli/tui/runtime_actions/config.rs:527-550 | src-tauri/src/cli/tui/runtime_actions/config.rs:556-577 | src-tauri/src/cli/tui/runtime_actions/helpers.rs:81-116 | src-tauri/src/cli/tui/runtime_actions/updates.rs:8-34 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 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, 23+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 23+ corresponding lines) src-tauri/src/cli/tui/runtime_actions/settings.rs:409 — src-tauri/src/cli/tui/runtime_actions/settings.rs:409-431 | src-tauri/src/cli/tui/runtime_actions/settings.rs:437-461 | src-tauri/src/cli/tui/runtime_actions/settings.rs:467-491 | src-tauri/src/cli/tui/runtime_actions/settings.rs:497-521 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 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 (3 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 17+ corresponding lines) src-tauri/src/proxy/error.rs:135 — src-tauri/src/proxy/error.rs:135-151 | src-tauri/src/proxy/handlers.rs:1004-1020 | src-tauri/src/proxy/response.rs:874-890 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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/services/subscription.rs:161 — src-tauri/src/services/subscription.rs:161-180 | src-tauri/src/services/subscription.rs:454-474 | src-tauri/src/services/subscription.rs:1122-1143 — 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 (4 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 15+ corresponding lines) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1889 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1889-1903 | src-tauri/src/proxy/providers/copilot_auth.rs:1070-1084 | src-tauri/src/proxy/providers/copilot_auth.rs:1225-1239 | src-tauri/src/proxy/switch_lock.rs:20-36 — 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.
D4 · Code Duplication · Edited copies of one member (7 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 13+ corresponding lines) src-tauri/src/cli/tui/app/helpers.rs:1466 — src-tauri/src/cli/tui/app/helpers.rs:1466-1482 | src-tauri/src/cli/tui/app/helpers.rs:1548-1560 | src-tauri/src/cli/tui/app/helpers.rs:1582-1594 | src-tauri/src/cli/tui/app/helpers.rs:1599-1613 | src-tauri/src/cli/tui/ui/mcp.rs:3-15 | src-tauri/src/cli/tui/ui/providers.rs:72-88 | src-tauri/src/cli/tui/ui/skills/helpers.rs:6-20 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 11+ corresponding lines) src-tauri/src/proxy/error.rs:210 — src-tauri/src/proxy/error.rs:210-220 | src-tauri/src/proxy/handlers.rs:1047-1060 | src-tauri/src/proxy/response/error_summary.rs:43-54 — 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, 10+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 10+ corresponding lines) src-tauri/src/session_manager/providers/claude.rs:220 — src-tauri/src/session_manager/providers/claude.rs:220-233 | src-tauri/src/session_manager/providers/codex.rs:855-864 | src-tauri/src/session_manager/providers/hermes.rs:616-626 | src-tauri/src/session_manager/providers/openclaw.rs:504-513 — 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 copies of one member (6 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 7+ corresponding lines) src-tauri/src/cli/claude_temp_launch.rs:271 — src-tauri/src/cli/claude_temp_launch.rs:271-277 | src-tauri/src/cli/codex_temp_launch.rs:312-318 | src-tauri/src/cli/commands/update.rs:1302-1308 | src-tauri/src/services/skill.rs:1978-1985 | REDACTED:1939-1945 | REDACTED:1947-1953 — These 6 members are one piece of code written 6 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 6 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/cli/commands/config_openclaw.rs:652 — src-tauri/src/cli/commands/config_openclaw.rs:652-660 | src-tauri/src/cli/commands/config_openclaw.rs:662-670 | src-tauri/src/cli/commands/config_openclaw.rs:672-685 | src-tauri/src/cli/commands/config_openclaw.rs:687-700 | src-tauri/src/cli/commands/config_openclaw.rs:702-709 — 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 (4 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 7+ corresponding lines) src-tauri/src/cli/tui/runtime_actions/skills.rs:20 — src-tauri/src/cli/tui/runtime_actions/skills.rs:20-28 | src-tauri/src/cli/tui/runtime_actions/skills.rs:146-152 | src-tauri/src/cli/tui/runtime_actions/skills.rs:157-165 | src-tauri/src/cli/tui/runtime_actions/skills.rs:252-259 — 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 (5 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 7+ corresponding lines) src-tauri/src/database/dao/proxy.rs:57 — src-tauri/src/database/dao/proxy.rs:57-73 | src-tauri/src/database/dao/proxy.rs:706-716 | src-tauri/src/database/dao/proxy.rs:1027-1035 | src-tauri/src/database/mod.rs:804-810 | src-tauri/src/database/mod.rs:813-819 — 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, 4+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 4+ corresponding lines) src-tauri/src/hermes_config.rs:115 — src-tauri/src/hermes_config.rs:115-118 | src-tauri/src/openclaw_config.rs:57-60 | src-tauri/src/services/session_usage.rs:81-84 | src-tauri/src/services/state_coordination.rs:10-13 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (73–75 lines × 2) · ×1
  • Duplicated block (73–75 lines × 2) src-tauri/src/cli/tui/form/provider_state.rs:2711 — src-tauri/src/cli/tui/form/provider_state.rs:2711-2785 | src-tauri/src/cli/tui/form/provider_state.rs:2829-2901 — 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.
D4 · Code Duplication · Duplicated block (65 lines × 2) · ×1
  • Duplicated block (65 lines × 2) src-tauri/src/cli/tui/app/form_handlers/provider.rs:1013 — src-tauri/src/cli/tui/app/form_handlers/provider.rs:1013-1077 | src-tauri/src/cli/tui/app/form_handlers/provider.rs:1157-1221 — 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/cli/tui/app/form_handlers/provider.rs:1013` 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.
D4 · Code Duplication · Duplicated block (41–48 lines × 2) · ×1
  • Duplicated block (41–48 lines × 2) src-tauri/src/cli/commands/provider.rs:1755 — src-tauri/src/cli/commands/provider.rs:1755-1802 | src-tauri/src/cli/commands/provider.rs:2017-2057 — 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/cli/commands/provider.rs:1755` 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.
D4 · Code Duplication · Duplicated block (45–46 lines × 2) · ×1
  • Duplicated block (45–46 lines × 2) src-tauri/src/cli/tui/ui/config.rs:1433 — src-tauri/src/cli/tui/ui/config.rs:1433-1477 | src-tauri/src/cli/tui/ui/config.rs:2331-2376 — 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/cli/tui/ui/config.rs:1433` 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.
D4 · Code Duplication · Duplicated block (45 lines × 2) · ×1
  • Duplicated block (45 lines × 2) src-tauri/src/cli/tui/runtime_systems/workers.rs:3773 — src-tauri/src/cli/tui/runtime_systems/workers.rs:3773-3817 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3820-3864 — 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.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) src-tauri/src/proxy/forwarder.rs:412 — src-tauri/src/proxy/forwarder.rs:412-455 | src-tauri/src/proxy/forwarder.rs:657-700 — 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:412` 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.
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) src-tauri/src/proxy/providers/codex_oauth_auth.rs:1918 — src-tauri/src/proxy/providers/codex_oauth_auth.rs:1918-1958 | src-tauri/src/proxy/providers/copilot_auth.rs:1259-1299 — 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 8 separate duplicated blocks between them, totalling at least 110 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:1918` 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.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) src-tauri/src/proxy/forwarder.rs:254 — src-tauri/src/proxy/forwarder.rs:254-292 | src-tauri/src/proxy/forwarder.rs:499-537 — 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:254` 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.
D4 · Code Duplication · Duplicated block (26–33 lines × 3) · ×1
  • Duplicated block (26–33 lines × 3) src-tauri/src/cli/tui/ui/pricing.rs:12 — src-tauri/src/cli/tui/ui/pricing.rs:12-44 | src-tauri/src/cli/tui/ui/usage.rs:55-87 | src-tauri/src/cli/tui/ui/usage.rs:107-132 — before extracting anything, compare `src-tauri/src/cli/tui/ui/pricing.rs` and `src-tauri/src/cli/tui/ui/usage.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) src-tauri/src/cli/tui/mod.rs:3317 — src-tauri/src/cli/tui/mod.rs:3317-3348 | src-tauri/src/cli/tui/mod.rs:3370-3401 — 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.
D4 · Code Duplication · Duplicated block (31–32 lines × 2) · ×1
  • Duplicated block (31–32 lines × 2) src-tauri/src/cli/tui/mod.rs:3424 — src-tauri/src/cli/tui/mod.rs:3424-3454 | src-tauri/src/cli/tui/mod.rs:3883-3914 — 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/cli/tui/mod.rs:3424` 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.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) src-tauri/src/codex_history_migration.rs:973 — src-tauri/src/codex_history_migration.rs:973-1001 | src-tauri/src/codex_history_migration.rs:1043-1073 — 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.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) src-tauri/src/proxy/forwarder.rs:310 — src-tauri/src/proxy/forwarder.rs:310-340 | src-tauri/src/proxy/forwarder.rs:555-585 — 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:310` 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.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs:725 — src-tauri/src/cli/tui/runtime_actions/editor.rs:725-750 | src-tauri/src/cli/tui/runtime_actions/editor.rs:967-993 — 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/cli/tui/runtime_actions/editor.rs:725` 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.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) src-tauri/src/services/proxy.rs:3020 — src-tauri/src/services/proxy.rs:3020-3046 | src-tauri/src/services/proxy.rs:3737-3763 — 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/proxy.rs:3020` 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.
D4 · Code Duplication · Duplicated block (26 lines × 3) · ×1
  • Duplicated block (26 lines × 3) src-tauri/src/cli/commands/hermes.rs:219 — src-tauri/src/cli/commands/hermes.rs:219-244 | src-tauri/src/cli/tui/runtime_actions/config.rs:431-456 | src-tauri/src/commands/workspace.rs:448-473 — 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/cli/commands/hermes.rs:219` 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/cli/commands/hermes.rs:215` calls `var_os`, `is_some`, `Ok` and `src-tauri/src/commands/workspace.rs:447` 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.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) src-tauri/src/claude_mcp.rs:313 — src-tauri/src/claude_mcp.rs:313-336 | src-tauri/src/gemini_mcp.rs:99-123 — before extracting anything, compare `src-tauri/src/claude_mcp.rs` and `src-tauri/src/gemini_mcp.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/claude_mcp.rs:313` 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.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×1
  • Duplicated block (25 lines × 2) src-tauri/src/cli/tui/ui/forms/mcp.rs:77 — src-tauri/src/cli/tui/ui/forms/mcp.rs:77-101 | src-tauri/src/cli/tui/ui/forms/provider.rs:502-526 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 175 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/cli/tui/ui/forms/mcp.rs:77` 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.
D4 · Code Duplication · Duplicated block (24 lines × 5) · ×1
  • Duplicated block (24 lines × 5) src-tauri/src/services/balance.rs:73 — src-tauri/src/services/balance.rs:73-96 | src-tauri/src/services/balance.rs:145-168 | src-tauri/src/services/balance.rs:204-227 | src-tauri/src/services/balance.rs:261-284 | src-tauri/src/services/balance.rs:321-344 — 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/services/balance.rs:73` 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.
D4 · Code Duplication · Duplicated block (50 lines × 2) · ×1
  • Duplicated block (50 lines × 2) src-tauri/src/cli/tui/mod.rs:3711 — src-tauri/src/cli/tui/mod.rs:3711-3760 | src-tauri/src/cli/tui/mod.rs:3768-3817 — 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/cli/tui/mod.rs:3711` 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.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs:906 — src-tauri/src/cli/tui/ui/forms/provider.rs:906-939 | src-tauri/src/cli/tui/ui/forms/provider.rs:1142-1175 — 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.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×1
  • Duplicated block (22–23 lines × 2) src-tauri/src/config.rs:725 — src-tauri/src/config.rs:725-747 | src-tauri/src/database/mod.rs:257-278 — before extracting anything, compare `src-tauri/src/config.rs` and `src-tauri/src/database/mod.rs` as WHOLE FILES: this scan already matched 3 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. 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/config.rs:725` 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.
D4 · Code Duplication · Duplicated block (16–22 lines × 4) · ×1
  • Duplicated block (16–22 lines × 4) src-tauri/src/cli/tui/ui/config.rs:3068 — src-tauri/src/cli/tui/ui/config.rs:3068-3083 | src-tauri/src/cli/tui/ui/config.rs:3241-3262 | src-tauri/src/cli/tui/ui/config.rs:3314-3334 | src-tauri/src/cli/tui/ui/skills/repos.rs:20-41 — before extracting anything, compare `src-tauri/src/cli/tui/ui/config.rs` and `src-tauri/src/cli/tui/ui/skills/repos.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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.
D4 · Code Duplication · Duplicated block (20–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) src-tauri/src/cli/tui/ui/config.rs:958 — src-tauri/src/cli/tui/ui/config.rs:958-978 | src-tauri/src/cli/tui/ui/config.rs:1434-1453 | src-tauri/src/cli/tui/ui/config.rs:2333-2352 — 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/cli/tui/ui/config.rs:958` 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.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) src-tauri/src/cli/tui/ui/usage.rs:204 — src-tauri/src/cli/tui/ui/usage.rs:204-224 | src-tauri/src/cli/tui/ui/usage.rs:227-246 — 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/cli/tui/ui/usage.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/cli/tui/ui/usage.rs:225` calls `render_usage_metric_row`, `usage_tertiary_metrics` and `src-tauri/src/cli/tui/ui/usage.rs:247` 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.
D4 · Code Duplication · Duplicated block (19–20 lines × 4) · ×1
  • Duplicated block (19–20 lines × 4) src-tauri/src/cli/tui/ui/forms/mcp.rs:293 — src-tauri/src/cli/tui/ui/forms/mcp.rs:293-312 | src-tauri/src/cli/tui/ui/forms/provider.rs:1607-1626 | src-tauri/src/cli/tui/ui/forms/s3.rs:69-88 | src-tauri/src/cli/tui/ui/forms/webdav.rs:61-79 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 175 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.
D4 · Code Duplication · Duplicated block (19–20 lines × 3) · ×1
  • Duplicated block (19–20 lines × 3) src-tauri/src/services/session_usage.rs:1298 — src-tauri/src/services/session_usage.rs:1298-1316 | src-tauri/src/services/session_usage_codex.rs:2007-2025 | src-tauri/src/services/session_usage_gemini.rs:366-385 — before extracting anything, compare `src-tauri/src/services/session_usage.rs` and `src-tauri/src/services/session_usage_codex.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 84 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/session_usage.rs:1298` 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.
D4 · Code Duplication · Duplicated block (25–28 lines × 2) · ×1
  • Duplicated block (25–28 lines × 2) src-tauri/src/cli/tui/ui/config.rs:4128 — src-tauri/src/cli/tui/ui/config.rs:4128-4155 | src-tauri/src/cli/tui/ui/config.rs:4244-4268 — 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/cli/tui/ui/config.rs:4128` 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.
D4 · Code Duplication · Duplicated block (12–19 lines × 2) · ×1
  • Duplicated block (12–19 lines × 2) src-tauri/src/cli/tui/form/provider_state.rs:1359 — src-tauri/src/cli/tui/form/provider_state.rs:1359-1377 | src-tauri/src/cli/tui/form/provider_state.rs:1410-1421 — 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/cli/tui/form/provider_state.rs:1359` 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/cli/tui/form/provider_state.rs:1409` calls `validate_common_config_snippet_for_form` and `src-tauri/src/cli/tui/form/provider_state.rs:1355` 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.
D4 · Code Duplication · Duplicated block (16–19 lines × 2) · ×1
  • Duplicated block (16–19 lines × 2) src-tauri/src/cli/tui/ui/config.rs:1480 — src-tauri/src/cli/tui/ui/config.rs:1480-1495 | src-tauri/src/cli/tui/ui/config.rs:1625-1643 — 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.
D4 · Code Duplication · Duplicated block (21–29 lines × 2) · ×1
  • Duplicated block (21–29 lines × 2) src-tauri/src/proxy/providers/claude.rs:472 — src-tauri/src/proxy/providers/claude.rs:472-500 | src-tauri/src/proxy/providers/gemini.rs:141-161 — 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/claude.rs:472` 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.
D4 · Code Duplication · Duplicated block (13–19 lines × 2) · ×1
  • Duplicated block (13–19 lines × 2) src-tauri/src/proxy/providers/transform.rs:548 — src-tauri/src/proxy/providers/transform.rs:548-560 | src-tauri/src/proxy/providers/transform_codex_chat.rs:1213-1231 — 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:548` 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.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) src-tauri/src/cli/tui/ui/forms/mcp.rs:353 — src-tauri/src/cli/tui/ui/forms/mcp.rs:353-370 | src-tauri/src/cli/tui/ui/forms/prompt.rs:148-165 | src-tauri/src/cli/tui/ui/forms/provider.rs:658-675 | src-tauri/src/cli/tui/ui/forms/provider.rs:1667-1684 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.rs:353` 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.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1537 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1537-1551 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1684-1701 — 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/cli/tui/app/overlay_handlers/pickers.rs:1537` 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.
D4 · Code Duplication · Duplicated block (10–17 lines × 5) · ×1
  • Duplicated block (10–17 lines × 5) src-tauri/src/cli/tui/ui/config.rs:3067 — src-tauri/src/cli/tui/ui/config.rs:3067-3078 | src-tauri/src/cli/tui/ui/config.rs:3240-3255 | src-tauri/src/cli/tui/ui/config.rs:3313-3328 | src-tauri/src/cli/tui/ui/config.rs:4271-4280 | src-tauri/src/cli/tui/ui/skills/repos.rs:19-35 — before extracting anything, compare `src-tauri/src/cli/tui/ui/config.rs` and `src-tauri/src/cli/tui/ui/skills/repos.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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/cli/tui/ui/config.rs:3067` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/cli/tui/ui/config.rs:3257` calls `tui_key_create`, `tui_key_delete` and `src-tauri/src/cli/tui/ui/config.rs:3080` 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.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) src-tauri/src/cli/commands/provider.rs:122 — src-tauri/src/cli/commands/provider.rs:122-138 | src-tauri/src/proxy/providers/codex.rs:38-54 | src-tauri/src/proxy/providers/codex.rs:90-106 — 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/cli/commands/provider.rs:122` 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.
D4 · Code Duplication · Duplicated block (31 lines × 3) · ×1
  • Duplicated block (31 lines × 3) src-tauri/src/services/coding_plan.rs:106 — src-tauri/src/services/coding_plan.rs:106-136 | src-tauri/src/services/coding_plan.rs:277-307 | src-tauri/src/services/coding_plan.rs:362-392 — 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: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.
D4 · Code Duplication · Duplicated block (16–17 lines × 3) · ×1
  • Duplicated block (16–17 lines × 3) src-tauri/src/services/usage_stats.rs:506 — src-tauri/src/services/usage_stats.rs:506-522 | src-tauri/src/services/usage_stats.rs:1051-1066 | src-tauri/src/services/usage_stats.rs:1177-1192 — 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/usage_stats.rs:506` 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.
D4 · Code Duplication · Duplicated block (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) src-tauri/src/services/session_usage_codex.rs:734 — src-tauri/src/services/session_usage_codex.rs:734-746 | src-tauri/src/services/session_usage_codex.rs:1774-1790 — 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_codex.rs:734` 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.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) src-tauri/src/services/usage_stats.rs:584 — src-tauri/src/services/usage_stats.rs:584-603 | src-tauri/src/services/usage_stats.rs:705-723 — 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.
D4 · Code Duplication · Duplicated block (26–29 lines × 2) · ×1
  • Duplicated block (26–29 lines × 2) src-tauri/src/session_manager/providers/claude.rs:279 — src-tauri/src/session_manager/providers/claude.rs:279-307 | src-tauri/src/session_manager/providers/codex.rs:917-942 — 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 10 separate duplicated blocks between them, totalling at least 152 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:279` 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.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) src-tauri/src/session_manager/providers/hermes.rs:470 — src-tauri/src/session_manager/providers/hermes.rs:470-484 | REDACTED:670-686 — before extracting anything, compare `src-tauri/src/session_manager/providers/hermes.rs` and `REDACTED` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 159 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:470` 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.
D4 · Code Duplication · Duplicated block (12–16 lines × 3) · ×1
  • Duplicated block (12–16 lines × 3) src-tauri/src/proxy/providers/streaming.rs:202 — src-tauri/src/proxy/providers/streaming.rs:202-217 | src-tauri/src/proxy/providers/streaming_gemini.rs:313-324 | src-tauri/src/proxy/providers/streaming_gemini.rs:425-436 — 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/proxy/providers/streaming.rs:202` 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.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) src-tauri/src/proxy/cache_injector.rs:19 — src-tauri/src/proxy/cache_injector.rs:19-33 | src-tauri/src/proxy/cache_injector.rs:41-56 — 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:19` 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.
D4 · Code Duplication · Duplicated block (9–15 lines × 13) · ×1
  • Duplicated block (9–15 lines × 13) src-tauri/src/cli/tui/ui/config.rs:4190 — src-tauri/src/cli/tui/ui/config.rs:4190-4199 | src-tauri/src/cli/tui/ui/config.rs:4285-4293 | src-tauri/src/cli/tui/ui/forms/mcp.rs:345-353 | src-tauri/src/cli/tui/ui/forms/prompt.rs:139-148 | src-tauri/src/cli/tui/ui/forms/provider.rs:650-658 | src-tauri/src/cli/tui/ui/forms/provider.rs:932-941 | src-tauri/src/cli/tui/ui/forms/provider.rs:1019-1027 | src-tauri/src/cli/tui/ui/forms/provider.rs:1168-1177 | src-tauri/src/cli/tui/ui/forms/provider.rs:1659-1667 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2305-2319 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2514-2527 | src-tauri/src/cli/tui/ui/skills/discover.rs:116-129 | src-tauri/src/cli/tui/ui/skills/repos.rs:95-108 — before extracting anything, compare `src-tauri/src/cli/tui/ui/config.rs` and `src-tauri/src/cli/tui/ui/skills/repos.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/cli/tui/ui/forms/provider.rs:1178` calls `is_empty` and `src-tauri/src/cli/tui/ui/forms/provider.rs:1028` 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.
D4 · Code Duplication · Duplicated block (13–15 lines × 6) · ×1
  • Duplicated block (13–15 lines × 6) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:420 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:420-432 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1538-1552 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1586-1598 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1621-1633 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1688-1702 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1742-1756 — 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/cli/tui/app/overlay_handlers/pickers.rs:420` 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.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) src-tauri/src/session_manager/providers/claude.rs:150 — src-tauri/src/session_manager/providers/claude.rs:150-164 | src-tauri/src/session_manager/providers/codex.rs:800-814 | src-tauri/src/session_manager/providers/hermes.rs:871-885 | src-tauri/src/session_manager/providers/openclaw.rs:431-445 — 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 10 separate duplicated blocks between them, totalling at least 152 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 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.
D4 · Code Duplication · Duplicated block (11–15 lines × 2) · ×1
  • Duplicated block (11–15 lines × 2) src-tauri/src/daemon/supervisor.rs:632 — src-tauri/src/daemon/supervisor.rs:632-642 | src-tauri/src/daemon/supervisor.rs:751-765 — 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/daemon/supervisor.rs:632` 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/daemon/supervisor.rs:750` calls `plan_stop_all_workers` and `src-tauri/src/daemon/supervisor.rs:630` 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.
D4 · Code Duplication · Duplicated block (12–14 lines × 4) · ×1
  • Duplicated block (12–14 lines × 4) src-tauri/src/services/usage_stats.rs:499 — src-tauri/src/services/usage_stats.rs:499-512 | src-tauri/src/services/usage_stats.rs:631-642 | src-tauri/src/services/usage_stats.rs:1046-1057 | src-tauri/src/services/usage_stats.rs:1172-1183 — 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.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) src-tauri/src/cli/tui/ui/providers.rs:133 — src-tauri/src/cli/tui/ui/providers.rs:133-145 | src-tauri/src/cli/tui/ui/sessions.rs:703-715 | src-tauri/src/cli/tui/ui/shared.rs:544-557 — 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/cli/tui/ui/providers.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.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) src-tauri/src/cli/tui/runtime_systems/workers.rs:2998 — src-tauri/src/cli/tui/runtime_systems/workers.rs:2998-3011 | src-tauri/src/cli/tui/runtime_systems/workers.rs:3039-3050 — 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/cli/tui/runtime_systems/workers.rs:2998` 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) src-tauri/src/services/subscription.rs:144 — src-tauri/src/services/subscription.rs:144-156 | src-tauri/src/services/subscription.rs:438-449 | src-tauri/src/services/subscription.rs:1044-1056 — 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/subscription.rs:144` 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.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) src-tauri/src/cli/tui/runtime_actions/editor.rs:1066 — src-tauri/src/cli/tui/runtime_actions/editor.rs:1066-1078 | src-tauri/src/cli/tui/runtime_actions/editor.rs:1145-1153 — 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/cli/tui/runtime_actions/editor.rs:1066` 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.
D4 · Code Duplication · Duplicated block (15–19 lines × 2) · ×1
  • Duplicated block (15–19 lines × 2) src-tauri/src/cli/tui/ui/forms/mcp.rs:32 — src-tauri/src/cli/tui/ui/forms/mcp.rs:32-50 | src-tauri/src/cli/tui/ui/forms/prompt.rs:22-36 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.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.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:822 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:822-833 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1544-1555 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1590-1601 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1625-1636 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1694-1705 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:819` calls `min` and `src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1541` 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.
D4 · Code Duplication · Duplicated block (10–12 lines × 3) · ×1
  • Duplicated block (10–12 lines × 3) src-tauri/src/cli/tui/ui/forms/prompt.rs:16 — src-tauri/src/cli/tui/ui/forms/prompt.rs:16-25 | src-tauri/src/cli/tui/ui/forms/provider.rs:455-466 | src-tauri/src/cli/tui/ui/forms/provider.rs:1302-1311 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/prompt.rs` and `src-tauri/src/cli/tui/ui/forms/provider.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 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/cli/tui/ui/forms/prompt.rs:16` 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.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) src-tauri/src/cli/tui/runtime_systems/types.rs:934 — src-tauri/src/cli/tui/runtime_systems/types.rs:934-944 | src-tauri/src/services/provider/models.rs:61-73 — before extracting anything, compare `src-tauri/src/cli/tui/runtime_systems/types.rs` and `src-tauri/src/services/provider/models.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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/cli/tui/runtime_systems/types.rs:934` 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.
D4 · Code Duplication · Duplicated block (7–12 lines × 2) · ×1
  • Duplicated block (7–12 lines × 2) src-tauri/src/cli/tui/ui/forms/provider.rs:883 — src-tauri/src/cli/tui/ui/forms/provider.rs:883-889 | src-tauri/src/cli/tui/ui/forms/provider.rs:1305-1316 — 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/cli/tui/ui/forms/provider.rs:1305` 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 10) · ×1
  • Duplicated block (10–11 lines × 10) src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:423 — src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:423-433 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:496-505 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:598-607 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:776-785 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:821-830 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:875-884 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1543-1552 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1589-1598 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1624-1633 | src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:1693-1702 — all 10 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/cli/tui/app/overlay_handlers/pickers.rs:423` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:819` calls `min` and `src-tauri/src/cli/tui/app/overlay_handlers/pickers.rs:421` 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 5) · ×1
  • Duplicated block (10–11 lines × 5) src-tauri/src/session_manager/providers/claude.rs:156 — src-tauri/src/session_manager/providers/claude.rs:156-165 | src-tauri/src/session_manager/providers/codex.rs:806-815 | src-tauri/src/session_manager/providers/hermes.rs:877-886 | src-tauri/src/session_manager/providers/openclaw.rs:437-446 | src-tauri/src/session_manager/providers/pi.rs:513-523 — 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 10 separate duplicated blocks between them, totalling at least 152 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:156` 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/session_manager/providers/codex.rs:816` calls `is_cancelled` and `src-tauri/src/session_manager/providers/hermes.rs:887` 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.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) src-tauri/src/proxy/providers/streaming.rs:236 — src-tauri/src/proxy/providers/streaming.rs:236-246 | src-tauri/src/proxy/providers/streaming.rs:287-297 | src-tauri/src/proxy/providers/streaming.rs:338-348 | src-tauri/src/proxy/providers/streaming.rs:476-486 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/proxy/providers/streaming.rs:235` calls `Some` and `src-tauri/src/proxy/providers/streaming.rs:337` 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.
D4 · Code Duplication · Duplicated block (10 lines × 8) · ×1
  • Duplicated block (10 lines × 8) src-tauri/src/services/balance.rs:76 — src-tauri/src/services/balance.rs:76-85 | src-tauri/src/services/balance.rs:148-157 | src-tauri/src/services/balance.rs:207-216 | src-tauri/src/services/balance.rs:264-273 | src-tauri/src/services/balance.rs:324-333 | src-tauri/src/services/coding_plan.rs:107-116 | src-tauri/src/services/coding_plan.rs:278-287 | src-tauri/src/services/coding_plan.rs:363-372 — there are 8 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 8 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/services/balance.rs:76` 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.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) src-tauri/src/cli/tui/ui/forms/mcp.rs:283 — src-tauri/src/cli/tui/ui/forms/mcp.rs:283-292 | src-tauri/src/cli/tui/ui/forms/prompt.rs:73-82 | src-tauri/src/cli/tui/ui/forms/provider.rs:551-560 | src-tauri/src/cli/tui/ui/forms/provider.rs:1597-1606 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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.
D4 · Code Duplication · Duplicated block (9 lines × 8) · ×1
  • Duplicated block (9 lines × 8) src-tauri/src/services/balance.rs:88 — src-tauri/src/services/balance.rs:88-96 | src-tauri/src/services/balance.rs:160-168 | src-tauri/src/services/balance.rs:219-227 | src-tauri/src/services/balance.rs:276-284 | src-tauri/src/services/balance.rs:336-344 | src-tauri/src/services/coding_plan.rs:130-138 | src-tauri/src/services/coding_plan.rs:301-309 | src-tauri/src/services/coding_plan.rs:386-394 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src-tauri/src/services/coding_plan.rs:312` calls `get`, `and_then`, `as_bool` and `src-tauri/src/services/balance.rs:98` 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.
D4 · Code Duplication · Duplicated block (9 lines × 6) · ×1
  • Duplicated block (9 lines × 6) src-tauri/src/cli/tui/ui/forms/mcp.rs:297 — src-tauri/src/cli/tui/ui/forms/mcp.rs:297-306 | src-tauri/src/cli/tui/ui/forms/prompt.rs:93-102 | src-tauri/src/cli/tui/ui/forms/provider.rs:567-576 | src-tauri/src/cli/tui/ui/forms/provider.rs:1611-1620 | src-tauri/src/cli/tui/ui/forms/s3.rs:73-82 | src-tauri/src/cli/tui/ui/forms/webdav.rs:65-73 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.rs:297` 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.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) src-tauri/src/cli/tui/app/content_entities.rs:35 — src-tauri/src/cli/tui/app/content_entities.rs:35-52 | src-tauri/src/cli/tui/app/content_entities.rs:692-709 | src-tauri/src/cli/tui/app/content_entities.rs:1125-1142 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn on_sessions_key(&mut` 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.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) src-tauri/src/cli/commands/provider.rs:351 — src-tauri/src/cli/commands/provider.rs:351-357 | src-tauri/src/cli/commands/provider_input.rs:4055-4063 — 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/cli/commands/provider.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. 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.
D4 · Code Duplication · Duplicated block (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) src-tauri/src/proxy/providers/transform.rs:249 — src-tauri/src/proxy/providers/transform.rs:249-257 | src-tauri/src/proxy/providers/transform_responses.rs:396-401 — 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 5 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. 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:249` 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 5) · ×1
  • Duplicated block (7–8 lines × 5) src-tauri/src/cli/tui/ui/forms/mcp.rs:307 — src-tauri/src/cli/tui/ui/forms/mcp.rs:307-314 | src-tauri/src/cli/tui/ui/forms/prompt.rs:110-116 | src-tauri/src/cli/tui/ui/forms/provider.rs:1621-1627 | src-tauri/src/cli/tui/ui/forms/s3.rs:83-89 | src-tauri/src/cli/tui/ui/forms/webdav.rs:74-80 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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/cli/tui/ui/forms/mcp.rs:307` 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.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) src-tauri/src/cli/tui/ui/overlay/pickers.rs:398 — src-tauri/src/cli/tui/ui/overlay/pickers.rs:398-405 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:452-459 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:930-937 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2387-2394 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:2675-2682 — 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/cli/tui/ui/overlay/pickers.rs:398` 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) src-tauri/src/cli/tui/ui/overlay/mcp_key_value.rs:62 — src-tauri/src/cli/tui/ui/overlay/mcp_key_value.rs:62-69 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:543-550 | src-tauri/src/cli/tui/ui/overlay/pickers.rs:835-841 — 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/cli/tui/ui/overlay/mcp_key_value.rs:62` 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.
D4 · Code Duplication · Duplicated block (2–8 lines × 4) · ×1
  • Duplicated block (2–8 lines × 4) src-tauri/src/mcp.rs:840 — src-tauri/src/mcp.rs:840-842 | src-tauri/src/mcp.rs:890-897 | src-tauri/src/mcp.rs:1490-1497 | src-tauri/src/mcp.rs:1540-1541 — 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/mcp.rs:840` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src-tauri/src/mcp.rs:890` calls `is_object`, `as_object`, `is_empty` and `src-tauri/src/mcp.rs:840` does not — after which the two agree again for 5 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.
D4 · Code Duplication · Duplicated block (7 lines × 9) · ×1
  • Duplicated block (7 lines × 9) src-tauri/src/cli/tui/ui/config.rs:943 — src-tauri/src/cli/tui/ui/config.rs:943-949 | src-tauri/src/cli/tui/ui/config.rs:1416-1422 | src-tauri/src/cli/tui/ui/config.rs:2311-2317 | src-tauri/src/cli/tui/ui/forms/mcp.rs:19-25 | src-tauri/src/cli/tui/ui/forms/prompt.rs:14-20 | src-tauri/src/cli/tui/ui/forms/provider.rs:453-459 | src-tauri/src/cli/tui/ui/forms/provider.rs:1072-1078 | src-tauri/src/cli/tui/ui/forms/provider.rs:1300-1306 | src-tauri/src/cli/tui/ui/forms/provider.rs:1493-1499 — before extracting anything, compare `src-tauri/src/cli/tui/ui/forms/mcp.rs` and `src-tauri/src/cli/tui/ui/forms/prompt.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 117 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 before the matched lines, `src-tauri/src/cli/tui/ui/config.rs:2309` calls `from_data` and `src-tauri/src/cli/tui/ui/config.rs:1414` 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.
D4 · Code Duplication · Duplicated block (5–7 lines × 2) · ×1
  • Duplicated block (5–7 lines × 2) src-tauri/src/proxy/providers/transform_codex_anthropic.rs:531 — src-tauri/src/proxy/providers/transform_codex_anthropic.rs:531-535 | src-tauri/src/proxy/providers/transform_codex_anthropic.rs:567-573 — 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.
D4 · Code Duplication · Duplicated block (3–6 lines × 3) · ×1
  • Duplicated block (3–6 lines × 3) src-tauri/src/proxy/providers/transform.rs:183 — src-tauri/src/proxy/providers/transform.rs:183-188 | src-tauri/src/proxy/providers/transform_gemini.rs:78-80 | src-tauri/src/proxy/providers/transform_responses.rs:328-333 — 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 5 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. 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: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. 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.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) src-tauri/src/services/session_usage.rs:657 — src-tauri/src/services/session_usage.rs:657-661 | src-tauri/src/services/session_usage.rs:667-672 — 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:657` 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.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) src-tauri/src/codex_config.rs:383 — src-tauri/src/codex_config.rs:383-389 | src-tauri/src/codex_config.rs:403-409 | src-tauri/src/codex_config.rs:3548-3552 | src-tauri/src/codex_config.rs:3622-3626 — 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. 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.
D4 · Code Duplication · Duplicated block (2–5 lines × 4) · ×1
  • Duplicated block (2–5 lines × 4) src-tauri/src/deeplink/provider.rs:524 — src-tauri/src/deeplink/provider.rs:524-528 | src-tauri/src/deeplink/provider.rs:641-642 | src-tauri/src/deeplink/provider.rs:683-687 | src-tauri/src/deeplink/provider.rs:710-714 — 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/deeplink/provider.rs:524` 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 after the matched lines, `src-tauri/src/deeplink/provider.rs:687` calls `as_ref`, `is_none_or`, `is_empty` and `src-tauri/src/deeplink/provider.rs:642` 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.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) src-tauri/src/cli/tui/form/mcp.rs:350 — src-tauri/src/cli/tui/form/mcp.rs:350-355 | src-tauri/src/cli/tui/form/provider_state.rs:1018-1023 | src-tauri/src/cli/tui/form/s3.rs:232-237 | src-tauri/src/cli/tui/form/webdav.rs:142-147 — 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 4 call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `field` to `McpAddField` in one and `ProviderAddField` 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.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) src-tauri/src/mcp.rs:401 — src-tauri/src/mcp.rs:401-415 | src-tauri/src/mcp.rs:792-806 | src-tauri/src/mcp.rs:961-975 — 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.rs:401` 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.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) src-tauri/src/proxy/providers/claude.rs:368 — src-tauri/src/proxy/providers/claude.rs:368-375 | src-tauri/src/proxy/providers/claude.rs:376-383 | src-tauri/src/proxy/providers/claude.rs:384-391 | src-tauri/src/proxy/providers/claude.rs:392-399 — 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/providers/claude.rs:368` 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.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×1
  • Outbound HTTP without resilience src-tauri/src/services/stream_check/provider_extract.rs:188 — `Client::builder()` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Minor — 85 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×36
  • Duplicated predicate src-tauri/src/cli/tui/app/form_handlers/mcp.rs:69 — `!mcp.server_type.is_remote() && mcp.command.is_blank()` appears character-identically in 2 files — src-tauri/src/cli/tui/app/form_handlers/mcp.rs, src-tauri/src/cli/tui/app/form_handlers/mod.rs. 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-tauri/src/cli/tui/runtime_systems/types.rs:901 — `!root.is_empty() && root.contains("://")` appears character-identically in 2 files — src-tauri/src/cli/tui/runtime_systems/types.rs, src-tauri/src/services/provider/models.rs. 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-tauri/src/cli/tui/form/provider_json.rs:192 — `!self.include_common_config || common_snippet.trim().is_empty()` appears character-identically in 2 files — src-tauri/src/cli/tui/form/provider_json.rs, src-tauri/src/cli/tui/form/provider_state.rs. 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-tauri/src/cli/provider_quota.rs:198 — `!trimmed.is_empty() && !trimmed.eq_ignore_ascii_case("default")` appears character-identically in 2 files — src-tauri/src/cli/provider_quota.rs, src-tauri/src/cli/tui/ui/shared.rs. 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-tauri/src/cli/tui/ui/overlay/pickers.rs:2000 — `(ch.is_whitespace() && ch != ' ') || ch.is_control()` appears character-identically in 2 files — src-tauri/src/cli/tui/ui/overlay/pickers.rs, src-tauri/src/cli/tui/ui/shared.rs. 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-tauri/src/cli/commands/provider_input.rs:4212 — `attribution.get("commit").and_then(Value::as_str) == Some("") && attribution.get("pr").and_then(Value::as_str) == Some("")` appears character-identically in 2 files — src-tauri/src/cli/commands/provider_input.rs, src-tauri/src/cli/tui/form/provider_json.rs. 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-tauri/src/cli/tui/runtime_systems/types.rs:884 — `base.ends_with("/v1") || base.ends_with("/v1beta")` appears character-identically in 2 files — src-tauri/src/cli/tui/runtime_systems/types.rs, src-tauri/src/services/provider/models.rs. 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-tauri/src/cli/tui/app/types.rs:2709 — `base.scope_epoch == scope_epoch && base.scope == scope && base.generation == base_generation` appears character-identically in 2 files — src-tauri/src/cli/tui/app/types.rs, src-tauri/src/cli/tui/runtime_systems/handlers.rs. 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-tauri/src/proxy/providers/streaming_codex_anthropic.rs:592 — `body.get("type").and_then(Value::as_str) == Some("error") || body.get("error").is_some()` appears character-identically in 2 files — src-tauri/src/proxy/providers/streaming_codex_anthropic.rs, src-tauri/src/proxy/providers/transform_codex_anthropic.rs. 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-tauri/src/cli/commands/provider_input.rs:3710 — `c.is_alphanumeric() || c == '-' || c == '_'` appears character-identically in 2 files — src-tauri/src/cli/commands/provider_input.rs, src-tauri/src/services/prompt.rs. 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-tauri/src/daemon/supervisor.rs:1260 — `connect_host.contains(':') && !connect_host.starts_with('[')` appears character-identically in 2 files — src-tauri/src/daemon/supervisor.rs, src-tauri/src/services/proxy.rs. 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-tauri/src/proxy/providers/codex_chat_history.rs:411 — `data.trim().is_empty() || data.trim() == "[DONE]"` appears character-identically in 2 files — src-tauri/src/proxy/providers/codex_chat_history.rs, src-tauri/src/proxy/providers/transform_codex_anthropic.rs. 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-tauri/src/cli/tui/ui/forms/mcp.rs:474 — `editing && matches!(focus, FormFocus::Fields)` appears character-identically in 2 files — src-tauri/src/cli/tui/ui/forms/mcp.rs, src-tauri/src/cli/tui/ui/forms/shared.rs. 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-tauri/src/codex_history_migration.rs:2749 — `err.to_string().contains("符号链接") || err.to_string().contains("symlink")` appears character-identically in 3 files — src-tauri/src/codex_history_migration.rs, src-tauri/src/config.rs, 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-tauri/src/proxy/error.rs:232 — `error.is_timeout() || error.is_connect()` appears character-identically in 2 files — src-tauri/src/proxy/error.rs, src-tauri/src/proxy/forwarder.rs. 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-tauri/src/proxy/providers/claude.rs:291 — `key.starts_with("ya29.") || key.starts_with('{')` appears character-identically in 3 files — src-tauri/src/proxy/providers/claude.rs, src-tauri/src/proxy/providers/gemini.rs, src-tauri/src/proxy/providers/mod.rs. 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-tauri/src/cli/tui/app/content_usage.rs:145 — `matches!(key.code, KeyCode::BackTab) || (matches!(key.code, KeyCode::Tab) && key.modifiers.contains(KeyModifiers::SHIFT))` appears character-identically in 2 files — src-tauri/src/cli/tui/app/content_usage.rs, src-tauri/src/cli/tui/app/form_handlers/tab.rs. 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-tauri/src/cli/tui/app/form_handlers/mcp.rs:66 — `mcp.server_type.is_remote() && mcp.url.is_blank()` appears character-identically in 2 files — src-tauri/src/cli/tui/app/form_handlers/mcp.rs, src-tauri/src/cli/tui/app/form_handlers/mod.rs. 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-tauri/src/proxy/forwarder.rs:1206 — `media_type == "application/json" || media_type.ends_with("+json")` appears character-identically in 2 files — src-tauri/src/proxy/forwarder.rs, src-tauri/src/proxy/handlers.rs. 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-tauri/src/services/skill.rs:1741 — `metadata.file_type().is_symlink() || !metadata.is_dir()` appears character-identically in 2 files — src-tauri/src/services/skill.rs, src-tauri/src/session_manager/transcript.rs. 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-tauri/src/cli/commands/provider.rs:87 — `normalized == "true" || normalized == "1"` appears character-identically in 3 files — src-tauri/src/cli/commands/provider.rs, src-tauri/src/cli/tui/form/provider_state_loading.rs, src-tauri/src/proxy/providers/claude.rs. 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-tauri/src/session_manager/mod.rs:491 — `provider_id == "hermes" && source_path.starts_with("sqlite:")` appears character-identically in 2 files — src-tauri/src/session_manager/mod.rs, src-tauri/src/session_manager/transcript.rs. 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-tauri/src/session_manager/mod.rs:488 — `provider_id == "opencode" && source_path.starts_with("sqlite:")` appears character-identically in 2 files — src-tauri/src/session_manager/mod.rs, src-tauri/src/session_manager/transcript.rs. 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-tauri/src/daemon/supervisor.rs:1250 — `rc == 0 || std::io::Error::last_os_error().raw_os_error() == Some(libc::EPERM)` appears character-identically in 3 files — src-tauri/src/daemon/supervisor.rs, src-tauri/src/services/proxy.rs, src-tauri/src/test_support.rs. 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-tauri/src/cli/tui/app/helpers.rs:1644 — `repo.owner.to_lowercase().contains(q) || repo.name.to_lowercase().contains(q) || repo.branch.to_lowercase().contains(q)` appears character-identically in 2 files — src-tauri/src/cli/tui/app/helpers.rs, src-tauri/src/cli/tui/ui/skills/repos.rs. 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.
  • + 11 more in this group — see findings.md.
D34 · Knowledge Freshness · Orphaned file · ×12
  • Orphaned file src-tauri/src/claude_mcp.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.
  • Orphaned file src-tauri/src/daemon/ipc/server.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.
  • Orphaned file src-tauri/src/daemon/restart.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.
  • Orphaned file src-tauri/src/daemon/ipc/client.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.
  • Orphaned file src-tauri/src/deeplink/mcp.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.
  • Orphaned file src-tauri/src/daemon/logging.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.
  • Orphaned file src-tauri/src/services/env_checker.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.
  • Orphaned file src-tauri/src/provider_defaults.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.
  • Orphaned file src-tauri/src/cli/commands/deeplink.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.
  • Orphaned file src-tauri/src/claude_plugin.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.
  • Orphaned file src-tauri/src/error.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.
  • Orphaned file src-tauri/src/deeplink/prompt.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.
X9 · Subsumed condition operand · Subsumed condition operand · ×11
  • Subsumed condition operand src-tauri/src/services/coding_plan.rs:31 — `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/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:39 — `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:54 — `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.
X7 · Silent fallback defaults · Silent fallback default on Err · ×10
  • Silent fallback default on Err src-tauri/src/cli/tui/app/content_config.rs:14 — `open_openclaw_editor` turns every `Err` into `"{}".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/cli/tui/form/provider_state.rs:3123 — `openclaw_models_editor_text` turns every `Err` into `"[]".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/cli/tui/form/provider_request_overrides.rs:157 — `format_local_proxy_header_overrides` turns every `Err` into `"{}".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/cli/tui/form/provider_request_overrides.rs:162 — `format_local_proxy_body_override` turns every `Err` into `"{}".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/cli/tui/ui/forms/mcp.rs:459 — `mcp_args_summary` turns every `Err` into `"\"\"".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/cli/tui/ui/forms/provider.rs:817 — `codex_auth_preview_text` turns every `Err` into `"{}".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/codex_history_migration.rs:842 — `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/proxy/providers/transform_codex_chat.rs:2026 — `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:334 — `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/skill.rs:527 — `parse_agents_lock` 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.
C2 · Access Controls · No named authorization policies · ×1
  • No named authorization policies — Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 125 significant file(s) lose their only recent owner: src-tauri/src/cli/tui/app/tests.rs, src-tauri/src/cli/tui/ui/tests.rs, src-tauri/src/cli/i18n.rs, src-tauri/src/cli/tui/data.rs, src-tauri/src/cli/tui/runtime_systems/workers.rs, src-tauri/src/proxy/providers/transform_codex_chat.rs, src-tauri/src/services/session_usage_codex.rs, src-tauri/src/cli/commands/provider_input.rs (+117 more). Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 1 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 (126 single-owned of 349 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; 349 of the 392 production source files in this repository met that bar). They are anonymized user #2 (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/cli/commands/quota_reset.rs.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found src-tauri/Cargo.toml:17 — 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 `src-tauri/Cargo.toml` makes this repository a deployable product (line 17).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `src-tauri` (353016 LoC, 820 module-visible types across 44 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.
D30 · Dependency Vulnerabilities · Low vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 12 of 349 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; 349 of the 392 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-tauri/src/claude_mcp.rs, src-tauri/src/daemon/ipc/server.rs, src-tauri/src/daemon/restart.rs, src-tauri/src/daemon/ipc/client.rs, src-tauri/src/deeplink/mcp.rs, src-tauri/src/daemon/logging.rs, src-tauri/src/services/env_checker.rs, src-tauri/src/provider_defaults.rs (and 4 more). 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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • 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.
P10 · Library API & versioning · Implementation type on the public API · ×1
  • Implementation type on the public API src-tauri/src/cli/commands/internal.rs:10 — 1 public type in `cc_switch.cli.commands.internal` is marked as implementation by its own namespace, folder or name: `InternalCommand` (src-tauri/src/cli/commands/internal.rs:10, `internal`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:12 — No static application security testing detected. For this repository's stack, add cargo-audit / cargo-deny (or clippy) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 4 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
S1 · Web-Security Posture · No security response headers detected · ×1
  • No security response headers detected — None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (src-tauri/src/proxy/server.rs:274).
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch scripts/benchmark_cc_switch.py:150 — `read_json` 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.
Minor — 29 finding(s)
D12 · Dependency Hygiene · Outdated · ×29
  • Outdated: anyhow — `anyhow` is locked at 1.0.100 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: bytes — `bytes` is locked at 1.10.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.42 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: clap — `clap` is locked at 4.5.53 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.5"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: clap_complete — `clap_complete` is locked at 4.5.61 but 4.6.11 is the current stable release on crates.io, and it already satisfies the `"4.5"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap_complete` and commit the updated REDACTED.
  • Outdated: env_logger — `env_logger` is locked at 0.11.8 but 0.11.11 is the current stable release on crates.io, and it already satisfies the `"0.11"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p env_logger` and commit the updated REDACTED.
  • Outdated: flate2 — `flate2` is locked at 1.1.2 but 1.1.11 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 flate2` and commit the updated REDACTED.
  • Outdated: futures — `futures` is locked at 0.3.31 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: hyper — `hyper` is locked at 1.7.0 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: indexmap — `indexmap` is locked at 2.11.4 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: inquire — `inquire` is locked at 0.9.2 but 0.9.4 is the current stable release on crates.io, and it already satisfies the `"0.9"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p inquire` and commit the updated REDACTED.
  • Outdated: libc — `libc` is locked at 0.2.190 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.28 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: ratatui — `ratatui` is locked at 0.30.0 but 0.30.2 is the current stable release on crates.io, and it already satisfies the `"0.30"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ratatui` and commit the updated REDACTED.
  • Outdated: regex — `regex` is locked at 1.11.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: self-replace — `self-replace` is locked at 1.5.0 but 1.5.1 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 self-replace` and commit the updated REDACTED.
  • Outdated: semver — `semver` is locked at 1.0.27 but 1.0.28 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 semver` 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.145 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: tachyonfx — `tachyonfx` is locked at 0.25.0 but 0.25.2 is the current stable release on crates.io, and it already satisfies the `"0.25"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tachyonfx` and commit the updated REDACTED.
  • Outdated: tar — `tar` is locked at 0.4.44 but 0.4.46 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 tar` and commit the updated REDACTED.
  • Outdated: tempfile — `tempfile` is locked at 3.23.0 but 3.27.0 is the current stable release on crates.io, and it already satisfies the `"3"` requirement declared in src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tempfile` and commit the updated REDACTED.
  • Outdated: tokio — `tokio` is locked at 1.47.1 but 1.54.1 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 tokio` and commit the updated REDACTED.
  • + 4 more in this group — see findings.md.

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.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-fdb63421fd554d20864ccb3af8719a67/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-fdb63421fd554d20864ccb3af8719a67/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .50artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .36artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—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.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—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.0—
D41 · Kernel & Syscall Confinementruntime-hardening—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.0—
D42 · Runtime Threat Enforcementruntime-hardening—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.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1db90-926e-765b-a9c3-c8d2bc6286a7 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

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.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md