Public report of 1jehuang/jcode, 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, 15:26 UTC · Survey ID cd_c9b162949ec64550824c6e53dda26886

1jehuang/jcode

Measured 14 November 2026, 15:25 UTC, at code version 374ed3e

CAI score 51out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 5 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 very large codebase: 717,097 lines of product code in 99 projects, tests not counted · Estimated rebuild effort: about 6.2 person-years · Weakest lens: Security and Compliance, 38

Findings by how serious they are

134 critical 4306 serious 169 minor

17 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, 15:25 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.

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 ▸

63of 63 dimensions measured by tools.
4507of 4609 findings point to an exact file and line, so you can open each one in the code. The other 102 concern the repository as a whole, such as missing documentation.
63dimensions across 8 lenses, read from 717,097 lines of product code in 99 projects.
Chapters

Executive summary

1jehuang/jcode falls short of our standard for production because we found no encryption of stored data, no key vault and no enforced HTTPS, and it has pipeline tools referenced by a changeable name. It scores 51 out of 100 and is rated Adequate, and 129 of its 134 critical findings are security problems.

Security and Compliance, at 38, is the weakest lens and counts most in the score. The best first step is encrypting the sensitive stored data and keeping its keys in a vault, worth about 10 points. Adding type checking is another step, worth about 4 points. Raising Security and Compliance to 70 would lift the score to about 60.

117 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Four secrets can leak from the build pipeline, and two passwords or keys are open to anyone who can read the repository. Pinning each tool to an exact version, limiting each secret to its own step and replacing each exposed password or key would close these risks. Fixing the weaknesses the scanner points to would fix the two security weaknesses in the code, and the two pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The three sets of files in separate parts that keep changing together need that dependency made explicit.

The product code is 717,097 lines, about €900,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.
Security and Compliance 38 · counts for 45%Code Health 50 · counts for 25%Production Readiness 61 · counts for 14%Performance 70 · counts for 8%Maturity 74 · counts for 4%Architecture 88 · counts for 2%Event-Driven 100 · counts for 1%Event Sourcing 100 · counts for 1%

If Security and Compliance rose from 38 to 70, the lowest score rated Strong, the score would rise from 51 to about 60.

Code composition: what the lines of code are
Product code 75%Tests 25%
New since the last survey: 1275 findings

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

  • Cyclomatic Complexity · jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cyclomatic 414) crates/jcode-tui/src/tui/app/remote/server_events.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input (cyclomatic 242) crates/jcode-tui/src/tui/app/remote/key_handling.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal (cyclomatic 190) crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs
  • Cyclomatic Complexity · jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls (cyclomatic 149) crates/jcode-tui-markdown/src/markdown_render_full.rs
  • Cyclomatic Complexity · BridgeState::legacy_event_to_api_inner (cyclomatic 141) crates/jcode-harness-api-server/src/translate.rs
  • Cyclomatic Complexity · jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls (cyclomatic 141) crates/jcode-tui-markdown/src/markdown_render_lazy.rs
  • Cyclomatic Complexity · jcode_render_core::markdown::parse_markdown_with_options (cyclomatic 87) crates/jcode-render-core/src/markdown.rs
  • Cyclomatic Complexity · fetch (cyclomatic 64) telemetry-worker/src/worker.js
  • Cyclomatic Complexity · jcode_app_core::tool::todo_names::normalize_public_input (cyclomatic 48) crates/jcode-app-core/src/tool/todo_names.rs
  • Cyclomatic Complexity · jcode_tui::tui::session_picker::transcript_search::search_shard (cyclomatic 45) crates/jcode-tui/src/tui/session_picker/transcript_search.rs
  • Cyclomatic Complexity · SessionPicker::render_session_list_impl (cyclomatic 42) crates/jcode-tui/src/tui/session_picker/render.rs
  • Cyclomatic Complexity · SessionPicker::handle_overlay_key_inner (cyclomatic 37) crates/jcode-tui/src/tui/session_picker.rs
  • Cyclomatic Complexity · jcode_app_core::server::runtime_ssh_accounts::execute (cyclomatic 36) crates/jcode-app-core/src/server/runtime_ssh_accounts.rs
  • Cyclomatic Complexity · ProviderCard::body_lines (cyclomatic 35) crates/jcode-tui/src/tui/ui_messages/usage.rs
  • Cyclomatic Complexity · cloud_directories_probe.collect (cyclomatic 35) crates/jcode-tui/src/tui/cloud_directories_probe.py
  • Cyclomatic Complexity · SessionPicker::rebuild_items_inner (cyclomatic 34) crates/jcode-tui/src/tui/session_picker/filter.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::server_events::cache_miss::handle_kv_cache_miss (cyclomatic 32) crates/jcode-tui/src/tui/app/remote/server_events/cache_miss.rs
  • Cyclomatic Complexity · jcode_tui::tui::redraw_schedule::redraw_interval_focused_policy (cyclomatic 32) crates/jcode-tui/src/tui/redraw_schedule.rs
  • Cyclomatic Complexity · jcode_app_core::server::runtime_ssh_host::execute (cyclomatic 31) crates/jcode-app-core/src/server/runtime_ssh_host.rs
  • Cyclomatic Complexity · jcode_provider_openai_runtime::openai_stream_http::stream_response (cyclomatic 31) crates/jcode-provider-openai-runtime/src/openai_stream_http.rs
  • Cyclomatic Complexity · ColorReports::push (cyclomatic 30) crates/jcode-tui/src/tui/terminal_events.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::helpers::git_watch::imp::run (cyclomatic 30) crates/jcode-tui/src/tui/app/helpers/git_watch.rs
  • Cyclomatic Complexity · App::open_account_center (cyclomatic 28) crates/jcode-tui/src/tui/app/auth_account_picker/account_center.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::ssh_sessions::handle_command (cyclomatic 28) crates/jcode-tui/src/tui/app/remote/ssh_sessions.rs
  • Cyclomatic Complexity · jcode_app_core::server::runtime_ssh_accounts::reset (cyclomatic 26) crates/jcode-app-core/src/server/runtime_ssh_accounts.rs
  • Cyclomatic Complexity · jcode_base::mobile_sync::sync_pass (cyclomatic 26) crates/jcode-base/src/mobile_sync.rs
  • Cyclomatic Complexity · jcode::cli::commands::todo_followup::prepare_run_todo_follow_up (cyclomatic 26) src/cli/commands/todo_followup.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::usage::activity_summary_lines (cyclomatic 25) crates/jcode-tui/src/tui/ui_messages/usage.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::commands_cloud::handle_cloud_command (cyclomatic 24) crates/jcode-tui/src/tui/app/commands_cloud.rs
  • Cyclomatic Complexity · jcode_app_core::server::client_processing::start_processing_message (cyclomatic 23) crates/jcode-app-core/src/server/client_processing.rs
  • Cyclomatic Complexity · App::poll_cloud_job (cyclomatic 23) crates/jcode-tui/src/tui/app/commands_cloud.rs
  • Cyclomatic Complexity · App::handle_provider_failover_prompt_with_payload (cyclomatic 23) crates/jcode-tui/src/tui/app/model_context.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::discovery::render_discovery_card (cyclomatic 23) crates/jcode-tui/src/tui/ui_messages/discovery.rs
  • Cyclomatic Complexity · jcode_tui_markdown::markdown_links::markdown_link_target (cyclomatic 23) crates/jcode-tui-markdown/src/markdown_links.rs
  • Cyclomatic Complexity · BedrockProvider::refresh_catalog_with_client (cyclomatic 22) crates/jcode-provider-bedrock/src/lib.rs
  • Cyclomatic Complexity · remote.project (cyclomatic 22) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py
  • Cyclomatic Complexity · jcode_tui::tui::app::input::terminal_reports::strip_terminal_control_sequences (cyclomatic 21) crates/jcode-tui/src/tui/app/input/terminal_reports.rs
  • Cyclomatic Complexity · jcode::cli::cloud_move::run_return (cyclomatic 21) src/cli/cloud_move.rs
  • Cyclomatic Complexity · remote.main (cyclomatic 21) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py
  • Cyclomatic Complexity · NativeSshTransport::connect (cyclomatic 20) crates/jcode-sdk/src/native_ssh.rs
  • Cyclomatic Complexity · TranscriptSearch::poll (cyclomatic 20) crates/jcode-tui/src/tui/session_picker/transcript_search.rs
  • Cyclomatic Complexity · BackgroundTaskManager::cleanup_filtered (cyclomatic 19) crates/jcode-base/src/background/cleanup.rs
  • Cyclomatic Complexity · App::handle_session_picker_current_terminal_selection (cyclomatic 19) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · App::handle_session_picker_action (cyclomatic 19) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · App::refresh_completed_todo_report (cyclomatic 19) crates/jcode-tui/src/tui/app/todo_completion.rs
  • Cyclomatic Complexity · jcode_app_core::server::client_session::handle_clear_session (cyclomatic 18) crates/jcode-app-core/src/server/client_session.rs
  • Cyclomatic Complexity · jcode_app_core::tool::todo_names::normalize_containers (cyclomatic 18) crates/jcode-app-core/src/tool/todo_names.rs
  • Cyclomatic Complexity · jcode_tui::tui::session_picker::loading::pi_sessions::load_pi_session_info (cyclomatic 18) crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_input::wrap_input_text_with_ghost (cyclomatic 18) crates/jcode-tui/src/tui/ui_input.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_todo_stages::push_lane_status_lines_inner (cyclomatic 18) crates/jcode-tui/src/tui/ui_todo_stages.rs
  • Cyclomatic Complexity · IncrementalMarkdownRenderer::render_split (cyclomatic 18) crates/jcode-tui-markdown/src/markdown_incremental.rs
  • Cyclomatic Complexity · jcode::cli::ssh::run_unix (cyclomatic 18) src/cli/ssh.rs
  • Cyclomatic Complexity · remote.recent_messages (cyclomatic 18) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py
  • Cyclomatic Complexity · scheduled (cyclomatic 18) telemetry-worker/src/worker.js
  • Cyclomatic Complexity · jcode_app_core::server::client_session_rename::rename_swarm_member_session (cyclomatic 17) crates/jcode-app-core/src/server/client_session_rename.rs
  • Cyclomatic Complexity · jcode_app_core::server::comm_control::spawn_assigned_task_run (cyclomatic 17) crates/jcode-app-core/src/server/comm_control.rs
  • Cyclomatic Complexity · jcode_app_core::server::runtime_ssh_sessions::list_sessions (cyclomatic 17) crates/jcode-app-core/src/server/runtime_ssh_sessions.rs
  • Cyclomatic Complexity · jcode_app_core::tool::session_search::searchable_text::searchable_message_text (cyclomatic 17) crates/jcode-app-core/src/tool/session_search/searchable_text.rs
  • Cyclomatic Complexity · jcode_app_core::tool::todo::flatten_phases (cyclomatic 17) crates/jcode-app-core/src/tool/todo.rs
  • Cyclomatic Complexity · App::handle_account_picker_selection (cyclomatic 17) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · App::process_queued_messages (cyclomatic 17) crates/jcode-tui/src/tui/app/input.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::push_todo_status_pips (cyclomatic 17) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode::cli::account::run_mobile (cyclomatic 17) src/cli/account.rs
  • Cyclomatic Complexity · jcode::cli::cloud_move::export_return_archive (cyclomatic 17) src/cli/cloud_move.rs
  • Cyclomatic Complexity · remote.value_end (cyclomatic 17) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py
  • Cyclomatic Complexity · SelfDevTool::do_reload (cyclomatic 16) crates/jcode-app-core/src/tool/selfdev/reload.rs
  • Cyclomatic Complexity · jcode_app_core::tool::patch::render_patch (cyclomatic 16) crates/jcode-app-core/src/tool/patch.rs
  • Cyclomatic Complexity · jcode_base::provider::multi_provider::saved_account_can_serve_model (cyclomatic 16) crates/jcode-base/src/provider/multi_provider.rs
  • Cyclomatic Complexity · jcode_base::usage::anthropic_fable_reset::redeem (cyclomatic 16) crates/jcode-base/src/usage/anthropic_fable_reset.rs
  • Cyclomatic Complexity · Companion::handle (cyclomatic 16) crates/jcode-companion/src/server.rs
  • Cyclomatic Complexity · jcode_companion::voice::run (cyclomatic 16) crates/jcode-companion/src/voice.rs
  • Cyclomatic Complexity · AnthropicProvider::get_oauth_access_token (cyclomatic 16) crates/jcode-provider-anthropic-runtime/src/lib.rs
  • Cyclomatic Complexity · jcode_todo_policy::stages::validate_lane_dependencies (cyclomatic 16) crates/jcode-todo-policy/src/stages.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui::copy_selection::frame_chrome_for_selection (cyclomatic 16) crates/jcode-tui/src/tui/ui/copy_selection.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui::copy_selection::copy_selection_text_from_raw_lines_base (cyclomatic 16) crates/jcode-tui/src/tui/ui/copy_selection.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::plan_card::split_plan_segments (cyclomatic 16) crates/jcode-tui/src/tui/ui_messages/plan_card.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_prepare::prepare_active_batch_progress (cyclomatic 16) crates/jcode-tui/src/tui/ui_prepare.rs
  • Cyclomatic Complexity · jcode_tui_markdown::markdown_incremental::find_stable_split (cyclomatic 16) crates/jcode-tui-markdown/src/markdown_incremental.rs
  • Cyclomatic Complexity · Target::preflight_uncached (cyclomatic 16) src/cli/cloud_move/transport.rs
  • Cognitive Complexity · jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cognitive 717) crates/jcode-tui/src/tui/app/remote/server_events.rs
  • Cognitive Complexity · jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input (cognitive 357) crates/jcode-tui/src/tui/app/remote/key_handling.rs
  • Cognitive Complexity · jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls (cognitive 250) crates/jcode-tui-markdown/src/markdown_render_full.rs
  • Cognitive Complexity · jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls (cognitive 243) crates/jcode-tui-markdown/src/markdown_render_lazy.rs
  • Cognitive Complexity · jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal (cognitive 226) crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs
  • Cognitive Complexity · BridgeState::legacy_event_to_api_inner (cognitive 187) crates/jcode-harness-api-server/src/translate.rs
  • Cognitive Complexity · jcode_render_core::markdown::parse_markdown_with_options (cognitive 125) crates/jcode-render-core/src/markdown.rs
  • Cognitive Complexity · jcode_app_core::tool::todo_names::normalize_public_input (cognitive 112) crates/jcode-app-core/src/tool/todo_names.rs
  • Cognitive Complexity · ProviderCard::body_lines (cognitive 86) crates/jcode-tui/src/tui/ui_messages/usage.rs
  • Cognitive Complexity · jcode_tui::tui::session_picker::transcript_search::search_shard (cognitive 78) crates/jcode-tui/src/tui/session_picker/transcript_search.rs
  • Cognitive Complexity · fetch (cognitive 73) telemetry-worker/src/worker.js
  • Cognitive Complexity · jcode_tui::tui::app::helpers::git_watch::imp::run (cognitive 65) crates/jcode-tui/src/tui/app/helpers/git_watch.rs
  • Cognitive Complexity · jcode_provider_openai_runtime::openai_stream_http::stream_response (cognitive 59) crates/jcode-provider-openai-runtime/src/openai_stream_http.rs
  • Cognitive Complexity · SessionPicker::rebuild_items_inner (cognitive 58) crates/jcode-tui/src/tui/session_picker/filter.rs
  • Cognitive Complexity · jcode_tui::tui::ui_messages::usage::activity_summary_lines (cognitive 55) crates/jcode-tui/src/tui/ui_messages/usage.rs
  • Cognitive Complexity · jcode::cli::commands::todo_followup::prepare_run_todo_follow_up (cognitive 55) src/cli/commands/todo_followup.rs
  • Cognitive Complexity · SessionPicker::render_session_list_impl (cognitive 54) crates/jcode-tui/src/tui/session_picker/render.rs
  • Cognitive Complexity · jcode_tui_markdown::markdown_links::markdown_link_target (cognitive 54) crates/jcode-tui-markdown/src/markdown_links.rs
  • Cognitive Complexity · jcode_app_core::tool::session_search::searchable_text::searchable_message_text (cognitive 53) crates/jcode-app-core/src/tool/session_search/searchable_text.rs
  • Cognitive Complexity · cloud_directories_probe.collect (cognitive 51) crates/jcode-tui/src/tui/cloud_directories_probe.py
  • Cognitive Complexity · jcode_base::mobile_sync::sync_pass (cognitive 50) crates/jcode-base/src/mobile_sync.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: 730 findings

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

  • Cyclomatic Complexity · jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input (cyclomatic 219) crates/jcode-tui/src/tui/app/remote/key_handling.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::key_handling::handle_remote_key_internal (cyclomatic 186) crates/jcode-tui/src/tui/app/remote/key_handling.rs
  • Cyclomatic Complexity · jcode_tui_markdown::markdown_render_full::render_markdown_with_width (cyclomatic 149) crates/jcode-tui-markdown/src/markdown_render_full.rs
  • Cyclomatic Complexity · jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy (cyclomatic 141) crates/jcode-tui-markdown/src/markdown_render_lazy.rs
  • Cyclomatic Complexity · jcode_render_core::markdown::parse_markdown (cyclomatic 87) crates/jcode-render-core/src/markdown.rs
  • Cyclomatic Complexity · analyze_runtime_memory_log.print_human (cyclomatic 69) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · fetch (cyclomatic 61) telemetry-worker/src/worker.js
  • Cyclomatic Complexity · benchmark_discovery_rate.run_trial (cyclomatic 48) scripts/benchmark_discovery_rate.py
  • Cyclomatic Complexity · repro_input_flicker.main (cyclomatic 48) scripts/repro_input_flicker.py
  • Cyclomatic Complexity · SessionReducer.reduceEvent (cyclomatic 47) ios/Sources/JCodeKit/SessionReducer.swift
  • Cyclomatic Complexity · SessionPicker::build_preview_cache (cyclomatic 46) crates/jcode-tui/src/tui/session_picker.rs
  • Cyclomatic Complexity · repro_input_lag.main (cyclomatic 44) scripts/repro_input_lag.py
  • Cyclomatic Complexity · analyze_root_crate.main (cyclomatic 39) scripts/analyze_root_crate.py
  • Cyclomatic Complexity · audit_terminal_bench_submission.main (cyclomatic 38) scripts/audit_terminal_bench_submission.py
  • Cyclomatic Complexity · jcode_tui::tui::app::remote::server_events::handle_kv_cache_miss (cyclomatic 32) crates/jcode-tui/src/tui/app/remote/server_events.rs
  • Cyclomatic Complexity · analyze_runtime_memory_log.build_incident_assessment (cyclomatic 31) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · analyze_runtime_memory_log.build_server_hints (cyclomatic 30) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · benchmark_discovery_rate.load_cases (cyclomatic 29) scripts/benchmark_discovery_rate.py
  • Cyclomatic Complexity · jcode_provider_openai_runtime::openai_stream_runtime::stream_response (cyclomatic 28) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs
  • Cyclomatic Complexity · SessionPicker::handle_overlay_key (cyclomatic 28) crates/jcode-tui/src/tui/session_picker.rs
  • Cyclomatic Complexity · jcode_tui::tui::redraw_schedule::redraw_interval_with_policy_and_animation (cyclomatic 28) crates/jcode-tui/src/tui/redraw_schedule.rs
  • Cyclomatic Complexity · benchmark_attribution.check_sponsor (cyclomatic 28) scripts/benchmark_attribution.py
  • Cyclomatic Complexity · App::open_account_center (cyclomatic 27) crates/jcode-tui/src/tui/app/auth_account_picker.rs
  • Cyclomatic Complexity · profile_spawn.main (cyclomatic 27) scripts/profile_spawn.py
  • Cyclomatic Complexity · repro_live_duplicate.main (cyclomatic 27) scripts/repro_live_duplicate.py
  • Cyclomatic Complexity · jcode_app_core::tool::communicate::run_swarm_plan_loop (cyclomatic 26) crates/jcode-app-core/src/tool/communicate.rs
  • Cyclomatic Complexity · analyze_runtime_memory_log.infer_trigger (cyclomatic 26) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · bench_memory_cli.run_tool (cyclomatic 26) scripts/bench_memory_cli.py
  • Cyclomatic Complexity · check_release_ci.check_once (cyclomatic 26) scripts/check_release_ci.py
  • Cyclomatic Complexity · repro_slash_flicker.main (cyclomatic 26) scripts/repro_slash_flicker.py
  • Cyclomatic Complexity · benchmark_browser_handoff.extract_trace (cyclomatic 24) scripts/benchmark_browser_handoff.py
  • Cyclomatic Complexity · count_idle_draws.main (cyclomatic 24) scripts/count_idle_draws.py
  • Cyclomatic Complexity · profile_remote_resume_burst.run_burst (cyclomatic 24) scripts/profile_remote_resume_burst.py
  • Cyclomatic Complexity · update_rehearsal.main (cyclomatic 24) scripts/update_rehearsal.py
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::render_discovery_card (cyclomatic 23) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode::cli::commands::prepare_run_todo_follow_up (cyclomatic 23) src/cli/commands.rs
  • Cyclomatic Complexity · analyze_openai_ws_cache.analyze (cyclomatic 23) scripts/analyze_openai_ws_cache.py
  • Cyclomatic Complexity · benchmark_discovery.load_cases (cyclomatic 23) scripts/benchmark_discovery.py
  • Cyclomatic Complexity · benchmark_discovery.run_attempt (cyclomatic 23) scripts/benchmark_discovery.py
  • Cyclomatic Complexity · reload_recovery_audit.render_table (cyclomatic 23) scripts/reload_recovery_audit.py
  • Cyclomatic Complexity · SessionPicker::render_session_list (cyclomatic 22) crates/jcode-tui/src/tui/session_picker/render.rs
  • Cyclomatic Complexity · analyze_runtime_memory_log.build_client_hints (cyclomatic 22) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · bench_startup_visible_ready.run_once (cyclomatic 22) scripts/bench_startup_visible_ready.py
  • Cyclomatic Complexity · verify_donut_still_animates.main (cyclomatic 22) scripts/verify_donut_still_animates.py
  • Cyclomatic Complexity · TodoTool::execute (cyclomatic 21) crates/jcode-app-core/src/tool/todo.rs
  • Cyclomatic Complexity · App::handle_session_picker_key (cyclomatic 21) crates/jcode-tui/src/tui/app/inline_interactive.rs
  • Cyclomatic Complexity · SessionPicker::rebuild_items (cyclomatic 21) crates/jcode-tui/src/tui/session_picker/filter.rs
  • Cyclomatic Complexity · jcode_tui::tui::app::input::strip_terminal_control_sequences (cyclomatic 21) crates/jcode-tui/src/tui/app/input.rs
  • Cyclomatic Complexity · bench_resume_picker.measure (cyclomatic 21) scripts/bench_resume_picker.py
  • Cyclomatic Complexity · benchmark_attribution.main (cyclomatic 21) scripts/benchmark_attribution.py
  • Cyclomatic Complexity · benchmark_browser_handoff.summarize (cyclomatic 21) scripts/benchmark_browser_handoff.py
  • Cyclomatic Complexity · profile_spawn.profile_client_spawn (cyclomatic 21) scripts/profile_spawn.py
  • Cyclomatic Complexity · BashTool::execute_foreground (cyclomatic 20) REDACTED
  • Cyclomatic Complexity · jcode_app_core::agent::tool_markup_recovery::scan_tool_call_markup (cyclomatic 20) crates/jcode-app-core/src/agent/tool_markup_recovery.rs
  • Cyclomatic Complexity · BedrockProvider::refresh_catalog (cyclomatic 20) crates/jcode-provider-bedrock/src/lib.rs
  • Cyclomatic Complexity · profile_idle_donut.main (cyclomatic 20) scripts/profile_idle_donut.py
  • Cyclomatic Complexity · reload_recovery_audit.parse_logs (cyclomatic 20) scripts/reload_recovery_audit.py
  • Cyclomatic Complexity · remote_check.main (cyclomatic 20) scripts/remote/remote_check.py
  • Cyclomatic Complexity · repro_input_flicker.observe_keystroke (cyclomatic 20) scripts/repro_input_flicker.py
  • Cyclomatic Complexity · repro_real_spawn_lag.main (cyclomatic 20) scripts/repro_real_spawn_lag.py
  • Cyclomatic Complexity · repro_startup_lag.main (cyclomatic 20) scripts/repro_startup_lag.py
  • Cyclomatic Complexity · BackgroundTaskManager::cleanup_filtered (cyclomatic 19) crates/jcode-base/src/background.rs
  • Cyclomatic Complexity · analyze_root_crate.outbound_refs (cyclomatic 19) scripts/analyze_root_crate.py
  • Cyclomatic Complexity · apply_release_recovery.apply (cyclomatic 19) scripts/apply_release_recovery.py
  • Cyclomatic Complexity · benchmark_discovery.summarize_case (cyclomatic 19) scripts/benchmark_discovery.py
  • Cyclomatic Complexity · App::format_usage_display_card (cyclomatic 18) crates/jcode-tui/src/tui/app/model_context.rs
  • Cyclomatic Complexity · jcode_tui::tui::session_picker::loading::load_pi_session_info (cyclomatic 18) crates/jcode-tui/src/tui/session_picker/loading.rs
  • Cyclomatic Complexity · bench_headless_memory.run_jcode (cyclomatic 18) scripts/bench_headless_memory.py
  • Cyclomatic Complexity · benchmark_browser_handoff.main (cyclomatic 18) scripts/benchmark_browser_handoff.py
  • Cyclomatic Complexity · benchmark_swarm.run_swarm (cyclomatic 18) scripts/benchmark_swarm.py
  • Cyclomatic Complexity · measure_animation_cpu_cost.main (cyclomatic 18) scripts/measure_animation_cpu_cost.py
  • Cyclomatic Complexity · wake-lambda.handler (cyclomatic 18) scripts/phone-server/wake-lambda.py
  • Cyclomatic Complexity · pin_no_area_state.main (cyclomatic 18) scripts/pin_no_area_state.py
  • Cyclomatic Complexity · jcode_app_core::server::client_lifecycle::start_processing_message (cyclomatic 17) crates/jcode-app-core/src/server/client_lifecycle.rs
  • Cyclomatic Complexity · jcode_app_core::server::client_session::rename_swarm_member_session (cyclomatic 17) crates/jcode-app-core/src/server/client_session.rs
  • Cyclomatic Complexity · jcode_base::session::crash::find_session_by_name_or_id (cyclomatic 17) crates/jcode-base/src/session/crash.rs
  • Cyclomatic Complexity · EventMapper::map_event (cyclomatic 17) src/cli/acp.rs
  • Cyclomatic Complexity · jcode::cli::cloud_move::restore_repo (cyclomatic 17) src/cli/cloud_move.rs
  • Cyclomatic Complexity · analyze_runtime_memory_log.collect_session_peaks (cyclomatic 17) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · analyze_runtime_memory_log.build_coverage_report (cyclomatic 17) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · benchmark_discovery.main (cyclomatic 17) scripts/benchmark_discovery.py
  • Cyclomatic Complexity · benchmark_discovery_rate.summarize_case (cyclomatic 17) scripts/benchmark_discovery_rate.py
  • Cyclomatic Complexity · check_swallowed_error_budget.main (cyclomatic 17) scripts/check_swallowed_error_budget.py
  • Cyclomatic Complexity · dump_fresh_spawn_screen.main (cyclomatic 17) scripts/dump_fresh_spawn_screen.py
  • Cyclomatic Complexity · H.do_POST (cyclomatic 17) scripts/fake_openai_server.py
  • Cyclomatic Complexity · JcodeHarborAgent.run (cyclomatic 17) scripts/jcode_harbor_agent.py
  • Cyclomatic Complexity · jcode_memory_snapshot.classify_process (cyclomatic 17) scripts/jcode_memory_snapshot.py
  • Cyclomatic Complexity · profile_single_spawn.profile_single_spawn (cyclomatic 17) scripts/profile_single_spawn.py
  • Cyclomatic Complexity · tb_compare.main (cyclomatic 17) scripts/tb_compare.py
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::split_plan_segments (cyclomatic 16) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_messages::todo_card_item_spans (cyclomatic 16) crates/jcode-tui/src/tui/ui_messages.rs
  • Cyclomatic Complexity · jcode_tui::tui::ui_todo_stages::push_lane_status_lines (cyclomatic 16) crates/jcode-tui/src/tui/ui_todo_stages.rs
  • Cyclomatic Complexity · analyze_runtime_memory_log.session_population_summary (cyclomatic 16) scripts/analyze_runtime_memory_log.py
  • Cyclomatic Complexity · bench_memory_cli.launch_interactive (cyclomatic 16) scripts/bench_memory_cli.py
  • Cyclomatic Complexity · benchmark_browser_handoff.run_trial (cyclomatic 16) scripts/benchmark_browser_handoff.py
  • Cyclomatic Complexity · benchmark_browser_handoff.self_test (cyclomatic 16) scripts/benchmark_browser_handoff.py
  • Cyclomatic Complexity · diagnose_idle_render_cost.main (cyclomatic 16) scripts/diagnose_idle_render_cost.py
  • Cyclomatic Complexity · run_terminal_bench_campaign.main (cyclomatic 16) scripts/run_terminal_bench_campaign.py
  • Cyclomatic Complexity · verify_discovery_select.main (cyclomatic 16) scripts/verify_discovery_select.py
  • Cognitive Complexity · jcode_tui::tui::app::remote::key_handling::submit_remote_enter_input (cognitive 475) crates/jcode-tui/src/tui/app/remote/key_handling.rs
Rebuild cost: about €900,000 · Estimate
Cost to rebuild€300,000 to €1,500,000, for 4,961 to 15,737 hours of work, about 6.2 person-years for 3 to 12 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.7 at a score of 51. 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.
SizeVery large: 717,097 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
Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs).
Skip if delegated to infra (Postgres TDE, KMS, etc.).
Raises the score by about 10 points · Medium effort · Data Protection
2
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).
Raises the score by about 2 points · Low effort · Static Analysis (SAST)
3
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 4 points · Medium effort · Type Safety

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €900,000 to build again, about 6.2 person-years of work. Its weakest lens is Security and Compliance, at 38 (Weak). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance actions in Top priorities.
If you do one thing first · First action
Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs). Of all the actions in this report, it raises the score most for the work it takes: about 10 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 5.7 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 13% on every change. The history of the code shows how much it changes: about 634,287 lines over the last 90 days, which is about 2,572,386 lines a year. At that pace, the extra work comes to an estimated 367.1 to 2202.5 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 — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch jcode (.) ) jcode-provider-antigravity-runtime jcode-provider-antigravity-runtime jcode (.)->jcode-provider-antigravity-runtime jcode-provider-copilot-runtime jcode-provider-copilot-runtime jcode (.)->jcode-provider-copilot-runtime jcode-provider-doctor jcode-provider-doctor jcode (.)->jcode-provider-doctor jcode-provider-openrouter-runtime jcode-provider-openrouter-runtime jcode (.)->jcode-provider-openrouter-runtime jcode-tui jcode-tui jcode (.)->jcode-tui jcode-app-core jcode-app-core jcode-base jcode-base jcode-app-core->jcode-base jcode-core jcode-core jcode-app-core->jcode-core jcode-harness-api jcode-harness-api jcode-app-core->jcode-harness-api jcode-message-types jcode-message-types jcode-app-core->jcode-message-types jcode-provider-core jcode-provider-core jcode-app-core->jcode-provider-core jcode-schema-dialect jcode-schema-dialect jcode-app-core->jcode-schema-dialect jcode-session-types jcode-session-types jcode-app-core->jcode-session-types jcode-base->jcode-core jcode-logging jcode-logging jcode-base->jcode-logging jcode-base->jcode-message-types jcode-protocol jcode-protocol jcode-base->jcode-protocol jcode-provider-bedrock jcode-provider-bedrock jcode-base->jcode-provider-bedrock jcode-base->jcode-provider-core jcode-provider-openai jcode-provider-openai jcode-base->jcode-provider-openai jcode-base->jcode-session-types jcode-storage jcode-storage jcode-base->jcode-storage jcode-telemetry-core jcode-telemetry-core jcode-base->jcode-telemetry-core jcode-harness-api->jcode-session-types jcode-logging->jcode-core jcode-logging->jcode-storage jcode-protocol->jcode-message-types jcode-protocol->jcode-provider-core jcode-protocol->jcode-session-types jcode-provider-antigravity-runtime->jcode-base jcode-provider-antigravity-runtime->jcode-message-types jcode-provider-antigravity-runtime->jcode-provider-core jcode-provider-antigravity-runtime->jcode-schema-dialect jcode-provider-bedrock->jcode-core jcode-provider-bedrock->jcode-logging jcode-provider-bedrock->jcode-message-types jcode-provider-bedrock->jcode-provider-core jcode-provider-bedrock->jcode-storage jcode-provider-copilot-runtime->jcode-base jcode-provider-copilot-runtime->jcode-message-types jcode-provider-copilot-runtime->jcode-provider-core jcode-provider-copilot-runtime->jcode-provider-openai jcode-provider-core->jcode-logging jcode-provider-core->jcode-message-types jcode-provider-core->jcode-schema-dialect jcode-provider-doctor->jcode-base jcode-provider-doctor->jcode-provider-antigravity-runtime jcode-provider-doctor->jcode-provider-copilot-runtime jcode-provider-doctor->jcode-provider-openrouter-runtime jcode-provider-openai->jcode-core jcode-provider-openai->jcode-logging jcode-provider-openai->jcode-message-types jcode-provider-openai->jcode-provider-core jcode-provider-openrouter-runtime->jcode-base jcode-provider-openrouter-runtime->jcode-message-types jcode-provider-openrouter-runtime->jcode-provider-core jcode-provider-openrouter-runtime->jcode-provider-openai jcode-session-types->jcode-message-types jcode-storage->jcode-core jcode-telemetry-core->jcode-core jcode-telemetry-core->jcode-logging jcode-telemetry-core->jcode-provider-core jcode-telemetry-core->jcode-storage jcode-tui->jcode-app-core jcode-tui->jcode-core jcode-tui->jcode-logging jcode-tui->jcode-provider-core jcode-tui->jcode-session-types __more__ +79 more projects

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.

1256 modules, with 1942 dependencies between them. 16 loops run through 65 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1216 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 jcode_base.mcp.protocol2 jcode_config_types3 jcode_message_types4 jcode_protocol.wire.events5 jcode_provider_metadata6 jcode_side_panel_types7 jcode_task_types8 jcode_transport.windows9 jcode_usage_types10 ratatui_core.layout.rect11 ratatui_core.style12 scripts13 jcode_base.auth.status_types14 jcode_base.bus15 jcode_base.usage.model16 jcode_harness_api.events17 jcode_provider_core18 jcode_session_types19 jcode_tool_core20 jcode_tui.tui.cloud_latency21 ratatui_core.buffer.buffer22 ratatui_core.style.stylize23 jcode.cli.provider_init24 jcode_app_core.tool25 jcode_app_core.tool.remote_exec26 jcode_protocol27 jcode_tui_messages.message28 ratatui_core.widgets.widget29 jcode_app_core.server.state30 jcode_base.session31 jcode_tui.tui.backend32 jcode_tui.tui.info_widget33 ratatui_widgets.block34 jcode_app_core.agent35 jcode_tui.tui.session_picker36 jcode_app_core.server37 jcode_tui.tui.app38 jcode_tui.tui39 jcode.bin.tui_bench40 jcode_tui.tui.session_picker.session_view
1 jcode_base.mcp.protocol
2 jcode_config_types
3 jcode_message_types
4 jcode_protocol.wire.events
5 jcode_provider_metadata
6 jcode_side_panel_types
7 jcode_task_types
8 jcode_transport.windows
9 jcode_usage_types
10 ratatui_core.layout.rect
11 ratatui_core.style
12 scripts
13 jcode_base.auth.status_types2
14 jcode_base.bus211
15 jcode_base.usage.model11
16 jcode_harness_api.events1
17 jcode_provider_core1
18 jcode_session_types4
19 jcode_tool_core1
20 jcode_tui.tui.cloud_latency2
21 ratatui_core.buffer.buffer1
22 ratatui_core.style.stylize2
23 jcode.cli.provider_init231
24 jcode_app_core.tool11
25 jcode_app_core.tool.remote_exec11
26 jcode_protocol211
27 jcode_tui_messages.message11
28 ratatui_core.widgets.widget11
29 jcode_app_core.server.state112
30 jcode_base.session11162
31 jcode_tui.tui.backend112114
32 jcode_tui.tui.info_widget111
33 ratatui_widgets.block21111
34 jcode_app_core.agent11311154221
35 jcode_tui.tui.session_picker2111111
36 jcode_app_core.server1121
37 jcode_tui.tui.app412221118352172113116
38 jcode_tui.tui312131111212
39 jcode.bin.tui_bench312111211123
40 jcode_tui.tui.session_picker.session_view31111111133
Uses a module listed above itPart of a loopThe module itself
1 jcode_base.mcp.protocol2 jcode_config_types3 jcode_message_types4 jcode_protocol.wire.events5 jcode_provider_metadata6 jcode_side_panel_types7 jcode_task_types8 jcode_transport.windows9 jcode_usage_types10 ratatui_core.layout.rect11 ratatui_core.style12 scripts13 jcode_base.auth.status_types14 jcode_base.bus15 jcode_base.usage.model16 jcode_harness_api.events17 jcode_provider_core18 jcode_session_types19 jcode_tool_core20 jcode_tui.tui.cloud_latency21 ratatui_core.buffer.buffer22 ratatui_core.style.stylize23 jcode.cli.provider_init24 jcode_app_core.tool25 jcode_app_core.tool.remote_exec26 jcode_protocol27 jcode_tui_messages.message28 ratatui_core.widgets.widget29 jcode_app_core.server.state30 jcode_base.session31 jcode_tui.tui.backend32 jcode_tui.tui.info_widget33 ratatui_widgets.block34 jcode_app_core.agent35 jcode_tui.tui.session_picker36 jcode_app_core.server37 jcode_tui.tui.app38 jcode_tui.tui39 jcode.bin.tui_bench40 jcode_tui.tui.session_picker.session_viewjcode_base.mcp.protocol1jcode_config_types2jcode_message_types3jcode_protocol.wire.events4jcode_provider_metadata5jcode_side_panel_types6jcode_task_types7jcode_transport.windows8jcode_usage_types9ratatui_core.layout.rect10ratatui_core.style11scripts12jcode_base.auth.status_types13jcode_base.bus14jcode_base.usage.model15jcode_harness_api.events16jcode_provider_core17jcode_session_types18jcode_tool_core19jcode_tui.tui.cloud_latency20ratatui_core.buffer.buffer21ratatui_core.style.stylize22jcode.cli.provider_init23jcode_app_core.tool24jcode_app_core.tool.remote_exec25jcode_protocol26jcode_tui_messages.message27ratatui_core.widgets.widget28jcode_app_core.server.state29jcode_base.session30jcode_tui.tui.backend31jcode_tui.tui.info_widget32ratatui_widgets.block33jcode_app_core.agent34jcode_tui.tui.session_picker35jcode_app_core.server36jcode_tui.tui.app37jcode_tui.tui38jcode.bin.tui_bench39jcode_tui.tui.session_picker.session_view402211111141212231111121111111121116211211411121111113111542212111111112141222111835217211311631213111121231211121112331111111133+1216 more modules (most-connected shown)

At a glance — Code Health · 50% · Adequate · gated by D1, D2, R1 ·

At a glance — Architecture · 88% · Strong ·

At a glance — Maturity · 74% · Strong ·

At a glance — Readiness · 61% · Adequate · gated by P5 ·

At a glance — Security · 38% · Weak · gated by D29, C1 ·

At a glance — Event-Driven · 100% · Exemplary ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Performance · 70% · 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 — Injection127High / Critical
A03:2025 — Software Supply Chain Failures24Medium
A07:2025 — Authentication Failures3High / Critical

Roadmap

Top priorities: Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs). Skip if delegated to infra (Postgres TDE, KMS, etc.); Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up; Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).

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

Do thisHelpsEffortDimension
Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs). Skip if delegated to infra (Postgres TDE, KMS, etc.).+9.7 ptsMediumData Protection
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).+2.5 ptsLowStatic Analysis (SAST)
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.+3.8 ptsMediumType Safety
Resolve the 2 REDACTED finding(s) in Secrets (history) — start with REDACTED, REDACTED.+1.5 ptsLowSecrets (history)
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2).+1.5 ptsLowStatic Analysis (SAST)
Resolve the 9 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (9).+1.2 ptsLowDependency Vulnerabilities
Resolve the 7 Documentation finding(s) in Documentation Quality — start with README.md (7).+0.8 ptsLowDocumentation Quality
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.+0.8 ptsLowADR Quality

File quality

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

FileScoreBandWorst signal
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedSecrets (history): REDACTED: REDACTED
crates/jcode-harness-api-server/src/translate.rs4.8MixedCyclomatic Complexity: BridgeState::legacy_event_to_api_inner (cyclomatic 141)
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
crates/jcode-app-core/src/server/client_api.rs4.8MixedCode Duplication: Edited copy of a member (24 corresponding lines)
crates/jcode-app-core/src/server/client_comm_context.rs4.9MixedCognitive Complexity: jcode_app_core::server::client_comm_context::handle_comm_share (cognitive 20)
REDACTED5.0MixedStatic Analysis (SAST): High: REDACTED
crates/jcode-app-core/src/tool/discover.rs5.0MixedChange Coupling: Boundary-crossing change coupling: discover.rs ↔ benchmark_discovery.py
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedDependency Vulnerabilities: Medium advisory (unsound): REDACTED
crates/jcode-tui/src/tui/app/remote/key_handling.rs5.5MixedCyclomatic Complexity: jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input (cyclomatic 242)

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

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

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

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

Could not be resolved — 17

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 63 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 — 63 dimensions across the health lenses
D1D2D3D4D5D6D10D12D13D14D15D17D19D20D24D26D28D29D30D31D34D35D36D43AX10AX3AX4AX9C1C4ED3ES1ES2M1M2M3M4P1P10P2P3P4P5P6P8PF3R1R10R2R3R4R5R6R7R8R9X1X14X15X2X21X28X30

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, 4507 of 4609 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 · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic

Every finding is locatable in findings.md. Run 01a1daa9-b2fd-78d4-a86c-ea8bba8d5fbb.

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.

  • D8 Code Coverage — 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. Coverage NOT MEASURED: this repository's production source spans .rs, and our analyzer cannot run the .rs test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 94.8% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 240 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 634 test source file(s) (.py, .rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .rs, and the rust executor ran against the .rs half and did not finish re-running within its tier budget — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in sdk/typescript/ (90 tests); node:test via `npm install --ignore-scripts` (no lockfile) in telemetry-worker/ (175 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (61 contributor(s) across 11889 commit(s) sampled, automation and bot accounts excluded). One of them holds 98% of the history; the other 60 hold 0% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. (rule: no-root-manifest). The renderer reported: the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • 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 this repository's Python, Rust, Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust, Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 107 further occurrence(s) are not listed individually; the score already reflects all 147.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • 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 Python, Rust, Swift 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.
  • X7 Silent fallback defaults — 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. 46 further occurrence(s) are not listed individually; the score already reflects all 86.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • 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.
  • C4 Data Retention: This control is scored from in-repo evidence only — its real-world effectiveness, exercised only at runtime, is outside a static scan.
  • 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 Complexity3.6 / 10Weak✓ 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 3.6 / 10 · rule-coverage 100% · ceiling Prevented

561 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was jcode_tui::tui::app::remote::server_events::handle_server_event_inner at 414. A further 53 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being jcode_render_core::math::command_symbol at 141 — they are counted neither in the figure above nor in this dimension's score. 23 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: crates/jcode-protocol/src/lib.rs (Request::id at 90), crates/jcode-tui/src/tui/app/input_help.rs (App::command_help at 80), crates/jcode-setup-hints/src/keymap/macos_hotkeys.rs (jcode_setup_hints::keymap::macos_hotkeys::keycode_to_token at 69), crates/jcode-app-core/src/tool/computer/keys.rs (jcode_app_core::tool::computer::keys::ansi_keycode at 49), crates/jcode-app-core/src/tool/computer/mod.rs (jcode_app_core::tool::computer::dispatch at 46), and 18 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.

jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cyclomatic 414) · ×102crates/jcode-tui/src/tui/app/remote/server_events.rs:339
jcode_app_core::server::client_lifecycle::handle_client (cyclomatic 291) · ×69crates/jcode-app-core/src/server/client_lifecycle.rs:245
App::run_turn_interactive (cyclomatic 219) · ×59crates/jcode-tui/src/tui/app/turn.rs:64
jcode_base::session::render::render_messages_and_images_with_compacted_history (cyclomatic 42) · ×43crates/jcode-base/src/session/render.rs:365
jcode::bin::memory_recall_bench::cmd_metrics (cyclomatic 92) · ×37src/bin/memory_recall_bench.rs:1014

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

What to do

  1. Bring the 4 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cyclomatic 414), Config::apply_env_overrides (cyclomatic 312), jcode_app_core::server::client_lifecycle::handle_client (cyclomatic 291). — 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 4 together lifts Cyclomatic Complexity from 3.6 to about 4.3/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

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

D2 · Cognitive Complexity2.0 / 10Critical✓ 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.0 / 10 · rule-coverage 100% · ceiling Prevented

936 method(s) exceeded the cognitive complexity threshold of 15; the worst was App::run_turn_interactive at 763.

jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cognitive 717) · ×201crates/jcode-tui/src/tui/app/remote/server_events.rs:339
jcode_app_core::server::client_lifecycle::handle_client (cognitive 570) · ×120crates/jcode-app-core/src/server/client_lifecycle.rs:245
jcode_base::session::render::render_messages_and_images_with_compacted_history (cognitive 80) · ×81crates/jcode-base/src/session/render.rs:365
App::run_turn_interactive (cognitive 763) · ×74crates/jcode-tui/src/tui/app/turn.rs:64
jcode::bin::memory_recall_bench::cmd_metrics (cognitive 176) · ×62src/bin/memory_recall_bench.rs:1014

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

What to do

  1. Bring the 35 bodies over 120 down to 120 or less in Cognitive Complexity — start with App::run_turn_interactive (cognitive 763), jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cognitive 717), jcode_app_core::server::client_lifecycle::handle_client (cognitive 570). — 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 35 together lifts Cognitive Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

D3 · God Classes7.8 / 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 7.8 / 10 · rule-coverage 100% · ceiling Prevented

654 god class(es) detected.

FunctionTooLong: jcode_app_core::server::client_lifecycle::handle_client · ×241crates/jcode-app-core/src/server/client_lifecycle.rs:245
FileTooLong: tui/ui_messages.rs · ×212crates/jcode-tui/src/tui/ui_messages.rs
MethodTooLong: Agent.run_turn_streaming_mpsc · ×111crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:14
ClassTooLong: BridgeState · ×31crates/jcode-harness-api-server/src/translate.rs:125
TooManyFields: App · ×24crates/jcode-tui/src/tui/app.rs:935

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

What to do

  1. Resolve the 241 FunctionTooLong finding(s) in God Classes — start with lib.rs (14), ui_messages.rs (7), commands.rs (7). — One of this dimension's main actionable groups (241 warning-level).
  2. Resolve the 212 FileTooLong finding(s) in God Classes — start with lib.rs (30), mod.rs (5), commands.rs (2). — One of this dimension's main actionable groups (212 warning-level).
  3. Resolve the 111 MethodTooLong finding(s) in God Classes — start with lib.rs (10), auth.rs (7), mod.rs (6). — One of this dimension's main actionable groups (111 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

1202 duplicated block group(s) detected. 6.5 % of the production lines (46,614 of 717,097) are in a reported copy. A further 585 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 186 of the 1787 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (7 lines × 2) · ×102crates/jcode-app-core/src/replay.rs:773
Duplicated block (8 lines × 2) · ×87crates/jcode-app-core/src/server/client_api.rs:109
Duplicated block (9 lines × 2) · ×81crates/jcode-app-core/src/agent/status.rs:5
Duplicated block (6 lines × 2) · ×76crates/jcode-app-core/src/channel.rs:630
Duplicated block (10 lines × 2) · ×69crates/jcode-app-core/src/agent/status.rs:78

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

What to do

  1. Resolve the 102 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with lib.rs (11), memory_recall_bench.rs (5), loading.rs (3). — One of this dimension's main actionable groups (102 warning-level).
  2. Resolve the 87 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with lib.rs (4), debug_swarm_read.rs (4), subscription_api.rs (3). — One of this dimension's main actionable groups (87 warning-level).
  3. Resolve the 81 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with lib.rs (7), remote.rs (3), safety.rs (2). — One of this dimension's main actionable groups (81 warning-level).

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

D5 · Coupling6.1 / 10Adequate✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

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

99 production modules (Cargo+npm), 0 dependency cycle(s), 8 unstable depended-on module(s). Read from the build's own module declarations; 38 module(s) off the main sequence, with abstractness counted on 84 of the 99 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: jcode-agent-runtime · ×38
Unstable project jcode-app-core
Unstable project jcode-protocol
Unstable project jcode-provider-bedrock
Unstable project jcode-provider-doctor

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

What to do

  1. Resolve the 38 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (38 warning-level).
  2. Resolve the 1 Unstable project jcode-app-core finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project jcode-protocol finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

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

D6 · Cohesion (LCOM4)9.9 / 10Stronggated by 4 serious findings✓ 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 9.9 / 10 · rule-coverage 100% · ceiling Verified

4 of 426 classes have LCOM4 above 3.

Low cohesion: MemoryManager (LCOM4 6) · ×4crates/jcode-base/src/memory.rs:184

What to do

  1. Resolve the 4 Low cohesion finding(s) in Cohesion (LCOM4) — start with memory.rs, lib.rs, cloud.rs. — One of this dimension's main actionable groups (4 warning-level).

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

D10 · Test Quality10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

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

1 skipped (1 with a documented reason), 0 zero-assertion, 1 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 240 tests. Measured on the JavaScript/TypeScript suite only — at least 634 test source file(s) (.py, .rs) went unread, so its test quality is unmeasured and is not in these counts.

Fixed-sleep synchronisation: concurrent configuration is rejected without changing the callback tablesdk/typescript/test/tools.test.ts:159
Skipped (documented): dashboard stays within a five-term SQLite compound SELECT budgettelemetry-worker/test/concurrency.test.mjs:340

What to do

  1. Resolve the 1 Fixed-sleep synchronisation finding(s) in Test Quality — start with tools.test.ts. — One of this dimension's main actionable groups (1 warning-level).

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

D12 · Dependency Hygiene8.0 7.9 / 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 7.9 / 10 · rule-coverage 99% · ceiling Verified

46 outdated, 0 yanked direct Cargo dependencies. 98 of 99 direct crates were graded against crates.io (0 not published there, 1 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: anyhow · ×46

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

D13 · REDACTED 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

REDACTED 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 914 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. A further 2 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.2 / 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.2 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: crates/jcode-tui/src/tui/app/remote/server_events.rs (101×414=41814); crates/jcode-app-core/src/server/client_lifecycle.rs (91×291=26481); crates/jcode-tui/src/tui/app/remote/key_handling.rs (52×242=12584) Repeated repair below the complexity floor: crates/jcode-provider-openrouter-runtime/src/lib.rs (19 of 36 changes were fixes); crates/jcode-tui-mermaid/src/lib.rs (8 of 11 changes were fixes); crates/jcode-message-types/src/lib.rs (7 of 10 changes were fixes)

Hotspot: crates/jcode-tui/src/tui/app/remote/server_events.rs · ×174crates/jcode-tui/src/tui/app/remote/server_events.rs:339
Repeated repair: crates/jcode-provider-openrouter-runtime/src/lib.rs · ×31crates/jcode-provider-openrouter-runtime/src/lib.rs:867

What to do

  1. Resolve the 174 Hotspot finding(s) in Churn × Complexity Hotspots — start with lib.rs (11), mod.rs (3), server.rs (2). — One of this dimension's main actionable groups (174 warning-level).
  2. Resolve the 31 Repeated repair finding(s) in Churn × Complexity Hotspots — start with lib.rs (6), mermaid_runtime.rs, mermaid.rs. — One of this dimension's main actionable groups (31 warning-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 28 serious findings✓ Tool-verified

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

28 deducted task-comment markers across 717097 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.

TodoComment · ×28crates/jcode-tui-render/src/swarm_gallery.rs:1724

What to do

  1. Resolve the 28 TodoComment finding(s) in Explicit Debt — start with lib.rs (5), ui_messages.rs (3), todo.rs (3). — One of this dimension's main actionable groups (28 warning-level).

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

D19 · Documentation Quality0.7 / 10Critical✓ Tool-verified

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 0.7 / 10 · rule-coverage 100% · ceiling Documented

0 of 2 documentation facets pass in full; short on: F2 example, F4 map. 151 document(s) read across 8 unit(s).

Documentation: no build, run or usage example · ×7sdk/npm/darwin-arm64/README.md:1

What to do

  1. Resolve the 7 Documentation finding(s) in Documentation Quality — start with README.md (7). — One of this dimension's main actionable groups (7 recommendation-level).

Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.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 foundCargo.toml:108

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.

D24 · Comment Value10.0 9.5 / 10Exemplary○ Nothing flagged

What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).

Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.

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

0 of 153 judged comments only repeat the code they sit on (0.0 %). 9 comment(s) in another language or script were not judged.

✓ On the Gold path — maintain.

Detailed fixes: d24_recommendation.md.

D26 · Project Cohesion9.1 / 10Exemplary✓ 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 9.1 / 10 · rule-coverage 100% · ceiling Documented

4 of 93 build units (Cargo, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

✓ On the Gold path — maintain.

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

D28 · Secrets (history)8.0 / 10Adequategated by 2 critical findings✓ Tool-verified

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

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

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

2 finding(s): 0 critical, 2 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

  1. Resolve the 2 REDACTED finding(s) in Secrets (history) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

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

D29 · Static Analysis (SAST)1.8 / 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.8 / 10 · rule-coverage 100% · ceiling Documented

127 finding(s): 0 critical, 127 high, 0 medium, 0 low. 117 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 37 file(s) — `crates/jcode-app-core/src/tool/webfetch.rs` (line 214), `crates/jcode-app-core/src/tool/websearch.rs` (line 691), `crates/jcode-base/src/hooks_tests.rs` (line 37, lines 64–65, line 65), `crates/jcode-base/src/platform.rs` (line 17, line 27, line 35, …), `crates/jcode-base/src/process_memory.rs` (line 548, line 574), … (+32 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 9 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

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

What to do

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

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

D30 · Dependency Vulnerabilities6.6 / 10Adequate✓ 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 6.6 / 10 · rule-coverage 100% · ceiling Documented

19 finding(s): 0 critical, 0 high, 18 medium, 1 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 9 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (9). — One of this dimension's main actionable groups (9 warning-level).
  2. Resolve the 5 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (5). — One of this dimension's main actionable groups (5 warning-level).
  3. Resolve the 3 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).

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

D31 · IaC & Container Security10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

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

trivy and checkov found no infrastructure-as-code or container misconfigurations.

✓ On the Gold path — maintain.

Detailed fixes: d31_recommendation.md.

D34 · Knowledge Freshness10.0 / 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 1340 of the 1530 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling9.4 / 10Adequategated by 3 critical 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.4 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: comm_session.rs↔debug_session_admin.rs 100%; markdown_render_full.rs↔markdown_render_lazy.rs 95%; client_api.rs↔randomized.rs 92%

Boundary-crossing change coupling: discover.rs ↔ benchmark_discovery.py · ×3crates/jcode-app-core/src/tool/discover.rs:1
Change coupling: comm_session.rs ↔ debug_session_admin.rs · ×29crates/jcode-app-core/src/server/comm_session.rs:1
Change-coupling hub: randomized.rs → client_api.rs, client_lifecycle.rs, translate.rs, backend.rs · ×6crates/jcode-protocol/src/protocol_tests/randomized.rs

What to do

  1. Resolve the 3 Boundary-crossing change coupling finding(s) in Change Coupling — start with discover.rs, accessors.rs, misc_events.rs. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 29 Change coupling finding(s) in Change Coupling — start with client_api.rs (2), tests.rs (2), core_events.rs (2). — One of this dimension's main actionable groups (29 warning-level).
  3. Resolve the 6 Change-coupling hub finding(s) in Change Coupling — start with comm_requests.rs (2), randomized.rs, misc_events.rs. — One of this dimension's main actionable groups (6 warning-level).

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

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ 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 5.0 / 10 · rule-coverage 100% · ceiling Documented

2/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 — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

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

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.9 / 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 direction7.5 / 10Strong✓ 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.

  • `jcode-app-core` is a Domain project but references `jcode-harness-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.

What to do

  • Keep dependencies pointing inward: domain/application define interfaces, infrastructure/web implement them (Dependency Inversion).
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.

  • `communicate$module.fetch_awaited_member_reports` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command. — crates/jcode-app-core/src/tool/communicate.rs:348

What to do

  • Keep query handlers read-only — move the writes/event-publishes into a command handler so reads stay safe to retry, cache, and route to a read replica.
C1 · Data Protection0.0 / 10Critical✓ Tool-verified

Other · Security — Whether sensitive data is encrypted at rest and in transit and keys are vaulted.

Method: Roslyn plus filesystem scan: encryption presence (EF ColumnEncryption, key-vault references, HTTPS enforcement) and key-derivation KDF detection. Deterministic.

  • No encryption usage (RustCrypto's aes-gcm/chacha20poly1305 encrypting, ring or aws-lc-rs aead sealing, orion, libsodium's secretbox, openssl symm, age, SQLCipher keyed by PRAGMA key, pgcrypto, MongoDB client-side field-level encryption, the OS keyring) was found, and this repository persists personal data in the model cited here — sensitive data at rest may be unprotected. If TDE/KMS/vault is delegated to infrastructure, ignore. — telemetry-worker/schema.sql:7

What to do

  • Encrypt sensitive data at rest (encrypt the fields with aes-gcm or chacha20poly1305 before they are written, or open the store encrypted — SQLCipher for rusqlite/sqlx, MongoDB CSFLE) and manage keys in a vault (AWS KMS / Secrets Manager through aws-sdk-kms, GCP KMS / REDACTED Manager, Azure Key Vault, HashiCorp Vault through vaultrs). Skip if delegated to infra (Postgres TDE, KMS, etc.).
  • Enforce HTTPS on the server that receives this data: terminate TLS in it (axum-server/actix bind_rustls, tonic ServerTlsConfig, a tokio-rustls acceptor) and send Strict-Transport-Security, or run it behind a TLS-terminating proxy, so data in transit is always encrypted.
C4 · Data Retention7.5 / 10Strong✓ Tool-verified

Other · Security — Whether data has a defined lifetime — retention periods, TTLs, cleanup jobs (storage limitation).

Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.

  • A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept.

What to do

  • Complete the data-lifecycle story: an expiry limit (a declared maximum age for the stored data — a retention-age setting, or a store-level TTL where your storage offers one), a scheduled purge/cleanup job that enforces it, and a documented retention period covering the personal data.
ED3 · Event naming10.0 / 10Exemplary✓ Tool-verified

Other · Event-Driven — Whether persisted/published domain events are named in the past tense (facts that happened) rather than imperatively.

Method: Roslyn scan (event-driven gated): domain and integration events checked for past-tense naming (-ed/-en suffix or irregular set). Naming nudge, low-weight advisory.

  • `UpdateStatus` is an imperative name inside a domain-event set whose siblings are past-tense facts — it reads as an intent, not something that happened. Name new events for the fact that occurred (e.g. `ItemAdded`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe. — crates/jcode-base/src/bus.rs:422

What to do

  • Name new events in the past tense: they record facts that already happened. Do not rename an event that is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it.
ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)6.9 / 10Adequate✓ 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.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation5.0 / 10Adequate✓ 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 & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability6.9 / 10Adequate✓ 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.

  • Only 14/22 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `crates/jcode-harness-api-server`, `crates/jcode-provider-bedrock`, `crates/jcode-provider-core` and 3 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling4.0 / 10Weak✓ 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.

  • `sdk/typescript/examples/demo-app/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — sdk/typescript/examples/demo-app/package.json:9

What to do

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ 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.

P5 · DR & Backup3.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.

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.

P8 · Schema migrations10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

PF3 · Async & latency hygiene7.0 / 10Strong✓ 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.

  • `run` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — crates/jcode-app-core/src/server.rs:2379
  • `run` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — crates/jcode-codemode/src/engine.rs:97

What to do

  • Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
R1 · Type Safety0.0 / 10Critical✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

  • 0 typed · 21 plain JS — the untyped files are scripts/accept_live_local_message.mjs, scripts/accept_live_local_message.test.mjs, scripts/test_version_sdk_release.mjs, scripts/version_sdk_release.mjs, telemetry-worker/scripts/model-price-report.mjs, telemetry-worker/scripts/move-bulk-events.mjs (+15 more).

What to do

  • Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
R10 · Code Duplication5.9 / 10Adequate✓ Tool-verified

React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.

  • telemetry-worker/src/worker.js:1579 · telemetry-worker/src/worker.js:1793 — the two spans are one implementation copied and then locally edited — 372 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — telemetry-worker/src/worker.js:1579
  • telemetry-worker/src/worker.js:291 · telemetry-worker/src/worker.js:435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — telemetry-worker/src/worker.js:291
  • telemetry-worker/src/worker.js:426 · telemetry-worker/src/worker.js:474 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:426
  • telemetry-worker/src/worker.js:586 · telemetry-worker/src/worker.js:621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — telemetry-worker/src/worker.js:586
  • telemetry-worker/src/worker.js:1350 · telemetry-worker/src/worker.js:1366 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:1350
  • telemetry-worker/src/worker.js:1500 · telemetry-worker/src/worker.js:1611 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — telemetry-worker/src/worker.js:1500
  • telemetry-worker/src/worker.js:1537 · telemetry-worker/src/worker.js:1798 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — telemetry-worker/src/worker.js:1537
  • scripts/accept_live_local_message.mjs:40 · scripts/accept_live_local_message.mjs:67 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/accept_live_local_message.mjs:40
  • telemetry-worker/src/worker.js:1206 · telemetry-worker/src/worker.js:1222 · telemetry-worker/src/worker.js:1238 · telemetry-worker/src/worker.js:1270 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:1206
  • telemetry-worker/src/worker.js:2008 · telemetry-worker/src/worker.js:2044 · telemetry-worker/src/worker.js:2071 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:2008
  • telemetry-worker/src/worker.js:1989 · telemetry-worker/src/worker.js:2015 · telemetry-worker/src/worker.js:2078 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:1989
  • telemetry-worker/src/worker.js:1230 · telemetry-worker/src/worker.js:1246 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:1230
  • telemetry-worker/src/worker.js:411 · telemetry-worker/src/worker.js:467 · telemetry-worker/src/worker.js:490 — 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. — telemetry-worker/src/worker.js:411
  • telemetry-worker/src/worker.js:2232 · telemetry-worker/src/worker.js:2267 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — telemetry-worker/src/worker.js:2232

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R2 · Cyclomatic Complexity6.7 / 10Adequate✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • insertEvent has cyclomatic complexity 135 and cognitive complexity 145; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1183
  • fetch has cyclomatic complexity 64 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:510
  • insertTurnDetails has cyclomatic complexity 49 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1579
  • classifyConcurrency has cyclomatic complexity 40 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/concurrency.js:20
  • normalizeUsageReportEvent has cyclomatic complexity 38 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:2359
  • oauthAccount has cyclomatic complexity 38 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/oauth-account.js:14
  • insertSessionDetails has cyclomatic complexity 35 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1793
  • normalizeWebEvent has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:2102
  • pruneOldEvents has cyclomatic complexity 32 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1044
  • insertTodoSessionDetails has cyclomatic complexity 28 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:2015
  • main has cyclomatic complexity 22 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/accept_live_local_message.mjs:89
  • insertWebDetails has cyclomatic complexity 21 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:2051
  • resolvePriceRows has cyclomatic complexity 20 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/model-pricing.js:160
  • normalizeDiscoveryEvent has cyclomatic complexity 19 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:2243
  • (anonymous) has cyclomatic complexity 18 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:700
  • validateTranscript has cyclomatic complexity 17 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:867
  • (anonymous) has cyclomatic complexity 16 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/scripts/move-bulk-events.mjs:90
  • normalizeInstallFunnelEvent has cyclomatic complexity 16 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:2187
  • q has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/scripts/move-bulk-events.mjs:32
  • execute has cyclomatic complexity 15 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/scripts/run-retention.mjs:42
  • writeFirehose has cyclomatic complexity 15 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:374
  • recordDailyActivity has cyclomatic complexity 14 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1654
  • ingestTranscript has cyclomatic complexity 13 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:796
  • insertDiscoveryDetails has cyclomatic complexity 13 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1989
  • syncModelPrices has cyclomatic complexity 12 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/model-pricing.js:320
  • buildModelPriceReport has cyclomatic complexity 12 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/scripts/model-price-report.mjs:3
  • commonEventEntries has cyclomatic complexity 12 and cognitive complexity 11; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:1863
  • main has cyclomatic complexity 11 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/scripts/sync-model-prices.mjs:83
  • normalizeLabel has cyclomatic complexity 11 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/model-pricing.js:67
  • writeConcurrencyFirehose has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — telemetry-worker/src/worker.js:320
R3 · Large Files6.7 / 10Adequate✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • telemetry-worker/src/worker.js has 2342 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — telemetry-worker/src/worker.js:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage6.7 / 10Adequate✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×3) — telemetry-worker/scripts/sync-model-prices.mjs:1, telemetry-worker/scripts/move-bulk-events.mjs:1, telemetry-worker/scripts/run-dashboard.mjs:1

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness9.3 / 10Exemplary✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

R8 · Dependency Hygiene10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

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.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader3.5 / 10Weak✓ Tool-verified

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

  • `entry_count` is read from the bytes being parsed at line 283 (`read_u32`), then used to size a `Vec::with_capacity` at line 284 — and nowhere in its scope is `entry_count` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `entry_count` against the bytes actually remaining and a maximum the format allows before allocating. — crates/jcode-app-core/src/tool/session_search_index.rs:284

What to do

  • Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
X2 · Cancellation propagation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

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 Health50%Adequate — gated by D1, D2, R1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture88%StrongSolid.
Maturity74%StrongSolid.
Readiness61%Adequate — gated by P5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security38%Weak — gated by D29, C1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event-Driven100%ExemplaryStrongest area.
Event Sourcing100%ExemplarySolid.
Performance70%StrongSolid.
Unscored — 4 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.

  • SC1 Supply-chain hygiene — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 24 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Repo shows no audit-logging mechanism (an audit-log table or model — a struct, Diesel table, SeaORM entity or SQL migration table named for it — a SeaORM ActiveModelBehavior hook or database trigger that records each change, or an event-sourced store beside one) for sensitive changes — absence of evidence is not evidence of a working control. Record an audit trail in code (or document where it lives) so this dimension can be scored.
  • C5 Data-Subject Rights — Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary — absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
Not included — 63 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: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's Swift imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — AX6 reached only 1% of this repository's production lines — rust (692,703 lines), python (24,227 lines), swift (167 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • 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 — D21 withholds its case and prefix conventions rows: 4 candidate(s) found and not reported.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust, TypeScript 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. Aggregate roots were found in only one source directory (jcode-base), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • 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
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
  • DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 1 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 213 value object(s); 9 domain event(s); its domain events are published by services or handlers — no domain entity raises one; no aggregate is declared and no domain structure surrounds the state-guarding types: not claimed as DDD
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • 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.
  • 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'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust, Swift source, so there is no service whose uptime a failing dependency could take down
  • P9 Domain vs controller coverage — coverage data present for 39 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.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • S1 Web-Security Posture — No web surface: 1237 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
  • X12 Unreachable branch — X12 reached only 4% of this repository's production lines — rust (692,703 lines), swift (167 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — X16 reached only 1% of this repository's production lines — rust (692,703 lines), python (24,227 lines), swift (167 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • 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 — X3 reached only 4% of this repository's production lines — rust (692,703 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • 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 — 134 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
  • + 92 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Boundary-crossing change coupling · ×3
  • Boundary-crossing change coupling: discover.rs ↔ benchmark_discovery.py crates/jcode-app-core/src/tool/discover.rs:1 — `crates/jcode-app-core/src/tool/discover.rs` (context crates) and `scripts/benchmark_discovery.py` (context scripts) sit in DIFFERENT parts of the tree yet change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `bd64f8f8` fix(discovery): enforce provenance report contract; `0c641dfc` fix(discovery): enforce provenance report contract; `977d49c4` Rename discover_tools to integration_tools with search/setup actions — run `git show` on any of them.
  • Boundary-crossing change coupling: accessors.rs ↔ startup.rs crates/jcode-base/src/provider/accessors.rs:1 — `crates/jcode-base/src/provider/accessors.rs` (context crates) and `src/cli/startup.rs` (context cli) sit in DIFFERENT parts of the tree yet change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `3e4f0933` refactor(providers): remove the Claude Code CLI subprocess transport; `3d187f4a` refactor(provider): move OpenRouter runtime out of jcode-base into do…; `a8faf98f` refactor(provider): move Anthropic runtime out of jcode-base (base wi… — run `git show` on any of them.
  • Boundary-crossing change coupling: misc_events.rs ↔ acp.rs crates/jcode-app-core/src/protocol_tests/misc_events.rs:1 — `crates/jcode-app-core/src/protocol_tests/misc_events.rs` (context crates) and `src/cli/acp.rs` (context cli) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `753f0d10` feat(router): server-side account failover for Desktop/SDK clients; `1e2c6de9` feat(server): opt in to disconnected remote turn continuation; `5b63e5f6` feat(server): opt in to disconnected remote turn continuation — run `git show` on any of them.
D28 · Secrets (history) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
AX4 · Dependency direction · Dependency-rule violation · ×1
  • Dependency-rule violation: jcode-app-core (Domain) → jcode-harness-api (Web) — `jcode-app-core` is a Domain project but references `jcode-harness-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
AX9 · CQS / query purity · Query writes persistent state on the read path · ×1
  • Query writes persistent state on the read path: communicate$module.fetch_awaited_member_reports crates/jcode-app-core/src/tool/communicate.rs:348 — `communicate$module.fetch_awaited_member_reports` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 4306 finding(s)
D3 · God Classes · FunctionTooLong · ×241
  • FunctionTooLong: jcode_app_core::server::client_lifecycle::handle_client crates/jcode-app-core/src/server/client_lifecycle.rs:245 — FunctionTooLong — jcode_app_core::server::client_lifecycle::handle_client runs 2430 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 2330 over it, 24.30× 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: jcode_tui::tui::app::remote::server_events::handle_server_event_inner crates/jcode-tui/src/tui/app/remote/server_events.rs:339 — FunctionTooLong — jcode_tui::tui::app::remote::server_events::handle_server_event_inner runs 2301 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 2201 over it, 23.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input crates/jcode-tui/src/tui/app/remote/key_handling.rs:283 — FunctionTooLong — jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input runs 1316 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 1216 over it, 13.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: jcode::bin::memory_recall_bench::cmd_metrics src/bin/memory_recall_bench.rs:1014 — FunctionTooLong — jcode::bin::memory_recall_bench::cmd_metrics runs 815 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 715 over it, 8.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls crates/jcode-tui-markdown/src/markdown_render_full.rs:24 — FunctionTooLong — jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls runs 759 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 659 over it, 7.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::ui_viewport::draw_messages crates/jcode-tui/src/tui/ui_viewport.rs:322 — FunctionTooLong — jcode_tui::tui::ui_viewport::draw_messages runs 712 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 612 over it, 7.12× 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: jcode_tui::tui::ui::draw_inner crates/jcode-tui/src/tui/ui.rs:2981 — FunctionTooLong — jcode_tui::tui::ui::draw_inner runs 711 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 611 over it, 7.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.
  • FunctionTooLong: jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request crates/jcode-app-core/src/server/client_lightweight_control.rs:246 — FunctionTooLong — jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request runs 702 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 602 over it, 7.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: jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls crates/jcode-tui-markdown/src/markdown_render_lazy.rs:16 — FunctionTooLong — jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls runs 702 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 602 over it, 7.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: jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command crates/jcode-app-core/src/server/debug_swarm_read.rs:20 — FunctionTooLong — jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command runs 645 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 545 over it, 6.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: jcode_app_core::server::client_session::handle_resume_session crates/jcode-app-core/src/server/client_session.rs:1285 — FunctionTooLong — jcode_app_core::server::client_session::handle_resume_session 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: jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:539 — FunctionTooLong — jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked runs 580 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 480 over it, 5.80× 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: jcode_tui::tui::ui_tools::get_tool_summary_with_budget crates/jcode-tui/src/tui/ui_tools.rs:847 — FunctionTooLong — jcode_tui::tui::ui_tools::get_tool_summary_with_budget runs 572 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 472 over it, 5.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs:18 — FunctionTooLong — jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal runs 546 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 446 over it, 5.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_provider_cursor_runtime::agent_transport::run_agent_turn crates/jcode-provider-cursor-runtime/src/agent_transport.rs:758 — FunctionTooLong — jcode_provider_cursor_runtime::agent_transport::run_agent_turn runs 523 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 423 over it, 5.23× 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: jcode::cli::dispatch::run_main src/cli/dispatch.rs:74 — FunctionTooLong — jcode::cli::dispatch::run_main runs 482 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 382 over it, 4.82× 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: jcode_tui::tui::ui_messages::render_tool_message crates/jcode-tui/src/tui/ui_messages.rs:3961 — FunctionTooLong — jcode_tui::tui::ui_messages::render_tool_message runs 479 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 379 over it, 4.79× 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: jcode::bin::tui_bench::main src/bin/tui_bench.rs:1212 — FunctionTooLong — jcode::bin::tui_bench::main runs 452 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 352 over it, 4.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_tui::tui::app::state_ui::format_cache_stats crates/jcode-tui/src/tui/app/state_ui.rs:1225 — FunctionTooLong — jcode_tui::tui::app::state_ui::format_cache_stats runs 440 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 340 over it, 4.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.
  • FunctionTooLong: jcode_render_core::markdown::parse_markdown_with_options crates/jcode-render-core/src/markdown.rs:198 — FunctionTooLong — jcode_render_core::markdown::parse_markdown_with_options runs 425 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 325 over it, 4.25× 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: jcode_app_core::server::comm_control::handle_comm_task_control crates/jcode-app-core/src/server/comm_control.rs:1690 — FunctionTooLong — jcode_app_core::server::comm_control::handle_comm_task_control runs 407 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 307 over it, 4.07× 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: jcode_tui::tui::ui_overlays::draw_help_overlay crates/jcode-tui/src/tui/ui_overlays.rs:223 — FunctionTooLong — jcode_tui::tui::ui_overlays::draw_help_overlay runs 400 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 300 over it, 4.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: jcode_app_core::server::debug_command_exec::execute_debug_command crates/jcode-app-core/src/server/debug_command_exec.rs:162 — FunctionTooLong — jcode_app_core::server::debug_command_exec::execute_debug_command runs 396 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 296 over it, 3.96× 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: jcode_tui::tui::ui_inline_interactive::draw_inline_interactive crates/jcode-tui/src/tui/ui_inline_interactive.rs:595 — FunctionTooLong — jcode_tui::tui::ui_inline_interactive::draw_inline_interactive runs 393 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 293 over it, 3.93× 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: jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1410 — FunctionTooLong — jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated runs 365 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 265 over it, 3.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.
  • + 216 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×212
  • FileTooLong: tui/ui_messages.rs crates/jcode-tui/src/tui/ui_messages.rs — FileTooLong — 3362 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 94 free functions. The bar is 500 significant lines; this is 2862 over it, 6.72× 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/inline_interactive.rs crates/jcode-tui/src/tui/app/inline_interactive.rs — FileTooLong — 2962 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 85% of them inside a single declaration: App (634-4237). The bar is 500 significant lines; this is 2462 over it, 5.92× 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/input.rs crates/jcode-tui/src/tui/app/input.rs — FileTooLong — 2728 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 2228 over it, 5.46× 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: server/client_lifecycle.rs crates/jcode-app-core/src/server/client_lifecycle.rs — FileTooLong — 2675 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 2175 over it, 5.35× 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/commands.rs crates/jcode-tui/src/tui/app/commands.rs — FileTooLong — 2616 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 129 free functions. The bar is 500 significant lines; this is 2116 over it, 5.23× 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: cli/commands.rs src/cli/commands.rs — FileTooLong — 2570 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 77 free functions. The bar is 500 significant lines; this is 2070 over it, 5.14× 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: remote/server_events.rs crates/jcode-tui/src/tui/app/remote/server_events.rs — FileTooLong — 2502 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 2002 over it, 5.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: app/auth.rs crates/jcode-tui/src/tui/app/auth.rs — FileTooLong — 2459 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: App (85-3398). The bar is 500 significant lines; this is 1959 over it, 4.92× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/translate.rs crates/jcode-harness-api-server/src/translate.rs — FileTooLong — 2414 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: BridgeState (3 blocks, 125-3520). The bar is 500 significant lines; this is 1914 over it, 4.83× 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: tui/ui.rs crates/jcode-tui/src/tui/ui.rs — FileTooLong — 2187 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 92 free functions. The bar is 500 significant lines; this is 1687 over it, 4.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: provider/mod.rs crates/jcode-base/src/provider/mod.rs — FileTooLong — 2150 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: MultiProvider (4 blocks, 387-3076). The bar is 500 significant lines; this is 1650 over it, 4.30× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/lib.rs crates/jcode-telemetry-core/src/lib.rs — FileTooLong — 2049 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 87 free functions. The bar is 500 significant lines; this is 1549 over it, 4.10× 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/ui_input.rs crates/jcode-tui/src/tui/ui_input.rs — FileTooLong — 2026 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 79 free functions. The bar is 500 significant lines; this is 1526 over it, 4.05× 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: cli/cloud_move.rs src/cli/cloud_move.rs — FileTooLong — 1992 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 68 free functions. The bar is 500 significant lines; this is 1492 over it, 3.98× 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_picker/loading.rs crates/jcode-tui/src/tui/session_picker/loading.rs — FileTooLong — 1968 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 71 free functions. The bar is 500 significant lines; this is 1468 over it, 3.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: server/comm_control.rs crates/jcode-app-core/src/server/comm_control.rs — FileTooLong — 1916 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 1416 over it, 3.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tui/ui_prepare.rs crates/jcode-tui/src/tui/ui_prepare.rs — FileTooLong — 1908 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 46 free functions. The bar is 500 significant lines; this is 1408 over it, 3.82× 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: bin/memory_recall_bench.rs src/bin/memory_recall_bench.rs — FileTooLong — 1890 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 33 free functions. The bar is 500 significant lines; this is 1390 over it, 3.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: app/tui_state.rs crates/jcode-tui/src/tui/app/tui_state.rs — FileTooLong — 1873 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: App (4 blocks, 134-2862). The bar is 500 significant lines; this is 1373 over it, 3.75× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/lib.rs crates/jcode-provider-openrouter-runtime/src/lib.rs — FileTooLong — 1817 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: OpenRouterProvider (2 blocks, 820-2846). The bar is 500 significant lines; this is 1317 over it, 3.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/worker.js telemetry-worker/src/worker.js — FileTooLong — 1768 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1268 over it, 3.54× 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/app.rs crates/jcode-tui/src/tui/app.rs — FileTooLong — 1753 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: App (2 blocks, 935-2917). The bar is 500 significant lines; this is 1253 over it, 3.51× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/server.rs crates/jcode-app-core/src/server.rs — FileTooLong — 1751 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: Server (2 blocks, 553-2564). The bar is 500 significant lines; this is 1251 over it, 3.50× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/lib.rs crates/jcode-provider-anthropic-runtime/src/lib.rs — FileTooLong — 1740 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 1240 over it, 3.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: app/state_ui.rs crates/jcode-tui/src/tui/app/state_ui.rs — FileTooLong — 1738 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 1238 over it, 3.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 187 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode_tui · ×201
  • jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cognitive 717) crates/jcode-tui/src/tui/app/remote/server_events.rs:339 — jcode_tui::tui::app::remote::server_events::handle_server_event_inner has cognitive complexity 717 (threshold 15). Drivers by points: if/else 271 (583 pts), boolean chains 89, match/switch 14 (40 pts), loops 2 (5 pts) (nesting depth added 341). 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.
  • jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input (cognitive 357) crates/jcode-tui/src/tui/app/remote/key_handling.rs:283 — jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input has cognitive complexity 357 (threshold 15). Drivers by points: if/else 200 (286 pts), boolean chains 36, match/switch 15 (35 pts) (nesting depth added 106). 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.
  • jcode_tui::tui::ui_viewport::draw_messages (cognitive 309) crates/jcode-tui/src/tui/ui_viewport.rs:322 — jcode_tui::tui::ui_viewport::draw_messages has cognitive complexity 309 (threshold 15). Drivers by points: if/else 116 (244 pts), loops 15 (27 pts), boolean chains 26, match/switch 3 (12 pts) (nesting depth added 149). 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.
  • jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal (cognitive 226) crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs:18 — jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal has cognitive complexity 226 (threshold 15). Drivers by points: if/else 122 (180 pts), match/switch 11 (27 pts), boolean chains 19 (nesting depth added 74). 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.
  • jcode_tui::tui::ui_messages::render_tool_message (cognitive 199) crates/jcode-tui/src/tui/ui_messages.rs:3961 — jcode_tui::tui::ui_messages::render_tool_message has cognitive complexity 199 (threshold 15). Drivers by points: if/else 73 (123 pts), loops 14 (45 pts), boolean chains 29, match/switch 1 (2 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.
  • jcode_tui::tui::ui_inline_interactive::draw_inline_interactive (cognitive 175) crates/jcode-tui/src/tui/ui_inline_interactive.rs:595 — jcode_tui::tui::ui_inline_interactive::draw_inline_interactive has cognitive complexity 175 (threshold 15). Drivers by points: if/else 92 (141 pts), boolean chains 22, loops 4 (9 pts), match/switch 2 (3 pts) (nesting depth added 55). 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.
  • jcode_tui::tui::ui::draw_inner (cognitive 174) crates/jcode-tui/src/tui/ui.rs:2981 — jcode_tui::tui::ui::draw_inner has cognitive complexity 174 (threshold 15). Drivers by points: if/else 99 (137 pts), boolean chains 25, loops 3 (10 pts), match/switch 1 (2 pts) (nesting depth added 46). 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.
  • jcode_tui::tui::app::remote::handle_tick (cognitive 119) crates/jcode-tui/src/tui/app/remote.rs:94 — jcode_tui::tui::app::remote::handle_tick has cognitive complexity 119 (threshold 15). Drivers by points: if/else 43 (72 pts), boolean chains 22, match/switch 8 (20 pts), loops 3 (5 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.
  • jcode_tui::tui::app::remote::process_remote_followups (cognitive 107) crates/jcode-tui/src/tui/app/remote.rs:1461 — jcode_tui::tui::app::remote::process_remote_followups has cognitive complexity 107 (threshold 15). Drivers by points: if/else 47 (77 pts), boolean chains 23, loops 2 (4 pts), match/switch 1 (3 pts) (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.
  • jcode_tui::tui::ui_prepare::render_message_into (cognitive 101) crates/jcode-tui/src/tui/ui_prepare.rs:1428 — jcode_tui::tui::ui_prepare::render_message_into has cognitive complexity 101 (threshold 15). Drivers by points: if/else 27 (50 pts), loops 18 (43 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 51). 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.
  • jcode_tui::video_export::buffer_to_svg (cognitive 98) crates/jcode-tui/src/video_export.rs:612 — jcode_tui::video_export::buffer_to_svg has cognitive complexity 98 (threshold 15). Drivers by points: if/else 23 (69 pts), loops 9 (20 pts), boolean chains 9 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::app::commands::handle_session_command (cognitive 97) crates/jcode-tui/src/tui/app/commands.rs:1698 — jcode_tui::tui::app::commands::handle_session_command has cognitive complexity 97 (threshold 15). Drivers by points: if/else 56 (70 pts), boolean chains 10, match/switch 5 (10 pts), loops 3 (7 pts) (nesting depth added 23). 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.
  • jcode_tui::tui::info_widget_layout::calculate_placements_anchored (cognitive 88) crates/jcode-tui/src/tui/info_widget_layout.rs:125 — jcode_tui::tui::info_widget_layout::calculate_placements_anchored has cognitive complexity 88 (threshold 15). Drivers by points: if/else 30 (56 pts), boolean chains 16, match/switch 5 (9 pts), loops 5 (7 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::app::state_ui::handle_info_command (cognitive 87) crates/jcode-tui/src/tui/app/state_ui.rs:1895 — jcode_tui::tui::app::state_ui::handle_info_command has cognitive complexity 87 (threshold 15). Drivers by points: if/else 39 (71 pts), match/switch 4 (12 pts), loops 1 (3 pts), boolean chains 1 (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.
  • jcode_tui::tui::ui_tools::get_tool_summary_with_budget (cognitive 84) crates/jcode-tui/src/tui/ui_tools.rs:847 — jcode_tui::tui::ui_tools::get_tool_summary_with_budget has cognitive complexity 84 (threshold 15). Drivers by points: if/else 31 (53 pts), match/switch 16 (31 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.
  • jcode_tui::tui::session_picker::transcript_search::search_shard (cognitive 78) crates/jcode-tui/src/tui/session_picker/transcript_search.rs:752 — jcode_tui::tui::session_picker::transcript_search::search_shard has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (60 pts), loops 8 (9 pts), boolean chains 5, match/switch 2 (4 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.
  • jcode_tui::tui::app::remote::reconnect::connect_with_retry (cognitive 75) crates/jcode-tui/src/tui/app/remote/reconnect.rs:476 — jcode_tui::tui::app::remote::reconnect::connect_with_retry has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (47 pts), match/switch 5 (14 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::app::remote::server_events::handle_server_event (cognitive 71) crates/jcode-tui/src/tui/app/remote/server_events.rs:162 — jcode_tui::tui::app::remote::server_events::handle_server_event has cognitive complexity 71 (threshold 15). Drivers by points: if/else 24 (62 pts), boolean chains 8, match/switch 1 (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.
  • jcode_tui::tui::ui_input::draw_status (cognitive 70) crates/jcode-tui/src/tui/ui_input.rs:824 — jcode_tui::tui::ui_input::draw_status has cognitive complexity 70 (threshold 15). Drivers by points: if/else 38 (64 pts), match/switch 2 (5 pts), boolean chains 1 (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.
  • jcode_tui::tui::ui_input::build_notification_spans (cognitive 66) crates/jcode-tui/src/tui/ui_input.rs:1231 — jcode_tui::tui::ui_input::build_notification_spans has cognitive complexity 66 (threshold 15). Drivers by points: if/else 39 (65 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::app::helpers::git_watch::imp::run (cognitive 65) crates/jcode-tui/src/tui/app/helpers/git_watch.rs:194 — jcode_tui::tui::app::helpers::git_watch::imp::run has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (54 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 35). 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.
  • jcode_tui::tui::app::commands_cloud::finish_cloud_command (cognitive 62) crates/jcode-tui/src/tui/app/commands_cloud.rs:1177 — jcode_tui::tui::app::commands_cloud::finish_cloud_command has cognitive complexity 62 (threshold 15). Drivers by points: if/else 27 (46 pts), match/switch 5 (13 pts), boolean chains 3 (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.
  • jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command (cognitive 59) crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:574 — jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (37 pts), match/switch 7 (18 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui::tui::ui_messages::render_background_task_message (cognitive 59) crates/jcode-tui/src/tui/ui_messages.rs:2764 — jcode_tui::tui::ui_messages::render_background_task_message has cognitive complexity 59 (threshold 15). Drivers by points: if/else 35 (50 pts), loops 3 (7 pts), boolean chains 1, match/switch 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.
  • jcode_tui::tui::ui_input::draw_input (cognitive 56) crates/jcode-tui/src/tui/ui_input.rs:2159 — jcode_tui::tui::ui_input::draw_input has cognitive complexity 56 (threshold 15). Drivers by points: if/else 34 (50 pts), boolean chains 3, loops 2 (3 pts) (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.
  • + 176 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×174
  • Hotspot: crates/jcode-tui/src/tui/app/remote/server_events.rs crates/jcode-tui/src/tui/app/remote/server_events.rs:339 — crates/jcode-tui/src/tui/app/remote/server_events.rs changed 101 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 414 in jcode_tui::tui::app::remote::server_events::handle_server_event_inner at line 339. 45 of those changes were fix/bug commits, and the other 56 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/remote/server_events.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: crates/jcode-app-core/src/server/client_lifecycle.rs crates/jcode-app-core/src/server/client_lifecycle.rs:245 — crates/jcode-app-core/src/server/client_lifecycle.rs changed 91 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 291 in jcode_app_core::server::client_lifecycle::handle_client at line 245. 28 of those changes were fix/bug commits, and the other 63 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-app-core/src/server/client_lifecycle.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: crates/jcode-tui/src/tui/app/remote/key_handling.rs crates/jcode-tui/src/tui/app/remote/key_handling.rs:283 — crates/jcode-tui/src/tui/app/remote/key_handling.rs changed 52 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 242 in jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input at line 283. 14 of those changes were fix/bug commits, and the other 38 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/remote/key_handling.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: crates/jcode-harness-api-server/src/translate.rs crates/jcode-harness-api-server/src/translate.rs:1692 — crates/jcode-harness-api-server/src/translate.rs changed 78 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 141 in BridgeState::legacy_event_to_api_inner at line 1692. 26 of those changes were fix/bug commits, and the other 52 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-harness-api-server/src/translate.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: crates/jcode-tui/src/tui/ui_messages.rs crates/jcode-tui/src/tui/ui_messages.rs:3961 — crates/jcode-tui/src/tui/ui_messages.rs changed 93 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 102 in jcode_tui::tui::ui_messages::render_tool_message at line 3961. 20 of those changes were fix/bug commits, and the other 73 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/ui_messages.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: crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:14 — crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 178 in Agent::run_turn_streaming_mpsc at line 14. 19 of those changes were fix/bug commits, and the other 34 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-app-core/src/agent/turn_streaming_mpsc.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: crates/jcode-base/src/config/env_overrides.rs crates/jcode-base/src/config/env_overrides.rs:9 — crates/jcode-base/src/config/env_overrides.rs changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 312 in Config::apply_env_overrides at line 9. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/config/env_overrides.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: crates/jcode-tui/src/tui/ui.rs crates/jcode-tui/src/tui/ui.rs:2981 — crates/jcode-tui/src/tui/ui.rs changed 66 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 106 in jcode_tui::tui::ui::draw_inner at line 2981. 20 of those changes were fix/bug commits, and the other 46 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/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: crates/jcode-tui/src/tui/app/remote.rs crates/jcode-tui/src/tui/app/remote.rs:94 — crates/jcode-tui/src/tui/app/remote.rs changed 77 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in jcode_tui::tui::app::remote::handle_tick at line 94. 21 of those changes were fix/bug commits, and the other 56 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/remote.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: crates/jcode-tui/src/tui/ui_viewport.rs crates/jcode-tui/src/tui/ui_viewport.rs:322 — crates/jcode-tui/src/tui/ui_viewport.rs changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in jcode_tui::tui::ui_viewport::draw_messages at line 322. 12 of those changes were fix/bug commits, and the other 31 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/ui_viewport.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: crates/jcode-app-core/src/agent/turn_loops.rs crates/jcode-app-core/src/agent/turn_loops.rs:45 — crates/jcode-app-core/src/agent/turn_loops.rs changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 161 in Agent::run_turn at line 45. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-app-core/src/agent/turn_loops.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: crates/jcode-tui/src/tui/app/navigation.rs crates/jcode-tui/src/tui/app/navigation.rs:1329 — crates/jcode-tui/src/tui/app/navigation.rs changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 135 in App::handle_mouse_event at line 1329. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/navigation.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: crates/jcode-tui/src/tui/app/inline_interactive.rs crates/jcode-tui/src/tui/app/inline_interactive.rs:3532 — crates/jcode-tui/src/tui/app/inline_interactive.rs changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in App::handle_inline_interactive_key at line 3532. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/inline_interactive.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: crates/jcode-app-core/src/tool/communicate.rs crates/jcode-app-core/src/tool/communicate.rs:810 — crates/jcode-app-core/src/tool/communicate.rs changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 112 in CommunicateTool::execute at line 810. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-app-core/src/tool/communicate.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: crates/jcode-tui/src/tui/app/turn.rs crates/jcode-tui/src/tui/app/turn.rs:64 — crates/jcode-tui/src/tui/app/turn.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 219 in App::run_turn_interactive at line 64. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/turn.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: crates/jcode-tui/src/tui/app/input.rs crates/jcode-tui/src/tui/app/input.rs:2359 — crates/jcode-tui/src/tui/app/input.rs changed 77 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in jcode_tui::tui::app::input::handle_pre_control_shortcuts at line 2359. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/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: crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:478 — crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in App::get_suggestions_for at line 478. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/state_ui_input_helpers.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: crates/jcode-tui/src/tui/app/debug_cmds.rs crates/jcode-tui/src/tui/app/debug_cmds.rs:6 — crates/jcode-tui/src/tui/app/debug_cmds.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 176 in App::handle_debug_command at line 6. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/debug_cmds.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: crates/jcode-tui/src/tui/app/tui_state.rs crates/jcode-tui/src/tui/app/tui_state.rs:1582 — crates/jcode-tui/src/tui/app/tui_state.rs changed 66 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in App::info_widget_data at line 1582. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/tui_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: crates/jcode-app-core/src/server.rs crates/jcode-app-core/src/server.rs:1199 — crates/jcode-app-core/src/server.rs changed 62 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in Server::spawn_background_tasks at line 1199. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-app-core/src/server.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/jcode-tui/src/tui/app/run_shell.rs crates/jcode-tui/src/tui/app/run_shell.rs:901 — crates/jcode-tui/src/tui/app/run_shell.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in App::run_remote at line 901. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/run_shell.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: crates/jcode-tui/src/tui/app/commands.rs crates/jcode-tui/src/tui/app/commands.rs:1698 — crates/jcode-tui/src/tui/app/commands.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 75 in jcode_tui::tui::app::commands::handle_session_command at line 1698. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/app/commands.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: crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:539 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 83 in jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked at line 539. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-provider-openai-runtime/src/openai_stream_runtime.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/cli/dispatch.rs src/cli/dispatch.rs:74 — src/cli/dispatch.rs changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in jcode::cli::dispatch::run_main at line 74. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- src/cli/dispatch.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: crates/jcode-tui/src/tui/session_picker.rs crates/jcode-tui/src/tui/session_picker.rs:1514 — crates/jcode-tui/src/tui/session_picker.rs changed 62 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in SessionPicker::handle_overlay_key_inner at line 1514. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/session_picker.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.
  • + 149 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode_app_core · ×120
  • jcode_app_core::server::client_lifecycle::handle_client (cognitive 570) crates/jcode-app-core/src/server/client_lifecycle.rs:245 — jcode_app_core::server::client_lifecycle::handle_client has cognitive complexity 570 (threshold 15). Drivers by points: if/else 159 (477 pts), match/switch 21 (57 pts), boolean chains 19, loops 8 (17 pts) (nesting depth added 363). 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.
  • jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command (cognitive 176) crates/jcode-app-core/src/server/debug_swarm_read.rs:20 — jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command has cognitive complexity 176 (threshold 15). Drivers by points: if/else 64 (119 pts), loops 21 (55 pts), boolean chains 2 (nesting depth added 89). 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.
  • jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command (cognitive 131) crates/jcode-app-core/src/server/debug_swarm_write.rs:19 — jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command has cognitive complexity 131 (threshold 15). Drivers by points: if/else 48 (110 pts), loops 5 (16 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_app_core::tool::todo_names::normalize_public_input (cognitive 112) crates/jcode-app-core/src/tool/todo_names.rs:139 — jcode_app_core::tool::todo_names::normalize_public_input has cognitive complexity 112 (threshold 15). Drivers by points: if/else 28 (68 pts), loops 15 (40 pts), boolean chains 4 (nesting depth added 65). Of this number, 106 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::client_session::handle_resume_session (cognitive 104) crates/jcode-app-core/src/server/client_session.rs:1285 — jcode_app_core::server::client_session::handle_resume_session has cognitive complexity 104 (threshold 15). Drivers by points: if/else 35 (83 pts), boolean chains 12, loops 2 (6 pts), match/switch 3 (nesting depth added 52). 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.
  • jcode_app_core::server::debug_command_exec::execute_debug_command (cognitive 104) crates/jcode-app-core/src/server/debug_command_exec.rs:162 — jcode_app_core::server::debug_command_exec::execute_debug_command has cognitive complexity 104 (threshold 15). Drivers by points: if/else 65 (89 pts), match/switch 4 (7 pts), boolean chains 4, loops 2 (4 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.
  • jcode_app_core::server::debug::handle_debug_client (cognitive 96) crates/jcode-app-core/src/server/debug.rs:316 — jcode_app_core::server::debug::handle_debug_client has cognitive complexity 96 (threshold 15). Drivers by points: if/else 19 (42 pts), match/switch 11 (39 pts), loops 3 (11 pts), boolean chains 4 (nesting depth added 59). 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.
  • jcode_app_core::server::client_comm_message::handle_comm_message (cognitive 89) crates/jcode-app-core/src/server/client_comm_message.rs:102 — jcode_app_core::server::client_comm_message::handle_comm_message has cognitive complexity 89 (threshold 15). Drivers by points: if/else 29 (58 pts), match/switch 7 (23 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 46). 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.
  • jcode_app_core::tool::browser_fast::run (cognitive 85) crates/jcode-app-core/src/tool/browser_fast.rs:584 — jcode_app_core::tool::browser_fast::run has cognitive complexity 85 (threshold 15). Drivers by points: if/else 37 (66 pts), boolean chains 15, match/switch 2 (3 pts), loops 1 (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.
  • jcode_app_core::tool::apply_patch::parse_apply_patch (cognitive 83) crates/jcode-app-core/src/tool/apply_patch.rs:661 — jcode_app_core::tool::apply_patch::parse_apply_patch has cognitive complexity 83 (threshold 15). Drivers by points: if/else 24 (67 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 50). 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.
  • jcode_app_core::server::comm_control::handle_comm_task_control (cognitive 79) crates/jcode-app-core/src/server/comm_control.rs:1690 — jcode_app_core::server::comm_control::handle_comm_task_control has cognitive complexity 79 (threshold 15). Drivers by points: if/else 35 (67 pts), boolean chains 6, match/switch 4 (6 pts) (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.
  • jcode_app_core::server::runtime_commands::execute (cognitive 79) crates/jcode-app-core/src/server/runtime_commands.rs:34 — jcode_app_core::server::runtime_commands::execute has cognitive complexity 79 (threshold 15). Drivers by points: if/else 26 (56 pts), match/switch 12 (22 pts), boolean chains 1 (nesting depth added 40). 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.
  • jcode_app_core::tool::browser_fast_actions::candidates (cognitive 74) crates/jcode-app-core/src/tool/browser_fast_actions.rs:158 — jcode_app_core::tool::browser_fast_actions::candidates has cognitive complexity 74 (threshold 15). Drivers by points: if/else 19 (48 pts), loops 6 (16 pts), boolean chains 10 (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.
  • jcode_app_core::server::group_transfer::handle_with_gate (cognitive 72) crates/jcode-app-core/src/server/group_transfer.rs:248 — jcode_app_core::server::group_transfer::handle_with_gate has cognitive complexity 72 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 12 (31 pts), match/switch 4 (6 pts), boolean chains 1 (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.
  • jcode_app_core::server::client_session::handle_subscribe (cognitive 68) crates/jcode-app-core/src/server/client_session.rs:643 — jcode_app_core::server::client_session::handle_subscribe has cognitive complexity 68 (threshold 15). Drivers by points: if/else 27 (64 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.
  • jcode_app_core::tool::batch::normalize_batch_input (cognitive 62) crates/jcode-app-core/src/tool/batch.rs:111 — jcode_app_core::tool::batch::normalize_batch_input has cognitive complexity 62 (threshold 15). Drivers by points: if/else 11 (46 pts), loops 3 (12 pts), boolean chains 4 (nesting depth added 44). 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.
  • jcode_app_core::tool::todo::apply_todo_patch (cognitive 59) crates/jcode-app-core/src/tool/todo.rs:323 — jcode_app_core::tool::todo::apply_todo_patch has cognitive complexity 59 (threshold 15). Drivers by points: if/else 20 (36 pts), match/switch 5 (10 pts), loops 5 (8 pts), boolean chains 5 (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.
  • jcode_app_core::replay::export_timeline (cognitive 56) crates/jcode-app-core/src/replay.rs:138 — jcode_app_core::replay::export_timeline has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 6 (12 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::tool::selfdev::status::selfdev_status_output (cognitive 56) crates/jcode-app-core/src/tool/selfdev/status.rs:3 — jcode_app_core::tool::selfdev::status::selfdev_status_output has cognitive complexity 56 (threshold 15). Drivers by points: if/else 33 (47 pts), match/switch 2 (5 pts), loops 2 (4 pts) (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.
  • jcode_app_core::tool::browser_request::bridge_request (cognitive 55) crates/jcode-app-core/src/tool/browser_request.rs:3 — jcode_app_core::tool::browser_request::bridge_request has cognitive complexity 55 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 5, match/switch 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::server::swarm::update_member_status_with_report_tldr (cognitive 54) crates/jcode-app-core/src/server/swarm.rs:1709 — jcode_app_core::server::swarm::update_member_status_with_report_tldr has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (43 pts), boolean chains 11 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • jcode_app_core::tool::todo::normalize_todo_input (cognitive 54) crates/jcode-app-core/src/tool/todo.rs:1240 — jcode_app_core::tool::todo::normalize_todo_input has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_app_core::tool::session_search::searchable_text::searchable_message_text (cognitive 53) crates/jcode-app-core/src/tool/session_search/searchable_text.rs:5 — jcode_app_core::tool::session_search::searchable_text::searchable_message_text has cognitive complexity 53 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 5 (26 pts), match/switch 1 (nesting depth added 39). 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.
  • jcode_app_core::server::swarm_persistence::load_runtime_state (cognitive 47) crates/jcode-app-core/src/server/swarm_persistence.rs:500 — jcode_app_core::server::swarm_persistence::load_runtime_state has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (41 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 25). 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.
  • jcode_app_core::usage_openai::parse_openai_usage_payload (cognitive 47) crates/jcode-app-core/src/usage_openai.rs:314 — jcode_app_core::usage_openai::parse_openai_usage_payload has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 26). 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.
  • + 95 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×111
  • MethodTooLong: Agent.run_turn_streaming_mpsc crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:14 — MethodTooLong — run_turn_streaming_mpsc runs 1242 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 1142 over it, 12.42× 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.run_turn_interactive crates/jcode-tui/src/tui/app/turn.rs:64 — MethodTooLong — run_turn_interactive runs 1121 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 1021 over it, 11.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.
  • MethodTooLong: Agent.run_turn crates/jcode-app-core/src/agent/turn_loops.rs:45 — MethodTooLong — run_turn runs 923 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 823 over it, 9.23× 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_debug_command crates/jcode-tui/src/tui/app/debug_cmds.rs:6 — MethodTooLong — handle_debug_command runs 888 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 788 over it, 8.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.
  • MethodTooLong: BridgeState.legacy_event_to_api_inner crates/jcode-harness-api-server/src/translate.rs:1692 — MethodTooLong — legacy_event_to_api_inner runs 786 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 686 over it, 7.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BridgeState.translate_request crates/jcode-harness-api-server/src/translate.rs:369 — MethodTooLong — translate_request runs 721 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 621 over it, 7.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.
  • MethodTooLong: CommunicateTool.execute crates/jcode-app-core/src/tool/communicate.rs:810 — MethodTooLong — execute runs 720 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 620 over it, 7.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Config.apply_env_overrides crates/jcode-base/src/config/env_overrides.rs:9 — MethodTooLong — apply_env_overrides runs 592 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 492 over it, 5.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.handle_login_input crates/jcode-tui/src/tui/app/auth.rs:1841 — MethodTooLong — handle_login_input runs 559 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 459 over it, 5.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.new crates/jcode-tui/src/tui/app/tui_lifecycle.rs:756 — MethodTooLong — new runs 493 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 393 over it, 4.93× 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: OpenAIProvider.complete crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:129 — MethodTooLong — complete runs 492 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 392 over it, 4.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.new_minimal_with_session crates/jcode-tui/src/tui/app/tui_lifecycle.rs:263 — MethodTooLong — new_minimal_with_session runs 473 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 373 over it, 4.73× 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.get_suggestions_for crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:478 — MethodTooLong — get_suggestions_for runs 455 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 355 over it, 4.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: Server.spawn_background_tasks crates/jcode-app-core/src/server.rs:1199 — MethodTooLong — spawn_background_tasks runs 447 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 347 over it, 4.47× 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: GmailTool.execute crates/jcode-app-core/src/tool/gmail.rs:155 — MethodTooLong — execute runs 440 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 340 over it, 4.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: App.handle_inline_interactive_key crates/jcode-tui/src/tui/app/inline_interactive.rs:3532 — MethodTooLong — handle_inline_interactive_key runs 427 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 327 over it, 4.27× 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: DiscoverToolsTool.execute crates/jcode-app-core/src/tool/discover.rs:527 — MethodTooLong — execute runs 382 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 282 over it, 3.82× 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.build_model_picker_entries crates/jcode-tui/src/tui/app/inline_interactive.rs:1668 — MethodTooLong — build_model_picker_entries runs 356 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 256 over it, 3.56× 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: Config.display_string crates/jcode-base/src/config/display_summary.rs:4 — MethodTooLong — display_string runs 342 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 242 over it, 3.42× 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.debug_app_owned_memory_profile crates/jcode-tui/src/tui/app/debug_profile.rs:175 — MethodTooLong — debug_app_owned_memory_profile runs 322 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 222 over it, 3.22× 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_mouse_event crates/jcode-tui/src/tui/app/navigation.rs:1329 — MethodTooLong — handle_mouse_event runs 314 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 214 over it, 3.14× 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.info_widget_data crates/jcode-tui/src/tui/app/tui_state.rs:1582 — MethodTooLong — info_widget_data runs 294 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 194 over it, 2.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Server.monitor_bus crates/jcode-app-core/src/server.rs:1981 — MethodTooLong — monitor_bus runs 288 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 188 over it, 2.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.
  • MethodTooLong: Server.recover_headless_sessions_on_startup crates/jcode-app-core/src/server.rs:750 — MethodTooLong — recover_headless_sessions_on_startup 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: BgTool.execute crates/jcode-app-core/src/tool/bg.rs:559 — MethodTooLong — execute runs 280 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 180 over it, 2.80× 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.
  • + 86 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode_tui · ×102
  • jcode_tui::tui::app::remote::server_events::handle_server_event_inner (cyclomatic 414) crates/jcode-tui/src/tui/app/remote/server_events.rs:339 — jcode_tui::tui::app::remote::server_events::handle_server_event_inner has cyclomatic complexity 414 (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.
  • jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input (cyclomatic 242) crates/jcode-tui/src/tui/app/remote/key_handling.rs:283 — jcode_tui::tui::app::remote::key_handling::submit_prepared_remote_enter_input has cyclomatic complexity 242 (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.
  • jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal (cyclomatic 190) crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs:18 — jcode_tui::tui::app::remote::key_handling::key_events::handle_remote_key_internal has cyclomatic complexity 190 (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.
  • jcode_tui::tui::ui_viewport::draw_messages (cyclomatic 132) crates/jcode-tui/src/tui/ui_viewport.rs:322 — jcode_tui::tui::ui_viewport::draw_messages has cyclomatic complexity 132 (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.
  • jcode_tui::tui::ui::draw_inner (cyclomatic 106) crates/jcode-tui/src/tui/ui.rs:2981 — jcode_tui::tui::ui::draw_inner has cyclomatic complexity 106 (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.
  • jcode_tui::tui::ui_messages::render_tool_message (cyclomatic 102) crates/jcode-tui/src/tui/ui_messages.rs:3961 — jcode_tui::tui::ui_messages::render_tool_message has cyclomatic complexity 102 (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.
  • jcode_tui::tui::ui_inline_interactive::draw_inline_interactive (cyclomatic 94) crates/jcode-tui/src/tui/ui_inline_interactive.rs:595 — jcode_tui::tui::ui_inline_interactive::draw_inline_interactive 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.
  • jcode_tui::tui::ui_tools::get_tool_summary_with_budget (cyclomatic 89) crates/jcode-tui/src/tui/ui_tools.rs:847 — jcode_tui::tui::ui_tools::get_tool_summary_with_budget has cyclomatic complexity 89 (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.
  • jcode_tui::tui::app::commands::handle_session_command (cyclomatic 75) crates/jcode-tui/src/tui/app/commands.rs:1698 — jcode_tui::tui::app::commands::handle_session_command has cyclomatic complexity 75 (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.
  • jcode_tui::tui::app::remote::handle_tick (cyclomatic 75) crates/jcode-tui/src/tui/app/remote.rs:94 — jcode_tui::tui::app::remote::handle_tick has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::app::remote::process_remote_followups (cyclomatic 72) crates/jcode-tui/src/tui/app/remote.rs:1461 — jcode_tui::tui::app::remote::process_remote_followups has cyclomatic complexity 72 (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.
  • jcode_tui::tui::ui_prepare::render_message_into (cyclomatic 57) crates/jcode-tui/src/tui/ui_prepare.rs:1428 — jcode_tui::tui::ui_prepare::render_message_into has cyclomatic complexity 57 (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.
  • jcode_tui::tui::info_widget_layout::calculate_placements_anchored (cyclomatic 54) crates/jcode-tui/src/tui/info_widget_layout.rs:125 — jcode_tui::tui::info_widget_layout::calculate_placements_anchored has cyclomatic complexity 54 (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.
  • jcode_tui::tui::app::auth_account_commands::parse_account_command (cyclomatic 48) crates/jcode-tui/src/tui/app/auth_account_commands.rs:141 — jcode_tui::tui::app::auth_account_commands::parse_account_command 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.
  • jcode_tui::tui::app::remote::handle_disconnected_key_internal (cyclomatic 46) crates/jcode-tui/src/tui/app/remote.rs:2197 — jcode_tui::tui::app::remote::handle_disconnected_key_internal has cyclomatic complexity 46 (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.
  • jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command (cyclomatic 45) crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:574 — jcode_tui::tui::app::tui_lifecycle_runtime::handle_dev_command 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.
  • jcode_tui::tui::session_picker::transcript_search::search_shard (cyclomatic 45) crates/jcode-tui/src/tui/session_picker/transcript_search.rs:752 — jcode_tui::tui::session_picker::transcript_search::search_shard 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.
  • jcode_tui::video_export::box_drawing_to_svg (cyclomatic 43) crates/jcode-tui/src/video_export.rs:933 — jcode_tui::video_export::box_drawing_to_svg has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • jcode_tui::tui::app::input::handle_pre_control_shortcuts (cyclomatic 40) crates/jcode-tui/src/tui/app/input.rs:2359 — jcode_tui::tui::app::input::handle_pre_control_shortcuts has cyclomatic complexity 40 (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.
  • jcode_tui::tui::ui_input::draw_status (cyclomatic 40) crates/jcode-tui/src/tui/ui_input.rs:824 — jcode_tui::tui::ui_input::draw_status 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.
  • jcode_tui::tui::app::state_ui::handle_info_command (cyclomatic 38) crates/jcode-tui/src/tui/app/state_ui.rs:1895 — jcode_tui::tui::app::state_ui::handle_info_command has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::video_export::buffer_to_svg (cyclomatic 38) crates/jcode-tui/src/video_export.rs:612 — jcode_tui::video_export::buffer_to_svg has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_tui::tui::app::local::handle_bus_event (cyclomatic 37) crates/jcode-tui/src/tui/app/local.rs:207 — jcode_tui::tui::app::local::handle_bus_event has cyclomatic complexity 37 (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.
  • jcode_tui::tui::app::remote::reconnect::connect_with_retry (cyclomatic 37) crates/jcode-tui/src/tui/app/remote/reconnect.rs:476 — jcode_tui::tui::app::remote::reconnect::connect_with_retry 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.
  • jcode_tui::tui::app::remote::server_events::handle_server_event (cyclomatic 35) crates/jcode-tui/src/tui/app/remote/server_events.rs:162 — jcode_tui::tui::app::remote::server_events::handle_server_event has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 77 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×102
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/replay.rs:773 — crates/jcode-app-core/src/replay.rs:773-779 | crates/jcode-app-core/src/replay.rs:798-804 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/client_actions.rs:210 — crates/jcode-app-core/src/server/client_actions.rs:210-216 | crates/jcode-tui/src/tui/app/input/shell_commands.rs:52-59 — 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 (7 lines × 2) crates/jcode-app-core/src/server/client_actions.rs:846 — crates/jcode-app-core/src/server/client_actions.rs:846-852 | crates/jcode-app-core/src/tool/selfdev/launch.rs:21-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) crates/jcode-app-core/src/server/client_api.rs:127 — crates/jcode-app-core/src/server/client_api.rs:127-134 | crates/jcode-app-core/src/server/client_api.rs:186-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_api.rs:127` 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) crates/jcode-app-core/src/server/client_session.rs:817 — crates/jcode-app-core/src/server/client_session.rs:817-823 | crates/jcode-app-core/src/server/swarm.rs:1286-1292 — 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 `crates/jcode-app-core/src/server/client_session.rs:817` 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) crates/jcode-app-core/src/server/client_state.rs:860 — crates/jcode-app-core/src/server/client_state.rs:860-866 | crates/jcode-app-core/src/server/client_state.rs:1204-1210 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/debug_swarm_write.rs:45 — crates/jcode-app-core/src/server/debug_swarm_write.rs:45-51 | crates/jcode-app-core/src/server/debug_swarm_write.rs:80-86 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/history_paging.rs:95 — crates/jcode-app-core/src/server/history_paging.rs:95-101 | crates/jcode-app-core/src/server/history_timing.rs:110-116 — 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 `crates/jcode-app-core/src/server/history_paging.rs:95` 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) crates/jcode-app-core/src/server/jade_relay.rs:333 — crates/jcode-app-core/src/server/jade_relay.rs:333-339 | crates/jcode-app-core/src/server/jade_relay.rs:687-693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/jade_relay.rs:333` 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) crates/jcode-app-core/src/server/runtime_ssh_host.rs:322 — crates/jcode-app-core/src/server/runtime_ssh_host.rs:322-328 | crates/jcode-telemetry-core/src/usage_outbox.rs:75-81 — 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 (7 lines × 2) crates/jcode-app-core/src/session_launch.rs:661 — crates/jcode-app-core/src/session_launch.rs:661-667 | crates/jcode-app-core/src/session_launch.rs:786-792 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/telemetry_state.rs:293 — crates/jcode-app-core/src/telemetry_state.rs:293-299 | crates/jcode-telemetry-core/src/state_support.rs:342-348 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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) crates/jcode-app-core/src/tool/apply_patch.rs:628 — crates/jcode-app-core/src/tool/apply_patch.rs:628-634 | crates/jcode-app-core/src/tool/apply_patch.rs:641-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/apply_patch.rs:628` 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) crates/jcode-base/src/compaction.rs:953 — crates/jcode-base/src/compaction.rs:953-959 | crates/jcode-base/src/compaction.rs:1169-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/compaction.rs:953` 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) crates/jcode-base/src/gmail.rs:401 — crates/jcode-base/src/gmail.rs:401-407 | crates/jcode-base/src/google_calendar.rs:134-140 — 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 `crates/jcode-base/src/gmail.rs:401` 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) crates/jcode-base/src/import.rs:1383 — crates/jcode-base/src/import.rs:1383-1389 | crates/jcode-tui/src/tui/session_picker/loading.rs:2669-2675 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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) crates/jcode-base/src/jev.rs:560 — crates/jcode-base/src/jev.rs:560-568 | crates/jcode-base/src/jev/laya.rs:21-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/jev.rs:560` 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) crates/jcode-base/src/provider_catalog.rs:971 — crates/jcode-base/src/provider_catalog.rs:971-981 | crates/jcode-base/src/provider_catalog.rs:1112-1118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider_catalog.rs:971` 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 (7 lines × 2) crates/jcode-base/src/session/persistence.rs:220 — crates/jcode-base/src/session/persistence.rs:220-226 | crates/jcode-tui/src/tui/session_picker/loading.rs:1686-1692 — 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 `crates/jcode-base/src/session/persistence.rs:220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) crates/jcode-base/src/session/persistence.rs:405 — crates/jcode-base/src/session/persistence.rs:405-411 | crates/jcode-base/src/session/persistence.rs:560-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.
  • Duplicated block (7 lines × 2) crates/jcode-base/src/subscription_api.rs:670 — crates/jcode-base/src/subscription_api.rs:670-676 | crates/jcode-base/src/subscription_api.rs:691-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 `crates/jcode-base/src/subscription_api.rs:670` 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) crates/jcode-base/src/usage/display.rs:178 — crates/jcode-base/src/usage/display.rs:178-184 | crates/jcode-tui-usage-overlay/src/lib.rs:775-781 — before extracting anything, compare `crates/jcode-base/src/usage/display.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 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 `crates/jcode-base/src/usage/display.rs:178` 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) crates/jcode-command-risk/src/lib.rs:241 — crates/jcode-command-risk/src/lib.rs:241-247 | crates/jcode-command-risk/src/lib.rs:472-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-command-risk/src/lib.rs:241` 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) crates/jcode-harness-api/src/sockets.rs:17 — crates/jcode-harness-api/src/sockets.rs:17-23 | crates/jcode-storage/src/lib.rs:111-117 — 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. 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) crates/jcode-overnight-core/src/lib.rs:312 — crates/jcode-overnight-core/src/lib.rs:312-318 | src/cli/acp.rs:1939-1945 — 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.
  • + 77 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×87
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/client_api.rs:109 — crates/jcode-app-core/src/server/client_api.rs:109-116 | crates/jcode-app-core/src/server/client_api.rs:151-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_api.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-app-core/src/server/client_api.rs:104` calls `Ok`, `read_event` and `crates/jcode-app-core/src/server/client_api.rs:149` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1099 — crates/jcode-app-core/src/server/client_lifecycle.rs:1099-1106 | crates/jcode-app-core/src/server/request_watchdog.rs:86-93 — 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:1099` 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) crates/jcode-app-core/src/server/client_state.rs:904 — crates/jcode-app-core/src/server/client_state.rs:904-911 | crates/jcode-app-core/src/server/client_state.rs:1229-1236 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/comm_control.rs:241 — crates/jcode-app-core/src/server/comm_control.rs:241-248 | crates/jcode-app-core/src/server/comm_control.rs:386-393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/comm_control.rs:241` 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, `crates/jcode-app-core/src/server/comm_control.rs:394` calls `then_with`, `cmp` and `crates/jcode-app-core/src/server/comm_control.rs:249` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/jcode-app-core/src/server/debug_server_state.rs:863 — crates/jcode-app-core/src/server/debug_server_state.rs:863-870 | crates/jcode-app-core/src/server/debug_server_state.rs:917-925 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_server_state.rs:863` 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) crates/jcode-app-core/src/server/debug_server_state.rs:916 — crates/jcode-app-core/src/server/debug_server_state.rs:916-923 | crates/jcode-app-core/src/server/debug_server_state.rs:932-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 `crates/jcode-app-core/src/server/debug_server_state.rs:916` 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) crates/jcode-app-core/src/server/file_activity.rs:12 — crates/jcode-app-core/src/server/file_activity.rs:12-19 | crates/jcode-app-core/src/server/file_activity.rs:24-31 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/live_turn.rs:250 — crates/jcode-app-core/src/server/live_turn.rs:250-257 | crates/jcode-app-core/src/server/live_turn.rs:272-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/live_turn.rs:250` 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) crates/jcode-app-core/src/server/provider_control.rs:379 — crates/jcode-app-core/src/server/provider_control.rs:379-386 | crates/jcode-tui/src/tui/app/model_context.rs:118-125 — 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 `crates/jcode-app-core/src/server/provider_control.rs:379` 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) crates/jcode-app-core/src/server/socket.rs:292 — crates/jcode-app-core/src/server/socket.rs:292-299 | src/cli/dispatch.rs:1108-1115 — 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 `crates/jcode-app-core/src/server/socket.rs:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) REDACTED:1317 — REDACTED:1317-1324 | REDACTED:1330-1337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1317` 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) crates/jcode-app-core/src/tool/webfetch.rs:331 — crates/jcode-app-core/src/tool/webfetch.rs:331-338 | crates/jcode-app-core/src/tool/webfetch.rs:435-442 — both copies are in the same file, so extract the 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, `crates/jcode-app-core/src/tool/webfetch.rs:444` calls `Some`, `empty_bullets`, `replace_all` and `crates/jcode-app-core/src/tool/webfetch.rs:340` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/jcode-base/src/auth/claude.rs:448 — crates/jcode-base/src/auth/claude.rs:448-455 | crates/jcode-base/src/auth/claude.rs:478-485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/auth/claude.rs:448` 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) crates/jcode-base/src/auth/codex.rs:315 — crates/jcode-base/src/auth/codex.rs:315-322 | crates/jcode-base/src/auth/codex.rs:350-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/auth/codex.rs:315` 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) crates/jcode-base/src/cache_tracker.rs:105 — crates/jcode-base/src/cache_tracker.rs:105-112 | crates/jcode-base/src/cache_tracker.rs:177-184 — both copies are in the same file, so extract the 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) crates/jcode-base/src/companion_client.rs:94 — crates/jcode-base/src/companion_client.rs:94-101 | crates/jcode-base/src/companion_client.rs:105-112 — both copies are in the same file, so extract the 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) crates/jcode-base/src/mcp/manager.rs:532 — crates/jcode-base/src/mcp/manager.rs:532-539 | crates/jcode-base/src/mcp/manager.rs:561-568 — both copies are in the same file, so extract the 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 (8 lines × 2) crates/jcode-base/src/runtime_memory_log.rs:636 — crates/jcode-base/src/runtime_memory_log.rs:636-643 | crates/jcode-base/src/runtime_memory_log.rs:663-670 — both copies are in the same file, so extract the 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) crates/jcode-base/src/subscription_api.rs:290 — crates/jcode-base/src/subscription_api.rs:290-297 | crates/jcode-base/src/subscription_api.rs:432-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/subscription_api.rs:290` 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 (8 lines × 2) crates/jcode-base/src/usage/api_keys.rs:143 — crates/jcode-base/src/usage/api_keys.rs:143-150 | crates/jcode-base/src/usage/api_keys.rs:183-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/usage/api_keys.rs:143` 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) crates/jcode-companion/src/server.rs:423 — crates/jcode-companion/src/server.rs:423-430 | src/cli/acp.rs:411-419 — 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 `crates/jcode-companion/src/server.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. 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 (8 lines × 2) crates/jcode-harness-api-server/src/translate.rs:1883 — crates/jcode-harness-api-server/src/translate.rs:1883-1890 | crates/jcode-harness-api-server/src/translate.rs:2210-2217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-harness-api-server/src/translate.rs:1883` 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, `crates/jcode-harness-api-server/src/translate.rs:2218` calls `session_modified_ms` and `crates/jcode-harness-api-server/src/translate.rs:1891` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1287 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1287-1294 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1361-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1287` 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) crates/jcode-provider-cursor-runtime/src/wire.rs:425 — crates/jcode-provider-cursor-runtime/src/wire.rs:425-432 | crates/jcode-provider-cursor-runtime/src/wire.rs:461-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.
  • Duplicated block (8 lines × 2) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:198 — crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:198-205 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:917-924 — 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.
  • + 62 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode_base · ×81
  • jcode_base::session::render::render_messages_and_images_with_compacted_history (cognitive 80) crates/jcode-base/src/session/render.rs:365 — jcode_base::session::render::render_messages_and_images_with_compacted_history has cognitive complexity 80 (threshold 15). Drivers by points: if/else 20 (58 pts), match/switch 4 (9 pts), loops 4 (8 pts), boolean chains 5 (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.
  • jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback (cognitive 66) crates/jcode-base/src/provider/catalog_remote_routes.rs:3 — jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (42 pts), match/switch 3 (10 pts), loops 3 (9 pts), boolean chains 5 (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.
  • jcode_base::browser::ensure_browser_setup_for (cognitive 57) crates/jcode-base/src/browser.rs:270 — jcode_base::browser::ensure_browser_setup_for has cognitive complexity 57 (threshold 15). Drivers by points: if/else 26 (36 pts), match/switch 7 (15 pts), boolean chains 6 (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.
  • jcode_base::mobile_sync::sync_pass (cognitive 50) crates/jcode-base/src/mobile_sync.rs:708 — jcode_base::mobile_sync::sync_pass has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (37 pts), loops 4 (7 pts), boolean chains 4, match/switch 1 (2 pts) (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.
  • jcode_base::provider_catalog::apply_named_provider_profile_env_from_config (cognitive 49) crates/jcode-base/src/provider_catalog.rs:935 — jcode_base::provider_catalog::apply_named_provider_profile_env_from_config has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (42 pts), match/switch 3 (5 pts), boolean chains 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.
  • jcode_base::provider::models_catalog::parse_openai_model_catalog (cognitive 48) crates/jcode-base/src/provider/models_catalog.rs:80 — jcode_base::provider::models_catalog::parse_openai_model_catalog has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (41 pts), loops 3 (7 pts) (nesting depth added 31). 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.
  • jcode_base::usage::openai_helpers::parse_openai_usage_payload (cognitive 47) crates/jcode-base/src/usage/openai_helpers.rs:339 — jcode_base::usage::openai_helpers::parse_openai_usage_payload has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 26). 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.
  • jcode_base::mobile_runner_events::spawn_with (cognitive 45) crates/jcode-base/src/mobile_runner_events.rs:97 — jcode_base::mobile_runner_events::spawn_with has cognitive complexity 45 (threshold 15). Drivers by points: if/else 5 (23 pts), match/switch 3 (14 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 33). 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.
  • jcode_base::import::import_codex_session_from_path (cognitive 44) crates/jcode-base/src/import.rs:1069 — jcode_base::import::import_codex_session_from_path has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (40 pts), match/switch 1 (2 pts), boolean chains 1, loops 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.
  • jcode_base::auth::transfer::import_cloud_inner (cognitive 43) crates/jcode-base/src/auth/transfer.rs:1016 — jcode_base::auth::transfer::import_cloud_inner has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (26 pts), match/switch 6 (11 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::mcp::remote::streamable_post_inner (cognitive 42) crates/jcode-base/src/mcp/remote.rs:610 — jcode_base::mcp::remote::streamable_post_inner has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 10, loops 2 (5 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.
  • jcode_base::mcp::oauth::www_authenticate_param (cognitive 41) crates/jcode-base/src/mcp/oauth.rs:655 — jcode_base::mcp::oauth::www_authenticate_param has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 6, loops 3 (5 pts) (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.
  • jcode_base::auth::assessment_for_key (cognitive 40) crates/jcode-base/src/auth/mod.rs:1119 — jcode_base::auth::assessment_for_key has cognitive complexity 40 (threshold 15). Drivers by points: if/else 26 (39 pts), match/switch 1 (nesting depth added 13). 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.
  • jcode_base::import::list_claude_code_sessions (cognitive 39) crates/jcode-base/src/import.rs:201 — jcode_base::import::list_claude_code_sessions has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::gateway::handle_ws_connection (cognitive 38) crates/jcode-base/src/gateway.rs:146 — jcode_base::gateway::handle_ws_connection has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 3 (5 pts), loops 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::goal::render_goal_detail (cognitive 34) crates/jcode-base/src/goal.rs:414 — jcode_base::goal::render_goal_detail has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 6 (13 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.
  • jcode_base::provider::catalog_routes::simplified_model_routes_for_picker (cognitive 32) crates/jcode-base/src/provider/catalog_routes.rs:24 — jcode_base::provider::catalog_routes::simplified_model_routes_for_picker has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (3 pts), boolean chains 2, 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.
  • jcode_base::provider::catalog_routes::expand_saved_account_routes (cognitive 32) crates/jcode-base/src/provider/catalog_routes.rs:174 — jcode_base::provider::catalog_routes::expand_saved_account_routes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (10 pts), boolean chains 4, match/switch 2 (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.
  • jcode_base::usage::api_keys::fetch_compatible_profile_report (cognitive 31) crates/jcode-base/src/usage/api_keys.rs:213 — jcode_base::usage::api_keys::fetch_compatible_profile_report has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 7 (14 pts), boolean chains 2 (nesting depth added 16). 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.
  • jcode_base::usage::provider_fetch::fetch_openai_usage_for_account (cognitive 31) crates/jcode-base/src/usage/provider_fetch.rs:150 — jcode_base::usage::provider_fetch::fetch_openai_usage_for_account has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 6 (11 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::mcp::remote::sse_reader (cognitive 30) crates/jcode-base/src/mcp/remote.rs:850 — jcode_base::mcp::remote::sse_reader has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::memory::activity::parse_injected_items (cognitive 30) crates/jcode-base/src/memory/activity.rs:168 — jcode_base::memory::activity::parse_injected_items has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, loops 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.
  • jcode_base::session::crash::find_crashed_legacy_scan (cognitive 30) crates/jcode-base/src/session/crash.rs:414 — jcode_base::session::crash::find_crashed_legacy_scan has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 4 (6 pts), boolean chains 4, loops 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.
  • jcode_base::transcript_sample::codex_turns (cognitive 30) crates/jcode-base/src/transcript_sample.rs:575 — jcode_base::transcript_sample::codex_turns has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_base::auth::lifecycle::parse_frontier_version_for_family (cognitive 28) crates/jcode-base/src/auth/lifecycle.rs:708 — jcode_base::auth::lifecycle::parse_frontier_version_for_family has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 2 (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.
  • + 56 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×81
  • Duplicated block (9 lines × 2) crates/jcode-app-core/src/agent/status.rs:5 — crates/jcode-app-core/src/agent/status.rs:5-13 | crates/jcode-app-core/src/agent/status.rs:179-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/agent/status.rs:5` 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) crates/jcode-app-core/src/ambient/runner.rs:205 — crates/jcode-app-core/src/ambient/runner.rs:205-213 | crates/jcode-tui/src/tui/app/helpers.rs:1748-1756 — 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 lines × 2) crates/jcode-app-core/src/server/comm_session.rs:879 — crates/jcode-app-core/src/server/comm_session.rs:879-887 | crates/jcode-app-core/src/server/comm_sync.rs:400-409 — 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 `crates/jcode-app-core/src/server/comm_session.rs:879` 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) crates/jcode-app-core/src/server/debug_server_state.rs:737 — crates/jcode-app-core/src/server/debug_server_state.rs:737-745 | crates/jcode-app-core/src/server/debug_server_state.rs:747-755 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_server_state.rs:737` 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) crates/jcode-app-core/src/session_launch.rs:530 — crates/jcode-app-core/src/session_launch.rs:530-538 | crates/jcode-app-core/src/session_launch.rs:789-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.
  • Duplicated block (9 lines × 2) crates/jcode-app-core/src/tool/agentgrep/context.rs:836 — crates/jcode-app-core/src/tool/agentgrep/context.rs:836-844 | crates/jcode-app-core/src/tool/agentgrep/context.rs:871-879 — both copies are in the same file, so extract the 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 `known` to `AgentGrepKnownFile` in one and `AgentGrepKnownSymbol` 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) crates/jcode-app-core/src/tool/browser.rs:429 — crates/jcode-app-core/src/tool/browser.rs:429-437 | crates/jcode-app-core/src/tool/browser.rs:448-456 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/tool/session_search.rs:1482 — crates/jcode-app-core/src/tool/session_search.rs:1482-1490 | crates/jcode-app-core/src/tool/session_search.rs:1738-1746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/session_search.rs:1482` 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 `messages` to `&[ExternalMessageRecord]` in one and `&[StoredMessage]` 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) crates/jcode-app-core/src/tool/todo.rs:1274 — crates/jcode-app-core/src/tool/todo.rs:1274-1282 | crates/jcode-app-core/src/tool/todo_names.rs:20-28 — 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 `crates/jcode-app-core/src/tool/todo.rs:1274` 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) crates/jcode-app-core/src/usage_openai.rs:194 — crates/jcode-app-core/src/usage_openai.rs:194-202 | crates/jcode-base/src/usage/openai_helpers.rs:219-227 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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) crates/jcode-base/src/import.rs:1117 — crates/jcode-base/src/import.rs:1117-1125 | crates/jcode-tui/src/tui/session_picker/loading.rs:2414-2424 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-base/src/import.rs:1117` 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, `crates/jcode-base/src/import.rs:1116` calls `json_line_has_message_role` and `crates/jcode-tui/src/tui/session_picker/loading.rs:2413` 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) crates/jcode-base/src/mcp/manager.rs:521 — crates/jcode-base/src/mcp/manager.rs:521-529 | crates/jcode-base/src/mcp/manager.rs:552-560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) crates/jcode-base/src/prompt.rs:22 — crates/jcode-base/src/prompt.rs:22-30 | crates/jcode-base/src/prompt.rs:84-92 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/prompt.rs:22` 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) crates/jcode-base/src/safety.rs:385 — crates/jcode-base/src/safety.rs:385-393 | crates/jcode-base/src/safety.rs:421-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/jcode-base/src/safety.rs:397 — crates/jcode-base/src/safety.rs:397-405 | crates/jcode-base/src/safety.rs:446-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.
  • Duplicated block (9 lines × 2) crates/jcode-base/src/subscription_api.rs:291 — crates/jcode-base/src/subscription_api.rs:291-299 | crates/jcode-base/src/subscription_api.rs:516-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/subscription_api.rs:291` 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) crates/jcode-import-core/src/lib.rs:866 — crates/jcode-import-core/src/lib.rs:866-874 | crates/jcode-tui/src/tui/session_picker/loading.rs:2643-2651 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (9 lines × 2) crates/jcode-provider-copilot/src/lib.rs:142 — crates/jcode-provider-copilot/src/lib.rs:142-150 | crates/jcode-provider-openrouter/src/request.rs:190-198 — before extracting anything, compare `crates/jcode-provider-copilot/src/lib.rs` and `crates/jcode-provider-openrouter/src/request.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-provider-copilot/src/lib.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) crates/jcode-provider-core/src/fallback_pick.rs:142 — crates/jcode-provider-core/src/fallback_pick.rs:142-161 | crates/jcode-provider-core/src/fallback_pick.rs:468-476 — both copies are in the same file, so extract the 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/jcode-provider-core/src/fallback_pick.rs:477` calls `route_pool_key`, `and_then`, `iter` and `crates/jcode-provider-core/src/fallback_pick.rs:163` 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) crates/jcode-provider-doctor/src/live_provider_probes.rs:164 — crates/jcode-provider-doctor/src/live_provider_probes.rs:164-172 | crates/jcode-provider-doctor/src/live_provider_probes.rs:232-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/live_provider_probes.rs:164` 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) crates/jcode-provider-openrouter-runtime/src/lib.rs:666 — crates/jcode-provider-openrouter-runtime/src/lib.rs:666-674 | crates/jcode-provider-openrouter-runtime/src/lib.rs:774-782 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-openrouter-runtime/src/lib.rs:666` 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) crates/jcode-render-core/src/math.rs:614 — crates/jcode-render-core/src/math.rs:614-622 | crates/jcode-render-core/src/preprocess.rs:666-674 — 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 `crates/jcode-render-core/src/math.rs:614` 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) crates/jcode-setup-hints/src/lib.rs:1738 — crates/jcode-setup-hints/src/lib.rs:1738-1746 | crates/jcode-setup-hints/src/lib.rs:1795-1803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-setup-hints/src/lib.rs:1738` 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, `crates/jcode-setup-hints/src/lib.rs:1806` calls `name` and `crates/jcode-setup-hints/src/lib.rs:1749` 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) crates/jcode-todo-policy/src/lib.rs:564 — crates/jcode-todo-policy/src/lib.rs:564-572 | crates/jcode-todo-policy/src/lib.rs:587-595 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-todo-policy/src/lib.rs:564` 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) crates/jcode-tui-render/src/lib.rs:78 — crates/jcode-tui-render/src/lib.rs:78-86 | crates/jcode-tui-render/src/lib.rs:127-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 `crates/jcode-tui-render/src/lib.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.
  • + 56 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×76
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/channel.rs:630 — crates/jcode-app-core/src/channel.rs:630-635 | crates/jcode-app-core/src/server/jade_relay.rs:1324-1329 — 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 `crates/jcode-app-core/src/channel.rs:630` 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) crates/jcode-app-core/src/server/client_actions.rs:842 — crates/jcode-app-core/src/server/client_actions.rs:842-847 | crates/jcode-tui/src/tui/app/commands.rs:402-407 — before extracting anything, compare `crates/jcode-app-core/src/server/client_actions.rs` and `crates/jcode-tui/src/tui/app/commands.rs` as WHOLE FILES: this scan already matched 4 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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `parent` to `&Session` in one and `&crate::session::Session` 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, `crates/jcode-app-core/src/server/client_actions.rs:849` calls `clone` and `crates/jcode-tui/src/tui/app/commands.rs:409` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:1430 — crates/jcode-app-core/src/server/comm_control.rs:1430-1435 | crates/jcode-app-core/src/server/comm_session.rs:614-619 — 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) crates/jcode-app-core/src/server/comm_control.rs:1974 — crates/jcode-app-core/src/server/comm_control.rs:1974-1979 | crates/jcode-app-core/src/server/comm_control.rs:2000-2005 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/comm_control.rs:1974` 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) crates/jcode-app-core/src/server/debug_jobs.rs:88 — crates/jcode-app-core/src/server/debug_jobs.rs:88-93 | crates/jcode-app-core/src/server/debug_jobs.rs:117-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_jobs.rs:88` 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) crates/jcode-app-core/src/server/debug_server_state.rs:830 — crates/jcode-app-core/src/server/debug_server_state.rs:830-835 | crates/jcode-app-core/src/server/debug_server_state.rs:841-846 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/debug_swarm_read.rs:552 — crates/jcode-app-core/src/server/debug_swarm_read.rs:552-557 | crates/jcode-app-core/src/server/debug_swarm_read.rs:608-613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_swarm_read.rs:552` 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) crates/jcode-app-core/src/server/jade_relay.rs:319 — crates/jcode-app-core/src/server/jade_relay.rs:319-324 | crates/jcode-app-core/src/server/jade_relay.rs:671-676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/jade_relay.rs:319` 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) crates/jcode-app-core/src/tool/apply_patch.rs:144 — crates/jcode-app-core/src/tool/apply_patch.rs:144-149 | crates/jcode-app-core/src/tool/apply_patch.rs:224-229 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/tool/browser_request.rs:93 — crates/jcode-app-core/src/tool/browser_request.rs:93-98 | crates/jcode-app-core/src/tool/browser_request.rs:192-197 — both copies are in the same file, so extract the 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) crates/jcode-base/src/import.rs:162 — crates/jcode-base/src/import.rs:162-167 | crates/jcode-base/src/import.rs:804-810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/import.rs:162` 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) crates/jcode-base/src/import.rs:1127 — crates/jcode-base/src/import.rs:1127-1132 | crates/jcode-import-core/src/lib.rs:677-682 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.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 `crates/jcode-base/src/import.rs:1127` 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, `crates/jcode-base/src/import.rs:1133` calls `get` and `crates/jcode-import-core/src/lib.rs:683` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) crates/jcode-base/src/mcp/client.rs:335 — crates/jcode-base/src/mcp/client.rs:335-340 | crates/jcode-base/src/mcp/client.rs:379-384 — both copies are in the same file, so extract the 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) crates/jcode-base/src/mobile_sync.rs:596 — crates/jcode-base/src/mobile_sync.rs:596-603 | crates/jcode-tui/src/tui/session_picker/loading.rs:2954-2959 — 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 `crates/jcode-base/src/mobile_sync.rs:596` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) crates/jcode-base/src/platform.rs:156 — crates/jcode-base/src/platform.rs:156-161 | crates/jcode-base/src/skill.rs:210-216 — 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 `crates/jcode-base/src/platform.rs:156` 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) crates/jcode-base/src/session/memory_profile.rs:92 — crates/jcode-base/src/session/memory_profile.rs:92-97 | crates/jcode-tui/src/tui/memory_profile.rs:219-224 — 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 `crates/jcode-base/src/session/memory_profile.rs:92` 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) crates/jcode-import-core/src/lib.rs:463 — crates/jcode-import-core/src/lib.rs:463-468 | crates/jcode-import-core/src/lib.rs:1121-1126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-import-core/src/lib.rs:463` 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) crates/jcode-import-core/src/lib.rs:1125 — crates/jcode-import-core/src/lib.rs:1125-1130 | crates/jcode-tui/src/tui/session_picker/loading.rs:861-867 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 `crates/jcode-import-core/src/lib.rs:1125` 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 (6 lines × 2) crates/jcode-provider-copilot/src/lib.rs:90 — crates/jcode-provider-copilot/src/lib.rs:90-95 | crates/jcode-provider-openrouter/src/request.rs:97-103 — before extracting anything, compare `crates/jcode-provider-copilot/src/lib.rs` and `crates/jcode-provider-openrouter/src/request.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-provider-copilot/src/lib.rs:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) crates/jcode-provider-core/src/lib.rs:870 — crates/jcode-provider-core/src/lib.rs:870-880 | crates/jcode-provider-core/src/lib.rs:914-919 — both copies are in the same file, so extract the 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, `crates/jcode-provider-core/src/lib.rs:882` calls `pool_idle_timeout`, `from_secs` and `crates/jcode-provider-core/src/lib.rs:922` 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 (6 lines × 2) crates/jcode-tui-account-picker/src/overlay.rs:521 — crates/jcode-tui-account-picker/src/overlay.rs:521-526 | crates/jcode-tui/src/tui/login_picker.rs:427-432 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 204 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 `crates/jcode-tui-account-picker/src/overlay.rs:521` 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) crates/jcode-tui-markdown/src/markdown_render_lazy.rs:465 — crates/jcode-tui-markdown/src/markdown_render_lazy.rs:465-470 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:475-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-markdown/src/markdown_render_lazy.rs:475` 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) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:227 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:227-232 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:396-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:227` 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) crates/jcode-tui/src/tui/app/commands.rs:3506 — crates/jcode-tui/src/tui/app/commands.rs:3506-3511 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1592-1597 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-tui/src/tui/app/commands.rs:3506` 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) crates/jcode-tui/src/tui/app/commands_improve.rs:604 — crates/jcode-tui/src/tui/app/commands_improve.rs:604-609 | crates/jcode-tui/src/tui/app/commands_improve.rs:701-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 51 more in this group — see findings.md.
D2 · Cognitive Complexity · App · ×74
  • App::run_turn_interactive (cognitive 763) crates/jcode-tui/src/tui/app/turn.rs:64 — App::run_turn_interactive has cognitive complexity 763 (threshold 15). Drivers by points: if/else 125 (625 pts), match/switch 17 (72 pts), loops 13 (52 pts), boolean chains 14 (nesting depth added 594). 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::handle_inline_interactive_key (cognitive 221) crates/jcode-tui/src/tui/app/inline_interactive.rs:3532 — App::handle_inline_interactive_key has cognitive complexity 221 (threshold 15). Drivers by points: if/else 75 (175 pts), boolean chains 21, match/switch 7 (20 pts), loops 1 (5 pts) (nesting depth added 117). 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_debug_command (cognitive 219) crates/jcode-tui/src/tui/app/debug_cmds.rs:6 — App::handle_debug_command has cognitive complexity 219 (threshold 15). Drivers by points: if/else 131 (147 pts), match/switch 24 (45 pts), boolean chains 22, loops 2 (5 pts) (nesting depth added 40). 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_mouse_event (cognitive 219) crates/jcode-tui/src/tui/app/navigation.rs:1329 — App::handle_mouse_event has cognitive complexity 219 (threshold 15). Drivers by points: if/else 95 (179 pts), boolean chains 21, match/switch 12 (19 pts) (nesting depth added 91). 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::run_remote (cognitive 154) crates/jcode-tui/src/tui/app/run_shell.rs:901 — App::run_remote has cognitive complexity 154 (threshold 15). Drivers by points: if/else 36 (106 pts), match/switch 10 (35 pts), loops 3 (7 pts), boolean chains 6 (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.
  • App::handle_login_input (cognitive 127) crates/jcode-tui/src/tui/app/auth.rs:1841 — App::handle_login_input has cognitive complexity 127 (threshold 15). Drivers by points: if/else 44 (88 pts), match/switch 15 (30 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 61). 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::get_suggestions_for (cognitive 104) crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:478 — App::get_suggestions_for has cognitive complexity 104 (threshold 15). Drivers by points: if/else 70 (86 pts), boolean chains 10, loops 3 (8 pts) (nesting depth added 21). 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::build_model_picker_entries (cognitive 97) crates/jcode-tui/src/tui/app/inline_interactive.rs:1668 — App::build_model_picker_entries has cognitive complexity 97 (threshold 15). Drivers by points: if/else 33 (63 pts), loops 9 (21 pts), boolean chains 8, match/switch 2 (5 pts) (nesting depth added 45). Of this number, 92 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::info_widget_data (cognitive 75) crates/jcode-tui/src/tui/app/tui_state.rs:1582 — App::info_widget_data has cognitive complexity 75 (threshold 15). Drivers by points: if/else 44 (57 pts), boolean chains 12, match/switch 3 (6 pts) (nesting depth added 16). 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::context_snapshot (cognitive 61) crates/jcode-tui/src/tui/app/tui_state.rs:1302 — App::context_snapshot has cognitive complexity 61 (threshold 15). Drivers by points: if/else 25 (38 pts), match/switch 5 (13 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 25). 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::trigger_provider_auth_changed (cognitive 55) crates/jcode-tui/src/tui/app/auth.rs:2638 — App::trigger_provider_auth_changed has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (50 pts), boolean chains 5 (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.
  • App::collect_missing_tool_outputs_since_last_scan (cognitive 55) crates/jcode-tui/src/tui/app/conversation_state.rs:605 — App::collect_missing_tool_outputs_since_last_scan has cognitive complexity 55 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 6 (15 pts), match/switch 4 (11 pts) (nesting depth added 35). 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::schedule_auto_poke_followup_after_response (cognitive 52) crates/jcode-tui/src/tui/app/input.rs:1475 — App::schedule_auto_poke_followup_after_response has cognitive complexity 52 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 13 (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.
  • App::run (cognitive 50) crates/jcode-tui/src/tui/app/run_shell.rs:759 — App::run has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (41 pts), match/switch 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::open_model_picker_inner (cognitive 46) crates/jcode-tui/src/tui/app/inline_interactive.rs:1161 — App::open_model_picker_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 29 (42 pts), boolean chains 4 (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::handle_login_completed (cognitive 44) crates/jcode-tui/src/tui/app/auth.rs:3111 — App::handle_login_completed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::submit_input (cognitive 42) crates/jcode-tui/src/tui/app/input.rs:3906 — App::submit_input has cognitive complexity 42 (threshold 15). Drivers by points: if/else 27 (37 pts), match/switch 1 (3 pts), boolean chains 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.
  • App::run_scroll_test (cognitive 41) crates/jcode-tui/src/tui/app/debug_bench.rs:717 — App::run_scroll_test has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (23 pts), match/switch 4 (9 pts), loops 6 (8 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.
  • App::handle_key_core (cognitive 40) crates/jcode-tui/src/tui/app/input.rs:3121 — App::handle_key_core has cognitive complexity 40 (threshold 15). Drivers by points: if/else 29 (32 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • App::open_agent_model_picker (cognitive 39) crates/jcode-tui/src/tui/app/inline_interactive/openers.rs:216 — App::open_agent_model_picker has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 6 (15 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.
  • App::run_fix_command (cognitive 39) crates/jcode-tui/src/tui/app/model_context.rs:2013 — App::run_fix_command has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 4 (15 pts), loops 2 (3 pts), boolean chains 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_session_picker_selection (cognitive 38) crates/jcode-tui/src/tui/app/inline_interactive.rs:2850 — App::handle_session_picker_selection has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 3 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::process_queued_messages (cognitive 37) crates/jcode-tui/src/tui/app/input.rs:4207 — App::process_queued_messages has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 3 (5 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_copy_selection_mouse_with (cognitive 36) crates/jcode-tui/src/tui/app/copy_selection.rs:558 — App::handle_copy_selection_mouse_with has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 3, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::restore_session (cognitive 36) crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:363 — App::restore_session has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 49 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode_app_core · ×69
  • jcode_app_core::server::client_lifecycle::handle_client (cyclomatic 291) crates/jcode-app-core/src/server/client_lifecycle.rs:245 — jcode_app_core::server::client_lifecycle::handle_client has cyclomatic complexity 291 (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.
  • jcode_app_core::server::debug_command_exec::execute_debug_command (cyclomatic 78) crates/jcode-app-core/src/server/debug_command_exec.rs:162 — jcode_app_core::server::debug_command_exec::execute_debug_command has cyclomatic complexity 78 (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.
  • jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command (cyclomatic 73) crates/jcode-app-core/src/server/debug_swarm_read.rs:20 — jcode_app_core::server::debug_swarm_read::maybe_handle_swarm_read_command has cyclomatic complexity 73 (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.
  • jcode_app_core::server::runtime_commands::execute (cyclomatic 70) crates/jcode-app-core/src/server/runtime_commands.rs:34 — jcode_app_core::server::runtime_commands::execute 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.
  • jcode_app_core::tool::browser_request::bridge_request (cyclomatic 70) crates/jcode-app-core/src/tool/browser_request.rs:3 — jcode_app_core::tool::browser_request::bridge_request has cyclomatic complexity 70 (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.
  • jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command (cyclomatic 50) crates/jcode-app-core/src/server/debug_swarm_write.rs:19 — jcode_app_core::server::debug_swarm_write::maybe_handle_swarm_write_command has cyclomatic complexity 50 (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.
  • jcode_app_core::tool::browser_fast::run (cyclomatic 48) crates/jcode-app-core/src/tool/browser_fast.rs:584 — jcode_app_core::tool::browser_fast::run 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.
  • jcode_app_core::tool::todo_names::normalize_public_input (cyclomatic 48) crates/jcode-app-core/src/tool/todo_names.rs:139 — jcode_app_core::tool::todo_names::normalize_public_input has cyclomatic complexity 48 (threshold 15). Of this number, 44 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::server::client_session::handle_resume_session (cyclomatic 47) crates/jcode-app-core/src/server/client_session.rs:1285 — jcode_app_core::server::client_session::handle_resume_session has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::server::client_comm_message::handle_comm_message (cyclomatic 42) crates/jcode-app-core/src/server/client_comm_message.rs:102 — jcode_app_core::server::client_comm_message::handle_comm_message has cyclomatic complexity 42 (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.
  • jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request (cyclomatic 42) crates/jcode-app-core/src/server/client_lightweight_control.rs:246 — jcode_app_core::server::client_lightweight_control::handle_lightweight_control_request has cyclomatic complexity 42 (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.
  • jcode_app_core::server::comm_control::handle_comm_task_control (cyclomatic 42) crates/jcode-app-core/src/server/comm_control.rs:1690 — jcode_app_core::server::comm_control::handle_comm_task_control has cyclomatic complexity 42 (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.
  • jcode_app_core::server::debug::handle_debug_client (cyclomatic 41) crates/jcode-app-core/src/server/debug.rs:316 — jcode_app_core::server::debug::handle_debug_client has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::tool::todo::apply_todo_patch (cyclomatic 41) crates/jcode-app-core/src/tool/todo.rs:323 — jcode_app_core::tool::todo::apply_todo_patch has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::tool::selfdev::status::selfdev_status_output (cyclomatic 38) crates/jcode-app-core/src/tool/selfdev/status.rs:3 — jcode_app_core::tool::selfdev::status::selfdev_status_output has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_app_core::server::group_transfer::handle_with_gate (cyclomatic 37) crates/jcode-app-core/src/server/group_transfer.rs:248 — jcode_app_core::server::group_transfer::handle_with_gate has cyclomatic complexity 37 (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.
  • jcode_app_core::server::runtime_ssh_accounts::execute (cyclomatic 36) crates/jcode-app-core/src/server/runtime_ssh_accounts.rs:380 — jcode_app_core::server::runtime_ssh_accounts::execute 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.
  • jcode_app_core::tool::browser_fast_actions::candidates (cyclomatic 36) crates/jcode-app-core/src/tool/browser_fast_actions.rs:158 — jcode_app_core::tool::browser_fast_actions::candidates 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.
  • jcode_app_core::tool::apply_patch::parse_apply_patch (cyclomatic 32) crates/jcode-app-core/src/tool/apply_patch.rs:661 — jcode_app_core::tool::apply_patch::parse_apply_patch 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.
  • jcode_app_core::server::runtime_ssh_host::execute (cyclomatic 31) crates/jcode-app-core/src/server/runtime_ssh_host.rs:345 — jcode_app_core::server::runtime_ssh_host::execute 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.
  • jcode_app_core::server::client_disconnect_cleanup::cleanup_client_connection (cyclomatic 29) crates/jcode-app-core/src/server/client_disconnect_cleanup.rs:114 — jcode_app_core::server::client_disconnect_cleanup::cleanup_client_connection 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.
  • jcode_app_core::server::swarm::update_member_status_with_report_tldr (cyclomatic 29) crates/jcode-app-core/src/server/swarm.rs:1709 — jcode_app_core::server::swarm::update_member_status_with_report_tldr 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.
  • jcode_app_core::server::client_session::handle_subscribe (cyclomatic 28) crates/jcode-app-core/src/server/client_session.rs:643 — jcode_app_core::server::client_session::handle_subscribe 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.
  • jcode_app_core::server::headless::create_headless_session (cyclomatic 28) crates/jcode-app-core/src/server/headless.rs:37 — jcode_app_core::server::headless::create_headless_session has cyclomatic complexity 28 (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.
  • jcode_app_core::tool::browser_fast::scoped (cyclomatic 27) crates/jcode-app-core/src/tool/browser_fast.rs:190 — jcode_app_core::tool::browser_fast::scoped has cyclomatic complexity 27 (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.
  • + 44 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×69
  • Duplicated block (10 lines × 2) crates/jcode-app-core/src/agent/status.rs:78 — crates/jcode-app-core/src/agent/status.rs:78-87 | crates/jcode-app-core/src/agent/turn_execution.rs:1580-1589 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 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 `crates/jcode-app-core/src/agent/status.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/jcode-app-core/src/agent/turn_execution.rs:1590` calls `trim_start`, `starts_with` and `crates/jcode-app-core/src/agent/status.rs:88` 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) crates/jcode-app-core/src/server/client_actions.rs:818 — crates/jcode-app-core/src/server/client_actions.rs:818-827 | crates/jcode-tui/src/tui/app/commands.rs:378-387 — before extracting anything, compare `crates/jcode-app-core/src/server/client_actions.rs` and `crates/jcode-tui/src/tui/app/commands.rs` as WHOLE FILES: this scan already matched 4 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. 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 `&Session` in one and `&crate::session::Session` 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) crates/jcode-app-core/src/server/debug_swarm_write.rs:375 — crates/jcode-app-core/src/server/debug_swarm_write.rs:375-384 | crates/jcode-app-core/src/server/debug_swarm_write.rs:483-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_swarm_write.rs:375` 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) crates/jcode-app-core/src/telemetry_state.rs:83 — crates/jcode-app-core/src/telemetry_state.rs:83-92 | crates/jcode-telemetry-core/src/state_support.rs:81-90 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 × 2) crates/jcode-app-core/src/tool/discover.rs:1053 — crates/jcode-app-core/src/tool/discover.rs:1053-1062 | crates/jcode-app-core/src/tool/discover.rs:1247-1256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/discover.rs:1053` 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) crates/jcode-app-core/src/tool/read.rs:457 — crates/jcode-app-core/src/tool/read.rs:457-466 | crates/jcode-app-core/src/tool/read.rs:511-520 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/tool/remote_exec.rs:145 — crates/jcode-app-core/src/tool/remote_exec.rs:145-154 | crates/jcode-app-core/src/tool/remote_exec.rs:354-363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/remote_exec.rs:145` 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) crates/jcode-app-core/src/tool/session_search.rs:1114 — crates/jcode-app-core/src/tool/session_search.rs:1114-1123 | crates/jcode-app-core/src/tool/session_search.rs:1228-1237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/session_search.rs:1114` 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) crates/jcode-base/src/auth/refresh_state.rs:289 — crates/jcode-base/src/auth/refresh_state.rs:289-298 | crates/jcode-base/src/auth/validation.rs:62-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. 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 × 2) crates/jcode-base/src/background.rs:206 — crates/jcode-base/src/background.rs:206-215 | crates/jcode-base/src/background.rs:301-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/background.rs:206` 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, `crates/jcode-base/src/background.rs:299` calls `output_path_for`, `read_to_string`, `unwrap_or_default` and `crates/jcode-base/src/background.rs:204` 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) crates/jcode-base/src/browser.rs:1221 — crates/jcode-base/src/browser.rs:1221-1230 | crates/jcode-base/src/browser.rs:1266-1275 — both copies are in the same file, so extract the 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 (10 lines × 2) REDACTED:309 — REDACTED:309-318 | REDACTED:452-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 (10 lines × 2) crates/jcode-base/src/compaction.rs:962 — crates/jcode-base/src/compaction.rs:962-971 | crates/jcode-base/src/compaction.rs:1177-1186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/compaction.rs:962` 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) crates/jcode-base/src/memory.rs:492 — crates/jcode-base/src/memory.rs:492-501 | crates/jcode-base/src/memory.rs:513-522 — both copies are in the same file, so extract the 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) crates/jcode-base/src/memory/pending.rs:590 — crates/jcode-base/src/memory/pending.rs:590-599 | crates/jcode-base/src/memory/pending.rs:645-654 — both copies are in the same file, so extract the 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) crates/jcode-base/src/prompt.rs:392 — crates/jcode-base/src/prompt.rs:392-401 | crates/jcode-base/src/prompt.rs:529-540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/prompt.rs:392` 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) crates/jcode-base/src/provider/mod.rs:1726 — crates/jcode-base/src/provider/mod.rs:1726-1735 | crates/jcode-base/src/provider/mod.rs:2249-2258 — both copies are in the same file, so extract the 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) crates/jcode-base/src/provider/mod.rs:2972 — crates/jcode-base/src/provider/mod.rs:2972-2981 | crates/jcode-base/src/provider/startup.rs:302-311 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider/mod.rs:2972` 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) crates/jcode-base/src/provider_activity_oauth.rs:247 — crates/jcode-base/src/provider_activity_oauth.rs:247-256 | crates/jcode-base/src/provider_activity_oauth.rs:370-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider_activity_oauth.rs:247` 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) crates/jcode-base/src/session/prewarm.rs:102 — crates/jcode-base/src/session/prewarm.rs:102-111 | crates/jcode-storage/src/active_pids.rs:147-156 — 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 `crates/jcode-base/src/session/prewarm.rs:102` 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) crates/jcode-base/src/skill.rs:481 — crates/jcode-base/src/skill.rs:481-490 | crates/jcode-base/src/skill.rs:656-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/skill.rs:481` 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) crates/jcode-base/src/usage/api_keys.rs:339 — crates/jcode-base/src/usage/api_keys.rs:339-348 | crates/jcode-base/src/usage/api_keys.rs:394-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/usage/api_keys.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.
  • Duplicated block (10 lines × 2) crates/jcode-base/src/usage/api_keys.rs:443 — crates/jcode-base/src/usage/api_keys.rs:443-452 | crates/jcode-base/src/usage/api_keys.rs:613-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/usage/api_keys.rs:443` 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) crates/jcode-harness-api-server/src/translate.rs:2979 — crates/jcode-harness-api-server/src/translate.rs:2979-2988 | crates/jcode-harness-api-server/src/translate.rs:2995-3004 — both copies are in the same file, so extract the 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) crates/jcode-provider-anthropic-runtime/src/error_classification.rs:44 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:44-53 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2001-2011 — 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.
  • + 44 more in this group — see findings.md.
D2 · Cognitive Complexity · jcode · ×62
  • jcode::bin::memory_recall_bench::cmd_metrics (cognitive 176) src/bin/memory_recall_bench.rs:1014 — jcode::bin::memory_recall_bench::cmd_metrics has cognitive complexity 176 (threshold 15). Drivers by points: if/else 51 (102 pts), loops 16 (45 pts), match/switch 9 (23 pts), boolean chains 6 (nesting depth added 94). 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.
  • jcode::cli::commands::run_memory_command_for_dir (cognitive 114) src/cli/commands.rs:1637 — jcode::cli::commands::run_memory_command_for_dir has cognitive complexity 114 (threshold 15). Drivers by points: if/else 28 (64 pts), loops 9 (31 pts), boolean chains 11, match/switch 4 (8 pts) (nesting depth added 62). 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.
  • jcode::bin::memory_recall_bench::cmd_gate (cognitive 108) src/bin/memory_recall_bench.rs:2189 — jcode::bin::memory_recall_bench::cmd_gate has cognitive complexity 108 (threshold 15). Drivers by points: if/else 25 (60 pts), loops 9 (21 pts), match/switch 7 (20 pts), boolean chains 7 (nesting depth added 60). 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.
  • jcode::cli::tui_launch::list_sessions (cognitive 100) src/cli/tui_launch.rs:606 — jcode::cli::tui_launch::list_sessions has cognitive complexity 100 (threshold 15). Drivers by points: if/else 26 (67 pts), match/switch 8 (18 pts), boolean chains 8, loops 3 (7 pts) (nesting depth added 55). Of this number, 95 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::bin::tui_bench::main (cognitive 75) src/bin/tui_bench.rs:1212 — jcode::bin::tui_bench::main has cognitive complexity 75 (threshold 15). Drivers by points: if/else 44 (71 pts), boolean chains 3, loops 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.
  • jcode::cli::provider_init::init_provider_with_model_policy (cognitive 74) src/cli/provider_init.rs:1525 — jcode::cli::provider_init::init_provider_with_model_policy has cognitive complexity 74 (threshold 15). Drivers by points: if/else 32 (58 pts), boolean chains 15, match/switch 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session (cognitive 56) src/bin/tui_bench.rs:659 — jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (49 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::commands::todo_followup::prepare_run_todo_follow_up (cognitive 55) src/cli/commands/todo_followup.rs:156 — jcode::cli::commands::todo_followup::prepare_run_todo_follow_up has cognitive complexity 55 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 7 (15 pts), boolean chains 7, match/switch 2 (6 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.
  • jcode::cli::commands::run_single_message_command_ndjson (cognitive 52) src/cli/commands.rs:3106 — jcode::cli::commands::run_single_message_command_ndjson has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (34 pts), match/switch 4 (10 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::dispatch::run_main (cognitive 52) src/cli/dispatch.rs:74 — jcode::cli::dispatch::run_main has cognitive complexity 52 (threshold 15). Drivers by points: if/else 26 (35 pts), match/switch 8 (15 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::ssh_transport::accept_connections (cognitive 52) REDACTED:522 — jcode::cli::ssh_transport::accept_connections has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (39 pts), match/switch 4 (11 pts), loops 2 (nesting depth added 33). 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.
  • jcode::cli::cloud_group_run::run_migrate (cognitive 48) src/cli/cloud_group_run.rs:3 — jcode::cli::cloud_group_run::run_migrate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (37 pts), loops 5 (6 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::cloud_group_receive::activate (cognitive 41) src/cli/cloud_group_receive.rs:61 — jcode::cli::cloud_group_receive::activate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 4 (6 pts), boolean chains 3 (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.
  • jcode::cli::commands::run_server_stop_command (cognitive 41) src/cli/commands.rs:2477 — jcode::cli::commands::run_server_stop_command has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 5, match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::cloud_move::run_cli (cognitive 38) src/cli/cloud_move.rs:2111 — jcode::cli::cloud_move::run_cli has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 3 (6 pts), loops 1 (3 pts), boolean chains 2 (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.
  • jcode::cli::login::login_openai_compatible_flow (cognitive 38) src/cli/login.rs:853 — jcode::cli::login::login_openai_compatible_flow has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (29 pts), match/switch 4 (7 pts), boolean chains 2 (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.
  • jcode::cli::cloud_env::exchange_bounded (cognitive 36) src/cli/cloud_env.rs:144 — jcode::cli::cloud_env::exchange_bounded has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 3 (9 pts), loops 2, 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.
  • jcode::cli::commands::run_cloud_sessions_sync (cognitive 36) src/cli/commands.rs:625 — jcode::cli::commands::run_cloud_sessions_sync has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode::cli::tui_launch::run_replay_command (cognitive 34) src/cli/tui_launch.rs:328 — jcode::cli::tui_launch::run_replay_command has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 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.
  • jcode::cli::cloud_move::run_move (cognitive 33) src/cli/cloud_move.rs:442 — jcode::cli::cloud_move::run_move has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 7, match/switch 2 (3 pts) (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.
  • jcode::cli::commands::run_single_message_command_plain_with_auto_poke (cognitive 33) src/cli/commands.rs:2868 — jcode::cli::commands::run_single_message_command_plain_with_auto_poke has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (29 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode::cli::commands::run_single_message_command_capture_with_auto_poke) 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.
  • jcode::cli::commands::run_single_message_command_capture_with_auto_poke (cognitive 33) src/cli/commands.rs:2985 — jcode::cli::commands::run_single_message_command_capture_with_auto_poke has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (29 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode::cli::commands::run_single_message_command_plain_with_auto_poke) 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.
  • jcode::cli::dispatch::run_default_command (cognitive 33) src/cli/dispatch.rs:796 — jcode::cli::dispatch::run_default_command has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 9 (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.
  • jcode::cli::login::run_login_provider (cognitive 33) src/cli/login.rs:268 — jcode::cli::login::run_login_provider has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 6, match/switch 2 (3 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.
  • jcode::cli::dispatch::run_server_keepalive (cognitive 29) src/cli/dispatch.rs:1495 — jcode::cli::dispatch::run_server_keepalive has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 37 more in this group — see findings.md.
D1 · Cyclomatic Complexity · App · ×59
  • App::run_turn_interactive (cyclomatic 219) crates/jcode-tui/src/tui/app/turn.rs:64 — App::run_turn_interactive has cyclomatic complexity 219 (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_debug_command (cyclomatic 176) crates/jcode-tui/src/tui/app/debug_cmds.rs:6 — App::handle_debug_command has cyclomatic complexity 176 (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_mouse_event (cyclomatic 135) crates/jcode-tui/src/tui/app/navigation.rs:1329 — App::handle_mouse_event has cyclomatic complexity 135 (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_inline_interactive_key (cyclomatic 113) crates/jcode-tui/src/tui/app/inline_interactive.rs:3532 — App::handle_inline_interactive_key has cyclomatic complexity 113 (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::get_suggestions_for (cyclomatic 79) crates/jcode-tui/src/tui/app/state_ui_input_helpers.rs:478 — App::get_suggestions_for has cyclomatic complexity 79 (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_login_input (cyclomatic 77) crates/jcode-tui/src/tui/app/auth.rs:1841 — App::handle_login_input has cyclomatic complexity 77 (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::run_remote (cyclomatic 59) crates/jcode-tui/src/tui/app/run_shell.rs:901 — App::run_remote has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::build_model_picker_entries (cyclomatic 52) crates/jcode-tui/src/tui/app/inline_interactive.rs:1668 — App::build_model_picker_entries has cyclomatic complexity 52 (threshold 15). Of this number, 45 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::eval_assertions (cyclomatic 51) crates/jcode-tui/src/tui/app/debug_script.rs:44 — App::eval_assertions has cyclomatic complexity 51 (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::info_widget_data (cyclomatic 44) crates/jcode-tui/src/tui/app/tui_state.rs:1582 — App::info_widget_data has cyclomatic complexity 44 (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::context_snapshot (cyclomatic 38) crates/jcode-tui/src/tui/app/tui_state.rs:1302 — App::context_snapshot has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::schedule_auto_poke_followup_after_response (cyclomatic 37) crates/jcode-tui/src/tui/app/input.rs:1475 — App::schedule_auto_poke_followup_after_response 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.
  • App::handle_key_core (cyclomatic 37) crates/jcode-tui/src/tui/app/input.rs:3121 — App::handle_key_core has cyclomatic complexity 37 (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_ssh_login_key (cyclomatic 33) crates/jcode-tui/src/tui/app/auth_remote.rs:355 — App::handle_ssh_login_key has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::handle_onboarding_import_review_key (cyclomatic 31) crates/jcode-tui/src/tui/app/onboarding_flow_control.rs:555 — App::handle_onboarding_import_review_key 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.
  • App::open_account_picker (cyclomatic 30) crates/jcode-tui/src/tui/app/auth_account_picker.rs:215 — App::open_account_picker 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.
  • App::open_account_center (cyclomatic 28) crates/jcode-tui/src/tui/app/auth_account_picker/account_center.rs:4 — App::open_account_center has cyclomatic complexity 28 (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_login_completed (cyclomatic 27) crates/jcode-tui/src/tui/app/auth.rs:3111 — App::handle_login_completed 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::submit_input (cyclomatic 27) crates/jcode-tui/src/tui/app/input.rs:3906 — App::submit_input 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::handle_session_picker_selection (cyclomatic 26) crates/jcode-tui/src/tui/app/inline_interactive.rs:2850 — App::handle_session_picker_selection 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::run_scroll_test (cyclomatic 25) crates/jcode-tui/src/tui/app/debug_bench.rs:717 — App::run_scroll_test 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.
  • App::open_model_picker_inner (cyclomatic 25) crates/jcode-tui/src/tui/app/inline_interactive.rs:1161 — App::open_model_picker_inner 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.
  • App::poll_cloud_job (cyclomatic 23) crates/jcode-tui/src/tui/app/commands_cloud.rs:720 — App::poll_cloud_job 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.
  • App::handle_copy_selection_mouse_with (cyclomatic 23) crates/jcode-tui/src/tui/app/copy_selection.rs:558 — App::handle_copy_selection_mouse_with 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.
  • App::handle_provider_failover_prompt_with_payload (cyclomatic 23) crates/jcode-tui/src/tui/app/model_context.rs:418 — App::handle_provider_failover_prompt_with_payload 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.
  • + 34 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×53
  • Duplicated block (11 lines × 2) crates/jcode-app-core/src/ambient/runner.rs:958 — crates/jcode-app-core/src/ambient/runner.rs:958-968 | crates/jcode-app-core/src/ambient/runner.rs:985-995 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) crates/jcode-app-core/src/server/client_actions.rs:406 — crates/jcode-app-core/src/server/client_actions.rs:406-416 | crates/jcode-app-core/src/server/client_actions.rs:428-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_actions.rs:406` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/jcode-app-core/src/server/client_state.rs:938 — crates/jcode-app-core/src/server/client_state.rs:938-948 | crates/jcode-app-core/src/server/client_state.rs:1268-1278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:1465 — crates/jcode-app-core/src/server/comm_control.rs:1465-1475 | crates/jcode-app-core/src/server/comm_plan.rs:527-537 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-app-core/src/server/comm_control.rs:1465` 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, `crates/jcode-app-core/src/server/comm_plan.rs:538` calls `push` and `crates/jcode-app-core/src/server/comm_control.rs:1476` 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) crates/jcode-app-core/src/server/comm_plan.rs:281 — crates/jcode-app-core/src/server/comm_plan.rs:281-291 | crates/jcode-app-core/src/server/comm_plan.rs:301-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 `crates/jcode-app-core/src/server/comm_plan.rs:281` 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) crates/jcode-app-core/src/server/jade_relay.rs:369 — crates/jcode-app-core/src/server/jade_relay.rs:369-379 | crates/jcode-app-core/src/server/jade_relay.rs:767-777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/jade_relay.rs:369` 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) crates/jcode-app-core/src/server/reload.rs:43 — crates/jcode-app-core/src/server/reload.rs:43-53 | crates/jcode-base/src/mobile_runner.rs:312-322 — 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 `crates/jcode-app-core/src/server/reload.rs:43` 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) crates/jcode-app-core/src/tool/ambient.rs:361 — crates/jcode-app-core/src/tool/ambient.rs:361-371 | crates/jcode-app-core/src/tool/ambient.rs:896-906 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/ambient.rs:361` 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) crates/jcode-app-core/src/tool/bridge_reload.rs:129 — crates/jcode-app-core/src/tool/bridge_reload.rs:129-139 | crates/jcode-app-core/src/tool/desktop_selfdev.rs:331-341 — 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) crates/jcode-app-core/src/tool/discover.rs:1182 — crates/jcode-app-core/src/tool/discover.rs:1182-1192 | crates/jcode-app-core/src/tool/discover.rs:1263-1273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/discover.rs:1182` 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) crates/jcode-base/src/auth/codex.rs:541 — crates/jcode-base/src/auth/codex.rs:541-551 | crates/jcode-base/src/auth/codex.rs:554-564 — both copies are in the same file, so extract the 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) crates/jcode-base/src/gmail.rs:297 — crates/jcode-base/src/gmail.rs:297-307 | crates/jcode-base/src/gmail.rs:429-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/gmail.rs:297` 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 (11 lines × 2) crates/jcode-harness-api/src/sockets.rs:54 — crates/jcode-harness-api/src/sockets.rs:54-64 | crates/jcode-storage/src/lib.rs:143-153 — 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 `crates/jcode-storage/src/lib.rs:143` 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) crates/jcode-provider-anthropic-runtime/src/lib.rs:276 — crates/jcode-provider-anthropic-runtime/src/lib.rs:276-286 | crates/jcode-provider-anthropic-runtime/src/lib.rs:300-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-anthropic-runtime/src/lib.rs:276` 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, `crates/jcode-provider-anthropic-runtime/src/lib.rs:299` calls `json` and `crates/jcode-provider-anthropic-runtime/src/lib.rs:275` 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) crates/jcode-provider-antigravity-runtime/src/lib.rs:469 — crates/jcode-provider-antigravity-runtime/src/lib.rs:469-479 | crates/jcode-provider-gemini-runtime/src/lib.rs:621-631 — before extracting anything, compare `crates/jcode-provider-antigravity-runtime/src/lib.rs` and `crates/jcode-provider-gemini-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 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 `crates/jcode-provider-antigravity-runtime/src/lib.rs:469` 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) crates/jcode-provider-antigravity/src/lib.rs:240 — crates/jcode-provider-antigravity/src/lib.rs:240-250 | crates/jcode-provider-gemini/src/lib.rs:602-612 — 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 `models` to `impl IntoIterator<Item = String>` in one and `Vec<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) crates/jcode-telemetry-core/src/lib.rs:1008 — crates/jcode-telemetry-core/src/lib.rs:1008-1018 | crates/jcode-telemetry-core/src/lib.rs:1029-1039 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-telemetry-core/src/lib.rs:1008` 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 `state` to `&mut SessionTelemetry` in one and `&mut TurnTelemetry` 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) crates/jcode-tui-core/src/keybind.rs:89 — crates/jcode-tui-core/src/keybind.rs:89-99 | crates/jcode-tui/src/tui/keybind.rs:615-625 — 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 `crates/jcode-tui-core/src/keybind.rs:89` 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) crates/jcode-tui-markdown/src/markdown_render_full.rs:58 — crates/jcode-tui-markdown/src/markdown_render_full.rs:58-68 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:47-57 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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, `crates/jcode-tui-markdown/src/markdown_render_full.rs:69` calls `default` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs:60` 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 (11 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:878 — crates/jcode-tui/src/tui/app/commands.rs:878-888 | crates/jcode-tui/src/tui/app/input.rs:2763-2773 — 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 `crates/jcode-tui/src/tui/app/commands.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 (11 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:2101 — crates/jcode-tui/src/tui/app/commands.rs:2101-2111 | crates/jcode-tui/src/tui/app/remote/key_handling/rewind.rs:19-29 — 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 (11 lines × 2) crates/jcode-tui/src/tui/app/commands_improve.rs:238 — crates/jcode-tui/src/tui/app/commands_improve.rs:238-248 | crates/jcode-tui/src/tui/app/commands_improve.rs:271-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/commands_improve.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 (11 lines × 2) crates/jcode-tui/src/tui/app/helpers_rate_limit_parse.rs:48 — crates/jcode-tui/src/tui/app/helpers_rate_limit_parse.rs:48-58 | crates/jcode-tui/src/tui/app/helpers_rate_limit_parse.rs:109-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/helpers_rate_limit_parse.rs:48` 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) crates/jcode-tui/src/tui/app/local.rs:236 — crates/jcode-tui/src/tui/app/local.rs:236-246 | crates/jcode-tui/src/tui/app/remote.rs:790-800 — before extracting anything, compare `crates/jcode-tui/src/tui/app/local.rs` and `crates/jcode-tui/src/tui/app/remote.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. 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) crates/jcode-tui/src/tui/app/model_context_commands.rs:199 — crates/jcode-tui/src/tui/app/model_context_commands.rs:199-209 | crates/jcode-tui/src/tui/app/model_context_commands.rs:227-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/model_context_commands.rs:199` 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.
  • + 28 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×46
  • Duplicated block (13 lines × 2) crates/jcode-app-core/src/message_notifications.rs:157 — crates/jcode-app-core/src/message_notifications.rs:157-169 | crates/jcode-base/src/message/notifications.rs:514-526 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/message_notifications.rs:157` 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, `crates/jcode-base/src/message/notifications.rs:511` calls `parse_background_task_header_label` and `crates/jcode-app-core/src/message_notifications.rs:155` 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 (13 lines × 2) crates/jcode-app-core/src/server.rs:812 — crates/jcode-app-core/src/server.rs:812-824 | crates/jcode-app-core/src/server.rs:912-924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server.rs:812` 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) crates/jcode-app-core/src/server/client_lifecycle.rs:677 — crates/jcode-app-core/src/server/client_lifecycle.rs:677-689 | crates/jcode-app-core/src/server/client_lifecycle.rs:855-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 `crates/jcode-app-core/src/server/client_lifecycle.rs:677` 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) crates/jcode-app-core/src/server/jade_relay.rs:360 — crates/jcode-app-core/src/server/jade_relay.rs:360-372 | crates/jcode-app-core/src/server/jade_relay.rs:714-726 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/runtime.rs:156 — crates/jcode-app-core/src/server/runtime.rs:156-168 | crates/jcode-app-core/src/server/runtime.rs:192-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/runtime.rs:156` 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) crates/jcode-app-core/src/tool/ambient.rs:421 — crates/jcode-app-core/src/tool/ambient.rs:421-433 | crates/jcode-tui-permissions/src/lib.rs:665-677 — 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 `crates/jcode-tui-permissions/src/lib.rs:665` 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 `map` to `&Map<String, Value>` in one and `Option<&Map<String, 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 (13 lines × 2) REDACTED:1135 — REDACTED:1135-1150 | REDACTED:1193-1205 — both copies are in the same file, so extract the 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) REDACTED:1166 — REDACTED:1166-1178 | REDACTED:1209-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 `REDACTED:1166` 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 (13 lines × 2) crates/jcode-app-core/src/tool/discover.rs:1018 — crates/jcode-app-core/src/tool/discover.rs:1018-1030 | crates/jcode-app-core/src/tool/discover.rs:1209-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 `crates/jcode-app-core/src/tool/discover.rs:1018` 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 (13 lines × 2) crates/jcode-app-core/src/usage_openai.rs:39 — crates/jcode-app-core/src/usage_openai.rs:39-51 | crates/jcode-base/src/usage/openai_helpers.rs:45-57 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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) crates/jcode-base/src/compaction.rs:454 — crates/jcode-base/src/compaction.rs:454-466 | crates/jcode-base/src/compaction.rs:1738-1750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/compaction.rs:454` 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) crates/jcode-base/src/compaction.rs:1088 — crates/jcode-base/src/compaction.rs:1088-1100 | crates/jcode-base/src/compaction.rs:1104-1116 — both copies are in the same file, so extract the 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) crates/jcode-base/src/memory_rerank.rs:277 — crates/jcode-base/src/memory_rerank.rs:277-289 | crates/jcode-base/src/memory_rerank.rs:399-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.
  • Duplicated block (13 lines × 2) crates/jcode-base/src/provider_catalog.rs:1005 — crates/jcode-base/src/provider_catalog.rs:1005-1017 | crates/jcode-base/src/provider_catalog.rs:1141-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 `crates/jcode-base/src/provider_catalog.rs:1005` 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) crates/jcode-import-core/src/lib.rs:1105 — crates/jcode-import-core/src/lib.rs:1105-1117 | crates/jcode-session-types/src/lib.rs:622-634 — 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) crates/jcode-provider-anthropic-runtime/src/lib.rs:1321 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1321-1333 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1767-1779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-anthropic-runtime/src/lib.rs:1321` 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) crates/jcode-provider-core/src/catalog_refresh.rs:60 — crates/jcode-provider-core/src/catalog_refresh.rs:60-72 | crates/jcode-provider-core/src/catalog_refresh.rs:74-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-core/src/catalog_refresh.rs:60` 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) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:208 — crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:208-220 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:936-948 — 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 `crates/jcode-provider-openai-runtime/src/openai_provider_impl.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:222` calls `get` and `crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:949` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) crates/jcode-provider-openai/src/stream.rs:433 — crates/jcode-provider-openai/src/stream.rs:433-445 | crates/jcode-provider-openai/src/stream.rs:452-464 — both copies are in the same file, so extract the 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) crates/jcode-tui-account-picker/src/overlay.rs:360 — crates/jcode-tui-account-picker/src/overlay.rs:360-372 | crates/jcode-tui/src/tui/login_picker.rs:249-261 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 204 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 `crates/jcode-tui-account-picker/src/overlay.rs:360` 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) crates/jcode-tui-mermaid/src/mermaid_widget.rs:266 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:266-278 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:514-526 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_widget.rs:266` 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) crates/jcode-tui-render/src/lib.rs:87 — crates/jcode-tui-render/src/lib.rs:87-99 | crates/jcode-tui-render/src/lib.rs:137-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-render/src/lib.rs:87` 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) crates/jcode-tui-render/src/swarm_gallery.rs:1296 — crates/jcode-tui-render/src/swarm_gallery.rs:1296-1308 | crates/jcode-tui-render/src/swarm_gallery.rs:1394-1406 — both copies are in the same file, so extract the 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, `crates/jcode-tui-render/src/swarm_gallery.rs:1294` calls `sort_members_for_display`, `min` and `crates/jcode-tui-render/src/swarm_gallery.rs:1393` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) crates/jcode-tui/src/tui/app/local.rs:143 — crates/jcode-tui/src/tui/app/local.rs:143-155 | crates/jcode-tui/src/tui/app/remote.rs:233-245 — before extracting anything, compare `crates/jcode-tui/src/tui/app/local.rs` and `crates/jcode-tui/src/tui/app/remote.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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/jcode-tui/src/tui/app/observe.rs:301 — crates/jcode-tui/src/tui/app/observe.rs:301-313 | crates/jcode-tui/src/tui/app/split_view.rs:315-327 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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.
  • + 21 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode_base · ×43
  • jcode_base::session::render::render_messages_and_images_with_compacted_history (cyclomatic 42) crates/jcode-base/src/session/render.rs:365 — jcode_base::session::render::render_messages_and_images_with_compacted_history has cyclomatic complexity 42 (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.
  • jcode_base::browser::ensure_browser_setup_for (cyclomatic 36) crates/jcode-base/src/browser.rs:270 — jcode_base::browser::ensure_browser_setup_for 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.
  • jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback (cyclomatic 33) crates/jcode-base/src/provider/catalog_remote_routes.rs:3 — jcode_base::provider::catalog_remote_routes::remote_model_routes_fallback has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_base::mcp::remote::streamable_post_inner (cyclomatic 30) crates/jcode-base/src/mcp/remote.rs:610 — jcode_base::mcp::remote::streamable_post_inner 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.
  • jcode_base::auth::transfer::import_cloud_inner (cyclomatic 29) crates/jcode-base/src/auth/transfer.rs:1016 — jcode_base::auth::transfer::import_cloud_inner 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.
  • jcode_base::provider_catalog::apply_named_provider_profile_env_from_config (cyclomatic 27) crates/jcode-base/src/provider_catalog.rs:935 — jcode_base::provider_catalog::apply_named_provider_profile_env_from_config 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. This is NOT this file's highest cyclomatic complexity: jcode_base::provider_catalog::openai_compatible_profile_static_models (cyclomatic 32) 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.
  • jcode_base::auth::login_diagnostics::classify_auth_failure_message (cyclomatic 26) crates/jcode-base/src/auth/login_diagnostics.rs:38 — jcode_base::auth::login_diagnostics::classify_auth_failure_message has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • jcode_base::mobile_sync::sync_pass (cyclomatic 26) crates/jcode-base/src/mobile_sync.rs:708 — jcode_base::mobile_sync::sync_pass 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.
  • jcode_base::usage::provider_fetch::fetch_openai_usage_for_account (cyclomatic 24) crates/jcode-base/src/usage/provider_fetch.rs:150 — jcode_base::usage::provider_fetch::fetch_openai_usage_for_account has cyclomatic complexity 24 (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.
  • jcode_base::mcp::oauth::www_authenticate_param (cyclomatic 23) crates/jcode-base/src/mcp/oauth.rs:655 — jcode_base::mcp::oauth::www_authenticate_param 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.
  • jcode_base::auth::assessment_for_key (cyclomatic 22) crates/jcode-base/src/auth/mod.rs:1119 — jcode_base::auth::assessment_for_key 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.
  • jcode_base::gateway::handle_ws_connection (cyclomatic 22) crates/jcode-base/src/gateway.rs:146 — jcode_base::gateway::handle_ws_connection 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.
  • jcode_base::import::import_codex_session_from_path (cyclomatic 22) crates/jcode-base/src/import.rs:1069 — jcode_base::import::import_codex_session_from_path 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.
  • jcode_base::usage::openai_helpers::parse_openai_usage_payload (cyclomatic 22) crates/jcode-base/src/usage/openai_helpers.rs:339 — jcode_base::usage::openai_helpers::parse_openai_usage_payload 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.
  • jcode_base::provider::catalog_routes::simplified_model_routes_for_picker (cyclomatic 21) crates/jcode-base/src/provider/catalog_routes.rs:24 — jcode_base::provider::catalog_routes::simplified_model_routes_for_picker 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.
  • jcode_base::usage::api_keys::fetch_compatible_profile_report (cyclomatic 21) crates/jcode-base/src/usage/api_keys.rs:213 — jcode_base::usage::api_keys::fetch_compatible_profile_report 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.
  • jcode_base::auth::doctor::recommended_actions (cyclomatic 20) crates/jcode-base/src/auth/doctor.rs:111 — jcode_base::auth::doctor::recommended_actions 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.
  • jcode_base::auth::lifecycle::route_matches_activation (cyclomatic 19) crates/jcode-base/src/auth/lifecycle.rs:903 — jcode_base::auth::lifecycle::route_matches_activation has cyclomatic complexity 19 (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.
  • jcode_base::goal::render_goal_detail (cyclomatic 19) crates/jcode-base/src/goal.rs:414 — jcode_base::goal::render_goal_detail 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.
  • jcode_base::provider_activity::source_key_for_provider_label (cyclomatic 19) crates/jcode-base/src/provider_activity.rs:314 — jcode_base::provider_activity::source_key_for_provider_label 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.
  • jcode_base::session::crash::find_crashed_legacy_scan (cyclomatic 19) crates/jcode-base/src/session/crash.rs:414 — jcode_base::session::crash::find_crashed_legacy_scan 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.
  • jcode_base::provider::catalog_routes::append_openai_routes (cyclomatic 18) crates/jcode-base/src/provider/catalog_routes.rs:527 — jcode_base::provider::catalog_routes::append_openai_routes 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.
  • jcode_base::transcript_sample::recent_external_transcripts_in (cyclomatic 18) crates/jcode-base/src/transcript_sample.rs:99 — jcode_base::transcript_sample::recent_external_transcripts_in 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.
  • jcode_base::kv_cache_monitor::reason (cyclomatic 17) crates/jcode-base/src/kv_cache_monitor.rs:559 — jcode_base::kv_cache_monitor::reason has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_base::memory::pending::take_pending_memory_inner (cyclomatic 17) crates/jcode-base/src/memory/pending.rs:224 — jcode_base::memory::pending::take_pending_memory_inner 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.
  • + 18 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×38
  • Duplicated block (12 lines × 2) crates/jcode-app-core/src/notifications.rs:818 — crates/jcode-app-core/src/notifications.rs:818-829 | crates/jcode-setup-hints/src/cli_launch_hints.rs:367-378 — before extracting anything, compare `crates/jcode-app-core/src/notifications.rs` and `crates/jcode-setup-hints/src/cli_launch_hints.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/notifications.rs:818` 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) crates/jcode-app-core/src/server.rs:2155 — crates/jcode-app-core/src/server.rs:2155-2166 | crates/jcode-app-core/src/server.rs:2211-2222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server.rs:2155` 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) crates/jcode-app-core/src/server/debug_jobs.rs:96 — crates/jcode-app-core/src/server/debug_jobs.rs:96-107 | crates/jcode-app-core/src/server/debug_jobs.rs:128-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_jobs.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. 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 (12 lines × 2) crates/jcode-app-core/src/session_active_pids.rs:36 — crates/jcode-app-core/src/session_active_pids.rs:36-47 | crates/jcode-storage/src/active_pids.rs:205-216 — before extracting anything, compare `crates/jcode-app-core/src/session_active_pids.rs` and `crates/jcode-storage/src/active_pids.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 (12 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:110 — crates/jcode-app-core/src/telemetry_state.rs:110-121 | crates/jcode-telemetry-core/src/state_support.rs:108-119 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (12 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:267 — crates/jcode-app-core/src/telemetry_state.rs:267-278 | crates/jcode-telemetry-core/src/state_support.rs:310-321 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (12 lines × 2) crates/jcode-app-core/src/tool/communicate.rs:910 — crates/jcode-app-core/src/tool/communicate.rs:910-921 | crates/jcode-app-core/src/tool/communicate.rs:1002-1013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/communicate.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 (12 lines × 2) crates/jcode-app-core/src/usage_openai.rs:205 — crates/jcode-app-core/src/usage_openai.rs:205-216 | crates/jcode-base/src/usage/openai_helpers.rs:230-241 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (12 lines × 2) crates/jcode-base/src/cache_tracker.rs:136 — crates/jcode-base/src/cache_tracker.rs:136-147 | crates/jcode-base/src/cache_tracker.rs:166-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 `crates/jcode-base/src/cache_tracker.rs:136` 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, `crates/jcode-base/src/cache_tracker.rs:165` calls `unwrap_or` and `crates/jcode-base/src/cache_tracker.rs:133` 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) crates/jcode-base/src/mcp/oauth.rs:553 — crates/jcode-base/src/mcp/oauth.rs:553-564 | crates/jcode-base/src/mcp/oauth.rs:1143-1156 — both copies are in the same file, so extract the 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 lines × 2) crates/jcode-base/src/platform.rs:175 — crates/jcode-base/src/platform.rs:175-186 | crates/jcode-build-support/src/platform_support.rs:19-30 — 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 (12 lines × 2) crates/jcode-base/src/safety.rs:224 — crates/jcode-base/src/safety.rs:224-235 | crates/jcode-base/src/safety.rs:455-466 — both copies are in the same file, so extract the 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 lines × 2) crates/jcode-message-types/src/lib.rs:499 — crates/jcode-message-types/src/lib.rs:499-510 | crates/jcode-message-types/src/lib.rs:531-542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-message-types/src/lib.rs:499` 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) crates/jcode-provider-core/src/transport.rs:34 — crates/jcode-provider-core/src/transport.rs:34-45 | scripts/repro/tls-bad-record-mac/src/main.rs:27-38 — 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) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:582 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:582-593 | crates/jcode-provider-cursor-runtime/src/wire.rs:102-113 — before extracting anything, compare `crates/jcode-provider-cursor-runtime/src/agent_transport.rs` and `crates/jcode-provider-cursor-runtime/src/wire.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-cursor-runtime/src/agent_transport.rs:582` 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) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1094 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1094-1105 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1151-1162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1094` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12 lines × 2) crates/jcode-setup-hints/src/keymap/chord.rs:70 — crates/jcode-setup-hints/src/keymap/chord.rs:70-81 | crates/jcode-setup-hints/src/keymap/chord.rs:92-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-setup-hints/src/keymap/chord.rs:70` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) crates/jcode-telemetry-core/src/lib.rs:2631 — crates/jcode-telemetry-core/src/lib.rs:2631-2642 | crates/jcode-telemetry-core/src/lib.rs:2644-2655 — both copies are in the same file, so extract the 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 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:905 — crates/jcode-tui/src/tui/app/commands.rs:905-916 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:430-441 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-tui/src/tui/app/commands.rs:905` 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) crates/jcode-tui/src/tui/app/debug_profile.rs:802 — crates/jcode-tui/src/tui/app/debug_profile.rs:802-813 | crates/jcode-tui/src/tui/memory_profile.rs:155-166 — 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 (12 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:4063 — crates/jcode-tui/src/tui/app/inline_interactive.rs:4063-4074 | crates/jcode-tui/src/tui/app/model_context.rs:1017-1028 — 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 that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12 lines × 2) crates/jcode-tui/src/tui/app/remote/reconnect.rs:649 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:649-660 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:687-698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/reconnect.rs:649` 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, `crates/jcode-tui/src/tui/app/remote/reconnect.rs:701` calls `submitted_during_backoff` and `crates/jcode-tui/src/tui/app/remote/reconnect.rs:661` 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 (12 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2707 — crates/jcode-tui/src/tui/session_picker/loading.rs:2707-2718 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:239-250 — before extracting anything, compare `crates/jcode-tui/src/tui/session_picker/loading.rs` and `crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.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. 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 `crates/jcode-tui/src/tui/session_picker/loading.rs:2707` 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) crates/jcode-tui/src/tui/ui_messages.rs:2810 — crates/jcode-tui/src/tui/ui_messages.rs:2810-2821 | crates/jcode-tui/src/tui/ui_messages.rs:2885-2896 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_messages.rs:2810` 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/bin/memory_recall_bench.rs:1484 — src/bin/memory_recall_bench.rs:1484-1495 | src/bin/memory_recall_bench.rs:1622-1633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/bin/memory_recall_bench.rs:1484` 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.
  • + 13 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×38
  • Off the main sequence: jcode-agent-runtime — jcode-agent-runtime: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-ambient-types — jcode-ambient-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-applet-types — jcode-applet-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: jcode-auth-types — jcode-auth-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-background-types — jcode-background-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-command-risk — jcode-command-risk: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-config-types — jcode-config-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: jcode-core — jcode-core: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 13 project(s), so it's rigid to change.
  • Off the main sequence: jcode-desktop-open — jcode-desktop-open: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-embedding — jcode-embedding: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-gateway-types — jcode-gateway-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-import-core — jcode-import-core: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-memory-types — jcode-memory-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-message-types — jcode-message-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 24 project(s), so it's rigid to change.
  • Off the main sequence: jcode-notify-email — jcode-notify-email: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-overnight-core — jcode-overnight-core: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: jcode-plan — jcode-plan: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
  • Off the main sequence: jcode-provider-metadata — jcode-provider-metadata: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-schema-dialect — jcode-schema-dialect: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
  • Off the main sequence: jcode-selfdev-types — jcode-selfdev-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
  • Off the main sequence: jcode-side-panel-types — jcode-side-panel-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-task-types — jcode-task-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: jcode-terminal-image — jcode-terminal-image: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-terminal-launch — jcode-terminal-launch: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: jcode-tool-types — jcode-tool-types: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • + 13 more in this group — see findings.md.
D1 · Cyclomatic Complexity · jcode · ×37
  • jcode::bin::memory_recall_bench::cmd_metrics (cyclomatic 92) src/bin/memory_recall_bench.rs:1014 — jcode::bin::memory_recall_bench::cmd_metrics has cyclomatic complexity 92 (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.
  • jcode::cli::dispatch::run_main (cyclomatic 80) src/cli/dispatch.rs:74 — jcode::cli::dispatch::run_main has cyclomatic complexity 80 (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.
  • jcode::cli::tui_launch::list_sessions (cyclomatic 59) src/cli/tui_launch.rs:606 — jcode::cli::tui_launch::list_sessions has cyclomatic complexity 59 (threshold 15). Of this number, 46 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode::cli::provider_init::init_provider_with_model_policy (cyclomatic 56) src/cli/provider_init.rs:1525 — jcode::cli::provider_init::init_provider_with_model_policy has cyclomatic complexity 56 (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: ProviderChoice::as_arg_value (cyclomatic 57) 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.
  • jcode::cli::cloud_move::run_cli (cyclomatic 52) src/cli/cloud_move.rs:2111 — jcode::cli::cloud_move::run_cli has cyclomatic complexity 52 (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.
  • jcode::cli::commands::run_memory_command_for_dir (cyclomatic 48) src/cli/commands.rs:1637 — jcode::cli::commands::run_memory_command_for_dir 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.
  • jcode::cli::proctitle::initial_title (cyclomatic 47) src/cli/proctitle.rs:11 — jcode::cli::proctitle::initial_title has cyclomatic complexity 47 (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.
  • jcode::bin::memory_recall_bench::cmd_gate (cyclomatic 46) src/bin/memory_recall_bench.rs:2189 — jcode::bin::memory_recall_bench::cmd_gate has cyclomatic complexity 46 (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.
  • jcode::bin::tui_bench::main (cyclomatic 45) src/bin/tui_bench.rs:1212 — jcode::bin::tui_bench::main 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.
  • jcode::cli::login::run_login_provider (cyclomatic 38) src/cli/login.rs:268 — jcode::cli::login::run_login_provider 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.
  • jcode::cli::cloud_group_run::run_migrate (cyclomatic 33) src/cli/cloud_group_run.rs:3 — jcode::cli::cloud_group_run::run_migrate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode::cli::cloud_move::run_move (cyclomatic 30) src/cli/cloud_move.rs:442 — jcode::cli::cloud_move::run_move has cyclomatic complexity 30 (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.
  • jcode::cli::dispatch::run_default_command (cyclomatic 27) src/cli/dispatch.rs:796 — jcode::cli::dispatch::run_default_command has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode::cli::commands::todo_followup::prepare_run_todo_follow_up (cyclomatic 26) src/cli/commands/todo_followup.rs:156 — jcode::cli::commands::todo_followup::prepare_run_todo_follow_up 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.
  • jcode::cli::login::login_openai_compatible_flow (cyclomatic 24) src/cli/login.rs:853 — jcode::cli::login::login_openai_compatible_flow 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.
  • jcode::cli::cloud_env::exchange_bounded (cyclomatic 23) src/cli/cloud_env.rs:144 — jcode::cli::cloud_env::exchange_bounded 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.
  • jcode::cli::cloud_group_receive::activate (cyclomatic 23) src/cli/cloud_group_receive.rs:61 — jcode::cli::cloud_group_receive::activate 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.
  • jcode::cli::commands::run_server_stop_command (cyclomatic 23) src/cli/commands.rs:2477 — jcode::cli::commands::run_server_stop_command 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.
  • jcode::cli::commands::run_single_message_command_ndjson (cyclomatic 23) src/cli/commands.rs:3106 — jcode::cli::commands::run_single_message_command_ndjson 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.
  • jcode::cli::tui_launch::run_tui_client (cyclomatic 22) src/cli/tui_launch.rs:137 — jcode::cli::tui_launch::run_tui_client has cyclomatic complexity 22 (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.
  • jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session (cyclomatic 21) src/bin/tui_bench.rs:659 — jcode::bin::tui_bench::reconstruct_side_panel_snapshot_from_session 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.
  • jcode::cli::cloud_move::run_return (cyclomatic 21) src/cli/cloud_move.rs:828 — jcode::cli::cloud_move::run_return has cyclomatic complexity 21 (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.
  • jcode::cli::commands::run_cloud_sessions_sync (cyclomatic 21) src/cli/commands.rs:625 — jcode::cli::commands::run_cloud_sessions_sync 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. This is NOT this file's highest cyclomatic complexity: jcode::cli::commands::emit_ndjson_event (cyclomatic 23) 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.
  • jcode::cli::commands::provider_setup::configure_provider_profile (cyclomatic 21) src/cli/commands/provider_setup.rs:92 — jcode::cli::commands::provider_setup::configure_provider_profile has cyclomatic complexity 21 (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.
  • jcode::cli::ssh_transport::accept_connections (cyclomatic 21) REDACTED:522 — jcode::cli::ssh_transport::accept_connections 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.
  • + 12 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×37
  • Duplicated block (14 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1066 — crates/jcode-app-core/src/server/client_lifecycle.rs:1066-1079 | crates/jcode-app-core/src/server/client_lifecycle.rs:1087-1100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:1066` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/jcode-app-core/src/session_launch.rs:710 — crates/jcode-app-core/src/session_launch.rs:710-723 | crates/jcode-app-core/src/session_launch.rs:837-850 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/session_launch.rs:710` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/jcode-app-core/src/session_launch.rs:725 — crates/jcode-app-core/src/session_launch.rs:725-738 | crates/jcode-app-core/src/session_launch.rs:851-864 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/session_launch.rs:725` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) crates/jcode-app-core/src/usage_display.rs:73 — crates/jcode-app-core/src/usage_display.rs:73-86 | crates/jcode-base/src/usage/display.rs:80-93 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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 (14 lines × 2) crates/jcode-app-core/src/usage_openai.rs:288 — crates/jcode-app-core/src/usage_openai.rs:288-301 | crates/jcode-base/src/usage/openai_helpers.rs:313-326 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (14 lines × 2) crates/jcode-base/src/auth/transfer.rs:370 — crates/jcode-base/src/auth/transfer.rs:370-383 | crates/jcode-base/src/auth/transfer.rs:1190-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 `crates/jcode-base/src/auth/transfer.rs:370` 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) crates/jcode-base/src/client_input.rs:36 — crates/jcode-base/src/client_input.rs:36-49 | crates/jcode-tui/src/tui/app/state_ui.rs:471-484 — 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 `crates/jcode-base/src/client_input.rs:36` 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) crates/jcode-base/src/import.rs:1135 — crates/jcode-base/src/import.rs:1135-1148 | crates/jcode-import-core/src/lib.rs:683-696 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.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 `crates/jcode-base/src/import.rs:1135` 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) crates/jcode-base/src/provider/mod.rs:1712 — crates/jcode-base/src/provider/mod.rs:1712-1725 | crates/jcode-base/src/provider/mod.rs:2259-2272 — both copies are in the same file, so extract the 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) crates/jcode-base/src/provider/models.rs:687 — crates/jcode-base/src/provider/models.rs:687-700 | crates/jcode-base/src/provider/models.rs:723-736 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider/models.rs:687` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/jcode-base/src/provider/openrouter.rs:220 — crates/jcode-base/src/provider/openrouter.rs:220-233 | crates/jcode-provider-openrouter-runtime/src/lib.rs:300-313 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (14 lines × 2) crates/jcode-base/src/provider_activity.rs:136 — crates/jcode-base/src/provider_activity.rs:136-149 | crates/jcode-base/src/provider_activity.rs:213-226 — both copies are in the same file, so extract the 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) crates/jcode-base/src/usage/accessors.rs:458 — crates/jcode-base/src/usage/accessors.rs:458-471 | crates/jcode-base/src/usage/accessors.rs:514-527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/usage/accessors.rs:458` 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) crates/jcode-compaction-core/src/lib.rs:283 — crates/jcode-compaction-core/src/lib.rs:283-296 | crates/jcode-compaction-core/src/lib.rs:306-319 — both copies are in the same file, so extract the 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) crates/jcode-provider-anthropic-runtime/src/lib.rs:1991 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1991-2004 | crates/jcode-provider-anthropic-runtime/src/lib.rs:2023-2036 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-anthropic-runtime/src/lib.rs:1991` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:638 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:638-651 | crates/jcode-provider-cursor-runtime/src/wire.rs:76-89 — before extracting anything, compare `crates/jcode-provider-cursor-runtime/src/agent_transport.rs` and `crates/jcode-provider-cursor-runtime/src/wire.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) crates/jcode-swarm-core/src/lib.rs:282 — crates/jcode-swarm-core/src/lib.rs:282-295 | crates/jcode-swarm-core/src/lib.rs:304-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-swarm-core/src/lib.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-swarm-core/src/lib.rs:303` calls `keys`, `cloned`, `collect` and `crates/jcode-swarm-core/src/lib.rs:281` 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) crates/jcode-tui-account-picker/src/overlay.rs:583 — crates/jcode-tui-account-picker/src/overlay.rs:583-596 | crates/jcode-tui/src/tui/login_picker.rs:476-489 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 204 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 `crates/jcode-tui-account-picker/src/overlay.rs:583` 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) crates/jcode-tui-anim/src/lib.rs:438 — crates/jcode-tui-anim/src/lib.rs:438-451 | crates/jcode-tui-anim/src/lib.rs:460-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-anim/src/lib.rs:438` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/jcode-tui-usage-overlay/src/lib.rs:460 — crates/jcode-tui-usage-overlay/src/lib.rs:460-473 | crates/jcode-tui/src/tui/login_picker.rs:366-379 — before extracting anything, compare `crates/jcode-tui-usage-overlay/src/lib.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 200 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 `crates/jcode-tui-usage-overlay/src/lib.rs:460` 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) crates/jcode-tui/src/tui/app/auth_account_commands.rs:36 — crates/jcode-tui/src/tui/app/auth_account_commands.rs:36-49 | crates/jcode-tui/src/tui/app/auth_account_commands.rs:61-74 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/auth_account_commands.rs:36` 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 (14 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:1849 — crates/jcode-tui/src/tui/app/commands.rs:1849-1862 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1344-1357 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (14 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:1250 — crates/jcode-tui/src/tui/app/inline_interactive.rs:1250-1263 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1352-1365 — both copies are in the same file, so extract the 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) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1775 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1775-1788 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1931-1944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/key_handling.rs:1775` 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) crates/jcode-tui/src/tui/app/turn.rs:888 — crates/jcode-tui/src/tui/app/turn.rs:888-901 | crates/jcode-tui/src/tui/app/turn.rs:1190-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 `crates/jcode-tui/src/tui/app/turn.rs:888` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 12 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×36
  • Duplicated block (15 lines × 2) crates/jcode-app-core/src/agent/turn_execution.rs:1495 — crates/jcode-app-core/src/agent/turn_execution.rs:1495-1509 | src/cli/tui_launch.rs:31-45 — 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 `crates/jcode-app-core/src/agent/turn_execution.rs:1495` 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 (15 lines × 2) crates/jcode-app-core/src/server.rs:989 — crates/jcode-app-core/src/server.rs:989-1003 | crates/jcode-app-core/src/server.rs:1091-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server.rs:989` 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 (15 lines × 2) crates/jcode-app-core/src/server/client_comm_context.rs:100 — crates/jcode-app-core/src/server/client_comm_context.rs:100-114 | crates/jcode-app-core/src/server/client_comm_message.rs:337-351 — 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 (15 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:968 — crates/jcode-app-core/src/server/client_lifecycle.rs:968-982 | crates/jcode-app-core/src/server/client_lifecycle.rs:1226-1240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:968` 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) crates/jcode-app-core/src/server/client_lifecycle.rs:1188 — crates/jcode-app-core/src/server/client_lifecycle.rs:1188-1202 | crates/jcode-app-core/src/server/client_lifecycle.rs:1298-1312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:1188` 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 (15 lines × 2) crates/jcode-app-core/src/server/comm_plan.rs:380 — crates/jcode-app-core/src/server/comm_plan.rs:380-394 | crates/jcode-app-core/src/server/comm_plan.rs:618-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 `crates/jcode-app-core/src/server/comm_plan.rs:380` 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 (15 lines × 2) crates/jcode-app-core/src/usage_display.rs:13 — crates/jcode-app-core/src/usage_display.rs:13-27 | crates/jcode-base/src/usage/display.rs:13-27 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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 (15 lines × 2) REDACTED:341 — REDACTED:341-355 | REDACTED:480-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:341` 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) crates/jcode-base/src/memory.rs:1231 — crates/jcode-base/src/memory.rs:1231-1245 | crates/jcode-base/src/memory.rs:1293-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/memory.rs:1231` 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) crates/jcode-base/src/usage/api_keys.rs:704 — crates/jcode-base/src/usage/api_keys.rs:704-718 | crates/jcode-base/src/usage/api_keys.rs:742-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/usage/api_keys.rs:704` 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) crates/jcode-command-risk/src/lib.rs:261 — crates/jcode-command-risk/src/lib.rs:261-275 | crates/jcode-command-risk/src/lib.rs:339-353 — both copies are in the same file, so extract the 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) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1205 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1205-1219 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1714-1728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1205` 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) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:308 — crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:308-323 | crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:939-953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:308` 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) crates/jcode-render-core/src/math.rs:197 — crates/jcode-render-core/src/math.rs:197-211 | crates/jcode-render-core/src/math.rs:218-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-render-core/src/math.rs:197` 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) crates/jcode-render-core/src/preprocess.rs:90 — crates/jcode-render-core/src/preprocess.rs:90-104 | crates/jcode-render-core/src/preprocess.rs:163-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 `crates/jcode-render-core/src/preprocess.rs:90` 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 (15 lines × 2) crates/jcode-tui-mermaid/src/debug.rs:59 — crates/jcode-tui-mermaid/src/debug.rs:59-73 | crates/jcode-tui-mermaid/src/lib.rs:1581-1595 — 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 (15 lines × 2) crates/jcode-tui-tool-display/src/lib.rs:127 — crates/jcode-tui-tool-display/src/lib.rs:127-141 | crates/jcode-tui/src/tui/ui_tools.rs:232-246 — before extracting anything, compare `crates/jcode-tui-tool-display/src/lib.rs` and `crates/jcode-tui/src/tui/ui_tools.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 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 (15 lines × 2) crates/jcode-tui-tool-display/src/lib.rs:144 — crates/jcode-tui-tool-display/src/lib.rs:144-158 | crates/jcode-tui/src/tui/ui_tools.rs:249-263 — before extracting anything, compare `crates/jcode-tui-tool-display/src/lib.rs` and `crates/jcode-tui/src/tui/ui_tools.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 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 (15 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:1932 — crates/jcode-tui/src/tui/app/commands.rs:1932-1946 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1100-1114 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-tui/src/tui/app/commands.rs:1932` 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) crates/jcode-tui/src/tui/app/commands.rs:1999 — crates/jcode-tui/src/tui/app/commands.rs:1999-2013 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1256-1270 — before extracting anything, compare `crates/jcode-tui/src/tui/app/commands.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-tui/src/tui/app/commands.rs:1999` 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) crates/jcode-tui/src/tui/redraw_schedule.rs:512 — crates/jcode-tui/src/tui/redraw_schedule.rs:512-526 | crates/jcode-tui/src/tui/redraw_schedule.rs:678-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/redraw_schedule.rs:512` 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) crates/jcode-tui/src/tui/ui_inline_interactive.rs:983 — crates/jcode-tui/src/tui/ui_inline_interactive.rs:983-997 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:1092-1106 — both copies are in the same file, so extract the 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, `crates/jcode-tui/src/tui/ui_inline_interactive.rs:1089` calls `push`, `styled` and `crates/jcode-tui/src/tui/ui_inline_interactive.rs:982` 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) crates/jcode-tui/src/tui/ui_overlays.rs:54 — crates/jcode-tui/src/tui/ui_overlays.rs:54-68 | crates/jcode-tui/src/tui/ui_overlays.rs:717-731 — both copies are in the same file, so extract the 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) crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:23 — crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:23-37 | crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:53-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:23` 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) crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:256 — crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:256-275 | crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:340-354 — both copies are in the same file, so extract the 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, `crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:339` calls `Err` and `crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:255` 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.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×35
  • Duplicated block (5 lines × 2) crates/jcode-app-core/src/server/debug_swarm_write.rs:158 — crates/jcode-app-core/src/server/debug_swarm_write.rs:158-162 | crates/jcode-app-core/src/server/debug_swarm_write.rs:216-220 — both copies are in the same file, so extract the 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) crates/jcode-base/src/todo.rs:533 — crates/jcode-base/src/todo.rs:533-537 | crates/jcode-base/src/todo.rs:538-542 — both copies are in the same file, so extract the 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) crates/jcode-embedding/src/lib.rs:192 — crates/jcode-embedding/src/lib.rs:192-197 | crates/jcode-embedding/src/lib.rs:266-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-embedding/src/lib.rs:192` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:1046 — crates/jcode-provider-doctor/src/live_provider_probes.rs:1046-1050 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1823-1827 — both copies are in the same file, so extract the 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) crates/jcode-provider-openai/src/request.rs:441 — crates/jcode-provider-openai/src/request.rs:441-447 | crates/jcode-provider-openrouter/src/request.rs:332-336 — 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 `crates/jcode-provider-openai/src/request.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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 2) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:103 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:103-107 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:130-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:103` 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, `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:102` calls `record_cache_stat_syscall` and `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:129` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) crates/jcode-tui-render/src/swarm_gallery.rs:450 — crates/jcode-tui-render/src/swarm_gallery.rs:450-458 | crates/jcode-tui-render/src/swarm_gallery.rs:1081-1085 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-render/src/swarm_gallery.rs:450` 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) crates/jcode-tui/src/tui/app/commands_improve.rs:641 — crates/jcode-tui/src/tui/app/commands_improve.rs:641-645 | crates/jcode-tui/src/tui/app/commands_improve.rs:738-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.
  • Duplicated block (5 lines × 2) crates/jcode-tui/src/tui/app/turn.rs:1626 — crates/jcode-tui/src/tui/app/turn.rs:1626-1630 | crates/jcode-tui/src/tui/app/turn.rs:1638-1642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/turn.rs:1626` 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/cli/cloud_managed.rs:476 — src/cli/cloud_managed.rs:476-480 | src/cli/cloud_managed.rs:490-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/cloud_managed.rs:476` 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) crates/jcode-app-core/src/telemetry_state.rs:328 — crates/jcode-app-core/src/telemetry_state.rs:328-332 | crates/jcode-telemetry-core/src/state_support.rs:395-399 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (5 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:334 — crates/jcode-app-core/src/telemetry_state.rs:334-338 | crates/jcode-telemetry-core/src/state_support.rs:401-405 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (5 lines × 2) crates/jcode-app-core/src/usage_openai.rs:236 — crates/jcode-app-core/src/usage_openai.rs:236-240 | crates/jcode-base/src/usage/openai_helpers.rs:261-265 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (5 lines × 2) crates/jcode-base/src/auth/mod.rs:185 — crates/jcode-base/src/auth/mod.rs:185-189 | crates/jcode-base/src/provider/models.rs:833-837 — 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) crates/jcode-tui/src/tui/session_picker/session_view.rs:315 — crates/jcode-tui/src/tui/session_picker/session_view.rs:315-319 | crates/jcode-tui/src/tui/ui_tests/mod.rs:453-457 — 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) crates/jcode-app-core/src/session_active_pids.rs:14 — crates/jcode-app-core/src/session_active_pids.rs:14-18 | crates/jcode-storage/src/active_pids.rs:133-137 — before extracting anything, compare `crates/jcode-app-core/src/session_active_pids.rs` and `crates/jcode-storage/src/active_pids.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 (5 lines × 2) crates/jcode-tui/src/tui/app/todos_view.rs:745 — crates/jcode-tui/src/tui/app/todos_view.rs:745-752 | crates/jcode-tui/src/tui/app/turn_notify.rs:267-271 — 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) crates/jcode-tui/src/tui/ui_overlays.rs:525 — crates/jcode-tui/src/tui/ui_overlays.rs:525-529 | crates/jcode-tui/src/tui/ui_overlays.rs:537-542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_overlays.rs:525` 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) crates/jcode-tui-account-picker/src/overlay.rs:719 — crates/jcode-tui-account-picker/src/overlay.rs:719-724 | crates/jcode-tui-account-picker/src/overlay.rs:733-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-account-picker/src/overlay.rs:719` 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 (5 lines × 2) crates/jcode-base/src/import.rs:1074 — crates/jcode-base/src/import.rs:1074-1078 | crates/jcode-base/src/import.rs:1197-1201 — both copies are in the same file, so extract the 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) crates/jcode-import-core/src/lib.rs:485 — crates/jcode-import-core/src/lib.rs:485-489 | crates/jcode-import-core/src/lib.rs:1138-1142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-import-core/src/lib.rs:485` 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) crates/jcode-app-core/src/catchup.rs:72 — crates/jcode-app-core/src/catchup.rs:72-76 | crates/jcode-app-core/src/catchup.rs:77-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/jcode-app-core/src/restart_snapshot.rs:119 — crates/jcode-app-core/src/restart_snapshot.rs:119-123 | crates/jcode-app-core/src/restart_snapshot.rs:170-174 — both copies are in the same file, so extract the 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) crates/jcode-productivity-core/src/scan.rs:262 — crates/jcode-productivity-core/src/scan.rs:262-266 | crates/jcode-productivity-core/src/scan.rs:321-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 `crates/jcode-productivity-core/src/scan.rs:262` 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) crates/jcode-tui/src/tui/app/commands.rs:475 — crates/jcode-tui/src/tui/app/commands.rs:475-479 | crates/jcode-tui/src/tui/app/remote/server_events.rs:3451-3455 — 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 `crates/jcode-tui/src/tui/app/commands.rs:475` 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.
  • + 10 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×31
  • Repeated repair: crates/jcode-provider-openrouter-runtime/src/lib.rs crates/jcode-provider-openrouter-runtime/src/lib.rs:867 — crates/jcode-provider-openrouter-runtime/src/lib.rs changed 36 times in last 90 days and 19 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 OpenRouterProvider::apply_resolved_reasoning_effort at line 867), 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: serialize explicit none for opted-in compatible profiles (fixes #2020)”; “fix(grok): discover subscription models from the live CLI catalog”; “fix(providers): close non-Grok live catalog discovery gaps”; “fix(ci): restore green master for v0.99.1”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-provider-openrouter-runtime/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-tui-mermaid/src/lib.rs crates/jcode-tui-mermaid/src/lib.rs:1533 — crates/jcode-tui-mermaid/src/lib.rs changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is jcode_tui_mermaid::evict_old_cache at line 1533), 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): rasterize SVG graphs in markdown side panels”; “Fix Kitty images in Zellij with classic placements”; “fix: persist prepared sessions and repair test/clippy drift”; “fix(tui): skip duplicate inline image sizes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui-mermaid/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-message-types/src/lib.rs crates/jcode-message-types/src/lib.rs:484 — crates/jcode-message-types/src/lib.rs changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is jcode_message_types::ends_with_fresh_user_turn at line 484), 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: “Anchor dynamic context at stable turn boundaries (fixes #1989)”; “fix: apply speed tier changes promptly with truthful provider feedback”; “fix(openai): render native web citations from URL annotations”; “fix(agent): keep non-object streamed tool arguments so malformed calls get corrected”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-message-types/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-tui-mermaid/src/mermaid_runtime.rs crates/jcode-tui-mermaid/src/mermaid_runtime.rs:248 — crates/jcode-tui-mermaid/src/mermaid_runtime.rs changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is jcode_tui_mermaid::mermaid_runtime::infer_protocol_from_env at line 248), 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: restore production safety ratchets without raising budgets”; “fix(tui): rasterize SVG graphs in markdown side panels”; “fix: probe Orca image capabilities automatically (fixes #1985)”; “Fix Kitty images in Zellij with classic placements”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui-mermaid/src/mermaid_runtime.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: crates/jcode-setup-hints/src/lib.rs crates/jcode-setup-hints/src/lib.rs:2000 — crates/jcode-setup-hints/src/lib.rs changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is jcode_setup_hints::install_xfce_launch_hotkeys at line 2000), 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(ci): clear clippy 1.99 and macOS warning-budget failures”; “fix(macos): gate test-only and unused setup-hints imports”; “fix: persist prepared sessions and repair test/clippy drift”; “macos: hide notification helper, drop CLI Spotlight launcher; rustfmt fixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-setup-hints/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-tui/src/tui/mermaid.rs crates/jcode-tui/src/tui/mermaid.rs:44 — crates/jcode-tui/src/tui/mermaid.rs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is jcode_tui::tui::mermaid::install_jcode_mermaid_hooks at line 44), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(tui): rasterize SVG graphs in markdown side panels”; “Fix Kitty images in Zellij with classic placements”; “fix(tui): skip duplicate inline image sizes”; “fix(tui): invalidate mermaid message cache on resize”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/mermaid.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/cli/commands/menubar.rs src/cli/commands/menubar.rs:545 — src/cli/commands/menubar.rs changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is jcode::cli::commands::menubar::macos::run_status_item_app at line 545), 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(menubar): stable macOS signing identity and a [menubar] enabled opt-out (#1793)”; “fix(menubar): draw the streaming icon green instead of tinting the template (#1785)”; “fix(menubar): gate passwd home helpers to macOS and unix tests”; “fix(ci): clear clippy 1.99 and macOS warning-budget failures”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- src/cli/commands/menubar.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: crates/jcode-tui/src/tui/info_widget_model.rs crates/jcode-tui/src/tui/info_widget_model.rs:106 — crates/jcode-tui/src/tui/info_widget_model.rs changed 9 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 jcode_tui::tui::info_widget_model::runtime_rows at line 106), 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): preserve reported tier without inferring processing speed”; “fix(tui): shorten speed tier mismatch and pending labels”; “fix(tui): show reported speed tier first in compact status”; “fix(tui): stabilize startup layout and hydrate daemon quota hints”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui/src/tui/info_widget_model.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: crates/jcode-base/src/usage/disk_cache.rs crates/jcode-base/src/usage/disk_cache.rs:437 — crates/jcode-base/src/usage/disk_cache.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is jcode_base::usage::disk_cache::import_last_good at line 437), 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(ci): handle terminal cache failures and limit usage test helper”; “fix(usage): recover Claude quota telemetry and stop rejected-token polling”; “fix(usage): retain adaptive polling and mark last-known quotas stale”; “fix(usage): coalesce Anthropic probes across processes and preserve backoff”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/usage/disk_cache.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: crates/jcode-base/src/sidecar.rs crates/jcode-base/src/sidecar.rs:999 — crates/jcode-base/src/sidecar.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 10 (its worst body is jcode_base::sidecar::collect_openai_sse_text at line 999), 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(providers): stop impersonating Claude Code and Codex CLI on OAuth”; “fix(provider): retain observed usage on simple completion failures”; “fix(usage): retain sparse cache reports and served sidecar models”; “fix: update Claude OAuth client version (#1135)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/sidecar.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: crates/jcode-base/src/usage/account_fetch.rs crates/jcode-base/src/usage/account_fetch.rs:48 — crates/jcode-base/src/usage/account_fetch.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is jcode_base::usage::account_fetch::fetch_oauth_account_usage at line 48), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(usage): recover Claude quota telemetry and stop rejected-token polling”; “fix(usage): coalesce Anthropic probes across processes and preserve backoff”; “fix(router): start fresh sessions on first ready pool account”; “fix(usage): fetch account router quotas on daemon in background”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/usage/account_fetch.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: crates/jcode-base/src/auth/antigravity.rs crates/jcode-base/src/auth/antigravity.rs:229 — crates/jcode-base/src/auth/antigravity.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is jcode_base::auth::antigravity::login at line 229), 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(antigravity): don't abort project lookup on a non-JSON loadCodeAssist response”; “fix(antigravity): address greptile review — override-aware project lookup, endpoint validation, catalog invalidation”; “fix(antigravity): use daily-cloudcode-pa endpoint to fix consumer-account 429s”; “fix(auth): automatically show login QR when browser is suppressed”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/auth/antigravity.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: crates/jcode-base/src/provider/pricing.rs crates/jcode-base/src/provider/pricing.rs:304 — crates/jcode-base/src/provider/pricing.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is jcode_base::provider::pricing::cheapness_for_route at line 304), 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(pricing): keep local profiles out of the cross-provider fallback (follow-up to #1658)”; “fix: make env files the source of truth for API keys”; “fix(session): persist sessions created with a title before the first visible message (fixes #1144)”; “fix(openrouter): price @endpoint-pinned models from the pinned endpoint (fixes #1095)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/provider/pricing.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-tui-mermaid/src/mermaid_content.rs crates/jcode-tui-mermaid/src/mermaid_content.rs:409 — crates/jcode-tui-mermaid/src/mermaid_content.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 7 (its worst body is jcode_tui_mermaid::mermaid_content::write_video_export_marker at line 409), 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: persist prepared sessions and repair test/clippy drift”; “fix(tui): skip duplicate inline image sizes”; “fix(tui): apply resize clicks to mermaid placeholders”; “fix(tui): resize and copy clicked mermaid diagrams”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-tui-mermaid/src/mermaid_content.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: crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.rs crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.rs:274 — crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.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 8 (its worst body is jcode_provider_openai_runtime::openai_websocket_prewarm::warm_socket at line 274), 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(openai): avoid replaying response output in websocket deltas”; “fix(openai): send route-specific speed tier headers and rebind sockets”; “fix(openai): preserve session cache affinity across transports”; “fix(openai): replay changed persistent input prefixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-provider-openai-runtime/src/openai_websocket_prewarm.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: telemetry-worker/scripts/sync-model-prices.mjs telemetry-worker/scripts/sync-model-prices.mjs:83 — telemetry-worker/scripts/sync-model-prices.mjs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is sync-model-prices.main at line 83), 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(telemetry): discover canonical usage prices and document replay limits”; “fix(telemetry): estimate prices for new model releases before models.dev lists them”; “fix(telemetry): price new models nightly so spend stops reading $0 for Opus 5.5”; “fix(telemetry): report unmatched model pricing coverage across providers”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- telemetry-worker/scripts/sync-model-prices.mjs`: 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: crates/jcode-base/src/subscription_catalog.rs crates/jcode-base/src/subscription_catalog.rs:110 — crates/jcode-base/src/subscription_catalog.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 6 (its worst body is JcodeTier::parse at line 110), 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(subscription): accept deployed Sonnet 4.6 model ID”; “fix(subscription): restrict catalog to Claude 5.5 and GPT 6.1”; “fix: make env files the source of truth for API keys”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/subscription_catalog.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-app-core/src/server/util.rs crates/jcode-app-core/src/server/util.rs:441 — crates/jcode-app-core/src/server/util.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 jcode_app_core::server::util::git_common_dir_for at line 441), 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(app-core): handle safety failures and production lint blockers”; “fix(swarm): correct member attribution, debug default session, and restart notices”; “fix(server): reload when an install repoints the link the server started from”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-app-core/src/server/util.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: crates/jcode-build-meta/src/lib.rs crates/jcode-build-meta/src/lib.rs:117 — crates/jcode-build-meta/src/lib.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 2 (its worst body is jcode_build_meta::is_release_build at line 117), 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: preserve dev version offset in hosted builds”; “fix: tolerate prerelease build identities (fixes #2042)”; “fix(build): invalidate CLI metadata when hosted snapshots change”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-build-meta/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-base/src/skill.rs crates/jcode-base/src/skill.rs:113 — crates/jcode-base/src/skill.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 10 (its worst body is SkillRegistry::import_from_external at line 113), 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: prefer jcode skills over compatibility sources (fixes #2030)”; “fix: skip skills already imported by an earlier source on first run (fixes #1404) (#1416)”; “fix: accept list-style skill allowed-tools (fixes #1041)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/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.
  • Repeated repair: crates/jcode-provider-gemini/src/lib.rs crates/jcode-provider-gemini/src/lib.rs:287 — crates/jcode-provider-gemini/src/lib.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 14 (its worst body is jcode_provider_gemini::build_contents_with_signature_policy at line 287), 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(gemini): account for explicit tool-use prompt tokens”; “fix(gemini): include thinking tokens in output usage”; “fix(gemini): default to non-dated gemini-pro-latest alias”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-provider-gemini/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-provider-core/src/fallback_pick.rs crates/jcode-provider-core/src/fallback_pick.rs:447 — crates/jcode-provider-core/src/fallback_pick.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 12 (its worst body is jcode_provider_core::fallback_pick::rank_fallback_routes at line 447), 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(failover): prefer latest-generation model and auto-switch from unlabeled OAuth”; “fix(tui): stop retrying permanently rejected OAuth sessions”; “fix(provider): serialize Grok Build SetRoute switches”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-provider-core/src/fallback_pick.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: crates/jcode-base/src/auth/cursor.rs crates/jcode-base/src/auth/cursor.rs:424 — crates/jcode-base/src/auth/cursor.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 10 (its worst body is jcode_base::auth::cursor::resolve_direct_tokens at line 424), 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(auth): keep every saved API key out of the process env (fixes #1386)”; “fix(ci): clear clippy 1.99 and macOS warning-budget failures”; “fix: persist prepared sessions and repair test/clippy drift”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/auth/cursor.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: crates/jcode-base/src/model_pricing.rs crates/jcode-base/src/model_pricing.rs:175 — crates/jcode-base/src/model_pricing.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 jcode_base::model_pricing::lookup_with_provenance at line 175), 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(pricing): keep local profiles out of the cross-provider fallback (follow-up to #1658)”; “fix(session): persist sessions created with a title before the first visible message (fixes #1144)”; “fix(openrouter): price @endpoint-pinned models from the pinned endpoint (fixes #1095)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-base/src/model_pricing.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/jcode-core/src/stdin_detect.rs crates/jcode-core/src/stdin_detect.rs:30 — crates/jcode-core/src/stdin_detect.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 11 (its worst body is jcode_core::stdin_detect::linux::check_inner at line 30), 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: handle base and provider safety fallbacks explicitly”; “stdin_detect: only trust wchan fallback when fd 0 is the sole readable pipe/socket/tty (fixes false needs_input pushes)”; “fix(ci): clear clippy 1.99 and macOS warning-budget failures”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:57:39 -08:00' --until='2026-11-13 19:57:39 -08:00' --full-history --no-merges -- crates/jcode-core/src/stdin_detect.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.
  • + 6 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×31
  • ClassTooLong: BridgeState crates/jcode-harness-api-server/src/translate.rs:125 — ClassTooLong — 2273 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 60 methods, 3 blocks, lines 125-3520. The bar is 400 significant lines; this is 1873 over it, 5.68× 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: MultiProvider crates/jcode-base/src/provider/mod.rs:387 — ClassTooLong — 1854 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 99 methods, 4 blocks, lines 387-3076. The bar is 400 significant lines; this is 1454 over it, 4.64× 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: SessionPicker crates/jcode-tui/src/tui/session_picker.rs:272 — ClassTooLong — 1484 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 140 methods, 2 blocks, lines 272-2525. The bar is 400 significant lines; this is 1084 over it, 3.71× 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: Server crates/jcode-app-core/src/server.rs:553 — ClassTooLong — 1365 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 2 blocks, lines 553-2564. The bar is 400 significant lines; this is 965 over it, 3.41× 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: OpenRouterProvider crates/jcode-provider-openrouter-runtime/src/lib.rs:820 — ClassTooLong — 1305 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 78 methods, 2 blocks, lines 820-2846. The bar is 400 significant lines; this is 905 over it, 3.26× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: App crates/jcode-tui/src/tui/app.rs:935 — ClassTooLong — 1147 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1017 methods, 2 blocks, lines 935-2917. The bar is 400 significant lines; this is 747 over it, 2.87× 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: BackgroundTaskManager crates/jcode-base/src/background.rs:36 — ClassTooLong — 1135 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 3 blocks, lines 36-1706. The bar is 400 significant lines; this is 735 over it, 2.84× 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: Registry crates/jcode-app-core/src/tool/mod.rs:364 — ClassTooLong — 1065 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 50 methods, 3 blocks, lines 364-1993. The bar is 400 significant lines; this is 665 over it, 2.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: BedrockProvider crates/jcode-provider-bedrock/src/lib.rs:98 — ClassTooLong — 1055 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 4 blocks, lines 98-1547. The bar is 400 significant lines; this is 655 over it, 2.64× 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: Session crates/jcode-base/src/session.rs:103 — ClassTooLong — 1048 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 96 methods, 2 blocks, lines 103-1731. The bar is 400 significant lines; this is 648 over it, 2.62× 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: CompactionManager crates/jcode-base/src/compaction.rs:135 — ClassTooLong — 908 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 63 methods, 3 blocks, lines 135-1722. The bar is 400 significant lines; this is 508 over it, 2.27× 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: JcodeClient crates/jcode-sdk/src/client.rs:354 — ClassTooLong — 862 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 78 methods, 4 blocks, lines 354-1672. The bar is 400 significant lines; this is 462 over it, 2.16× 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: MemoryManager crates/jcode-base/src/memory.rs:184 — ClassTooLong — 862 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 61 methods, 3 blocks, lines 184-1568. The bar is 400 significant lines; this is 462 over it, 2.16× 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: CommunicateTool crates/jcode-app-core/src/tool/communicate.rs:470 — ClassTooLong — 839 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 3 blocks, lines 470-1851. The bar is 400 significant lines; this is 439 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AcpRuntime src/cli/acp.rs:383 — ClassTooLong — 833 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 26 methods, 2 blocks, lines 383-1497. The bar is 400 significant lines; this is 433 over it, 2.08× 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: Agent crates/jcode-app-core/src/agent.rs:266 — ClassTooLong — 831 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 275 methods, 3 blocks, lines 86-1371. The bar is 400 significant lines; this is 431 over it, 2.08× 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: CopilotApiProvider crates/jcode-provider-copilot-runtime/src/lib.rs:46 — ClassTooLong — 772 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 3 blocks, lines 46-1165. The bar is 400 significant lines; this is 372 over it, 1.93× 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: JcodeClient sdk/typescript/src/client.ts:223 — ClassTooLong — 766 significant lines (blank, comment-only and punctuation-only lines excluded), 75 methods. The bar is 400 significant lines; this is 366 over it, 1.92× 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: AmbientRunnerHandle crates/jcode-app-core/src/ambient/runner.rs:39 — ClassTooLong — 699 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 39-1099. The bar is 400 significant lines; this is 299 over it, 1.75× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GeminiProvider crates/jcode-provider-gemini-runtime/src/lib.rs:44 — ClassTooLong — 683 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 5 blocks, lines 44-1052. The bar is 400 significant lines; this is 283 over it, 1.71× 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: AntigravityProvider crates/jcode-provider-antigravity-runtime/src/lib.rs:35 — ClassTooLong — 589 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 5 blocks, lines 35-946. The bar is 400 significant lines; this is 189 over it, 1.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: AccountPicker crates/jcode-tui-account-picker/src/overlay.rs:30 — ClassTooLong — 576 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 21 methods, 2 blocks, lines 30-831. The bar is 400 significant lines; this is 176 over it, 1.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ServerEvent crates/jcode-protocol/src/wire/events.rs:108 — ClassTooLong — 576 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods. The bar is 400 significant lines; this is 176 over it, 1.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: OpenAIProvider crates/jcode-provider-openai-runtime/src/lib.rs:688 — ClassTooLong — 575 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 48 methods, 2 blocks, lines 688-1553. The bar is 400 significant lines; this is 175 over it, 1.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Request crates/jcode-protocol/src/wire.rs:36 — ClassTooLong — 528 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 2 blocks, lines 36-945. The bar is 400 significant lines; this is 128 over it, 1.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.
  • + 6 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×31
  • Edited copy of a member (12 corresponding lines) crates/jcode-harness-api-server/src/lib.rs:301 — crates/jcode-harness-api-server/src/lib.rs:301-312 | REDACTED:610-625 — 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) crates/jcode-tui/src/tui/ui_diagram_pane.rs:99 — crates/jcode-tui/src/tui/ui_diagram_pane.rs:99-120 | crates/jcode-tui/src/tui/ui_pinned_layout.rs:229-240 — 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) crates/jcode-app-core/src/server/group_transfer.rs:604 — crates/jcode-app-core/src/server/group_transfer.rs:604-623 | src/cli/cloud_group.rs:252-263 — 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) crates/jcode-base/src/session/maintenance.rs:56 — crates/jcode-base/src/session/maintenance.rs:56-67 | src/cli/hot_exec.rs:246-261 — 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) crates/jcode-base/src/provider_activity_oauth.rs:245 — crates/jcode-base/src/provider_activity_oauth.rs:245-256 | crates/jcode-base/src/provider_activity_oauth.rs:368-379 — 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) crates/jcode-base/src/subscription_catalog.rs:395 — crates/jcode-base/src/subscription_catalog.rs:395-409 | crates/jcode-base/src/subscription_catalog.rs:411-422 — 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) crates/jcode-base/src/memory_rerank.rs:109 — crates/jcode-base/src/memory_rerank.rs:109-121 | src/bin/memory_recall_bench.rs:691-702 — 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) crates/jcode-app-core/src/overnight.rs:705 — crates/jcode-app-core/src/overnight.rs:705-716 | src/cli/hot_exec.rs:295-311 — 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) crates/jcode-app-core/src/tool/discover_secrets.rs:107 — crates/jcode-app-core/src/tool/discover_secrets.rs:107-118 | crates/jcode-tui/src/tui/ui_messages.rs:3027-3038 — 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) crates/jcode-tui/src/tui/app/auth.rs:948 — crates/jcode-tui/src/tui/app/auth.rs:948-959 | crates/jcode-tui/src/tui/app/auth.rs:1203-1215 — 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) crates/jcode-base/src/embedding_stub.rs:210 — crates/jcode-base/src/embedding_stub.rs:210-224 | crates/jcode-embedding/src/lib.rs:408-419 — 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) crates/jcode-app-core/src/channel.rs:629 — crates/jcode-app-core/src/channel.rs:629-640 | crates/jcode-app-core/src/server/jade_relay.rs:1323-1334 — 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) crates/jcode-base/src/auth/claude.rs:343 — crates/jcode-base/src/auth/claude.rs:343-356 | crates/jcode-base/src/auth/codex.rs:184-195 — 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) crates/jcode-tui/src/tui/ui_frame_metrics.rs:1241 — crates/jcode-tui/src/tui/ui_frame_metrics.rs:1241-1253 | crates/jcode-tui/src/tui/ui_header.rs:597-608 — 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) crates/jcode-app-core/src/server/provider_control.rs:867 — crates/jcode-app-core/src/server/provider_control.rs:867-878 | crates/jcode-app-core/src/server/provider_control/deferred_operations.rs:71-82 — 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) crates/jcode-app-core/src/tool/webfetch.rs:275 — crates/jcode-app-core/src/tool/webfetch.rs:275-286 | crates/jcode-app-core/src/tool/webfetch.rs:288-299 — 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) crates/jcode-setup-hints/src/keymap/external.rs:230 — crates/jcode-setup-hints/src/keymap/external.rs:230-241 | crates/jcode-setup-hints/src/keymap/external.rs:301-312 — 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) crates/jcode-app-core/src/tool/session_http.rs:147 — crates/jcode-app-core/src/tool/session_http.rs:147-158 | crates/jcode-tui/src/tui/app/cloud_environment.rs:80-91 — 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) crates/jcode-codemode/src/engine.rs:407 — crates/jcode-codemode/src/engine.rs:407-419 | crates/jcode-sdk/src/turn_retry.rs:555-566 — 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) crates/jcode-telemetry-core/src/lib.rs:2244 — crates/jcode-telemetry-core/src/lib.rs:2244-2255 | crates/jcode-telemetry-core/src/lib.rs:2277-2288 — 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) crates/jcode-core/src/fs.rs:11 — crates/jcode-core/src/fs.rs:11-22 | crates/jcode-core/src/fs.rs:28-40 — 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) crates/jcode-base/src/compaction.rs:1419 — crates/jcode-base/src/compaction.rs:1419-1430 | crates/jcode-base/src/compaction.rs:1433-1445 — 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) crates/jcode-base/src/provider/openrouter.rs:199 — crates/jcode-base/src/provider/openrouter.rs:199-210 | crates/jcode-provider-openrouter-runtime/src/lib.rs:223-234 — 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) crates/jcode-sdk/src/client.rs:1173 — crates/jcode-sdk/src/client.rs:1173-1184 | crates/jcode-sdk/src/client.rs:1370-1383 — 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) crates/jcode-tui/src/tui/ui_diagram_pane.rs:81 — crates/jcode-tui/src/tui/ui_diagram_pane.rs:81-92 | crates/jcode-tui/src/tui/ui_pinned_layout.rs:119-130 — 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.
  • + 6 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×31
  • Edited copy of a member (13 corresponding lines) crates/jcode-tui-markdown/src/markdown_mermaid_fallback.rs:105 — crates/jcode-tui-markdown/src/markdown_mermaid_fallback.rs:105-118 | crates/jcode-tui-mermaid/src/mermaid_content.rs:393-405 — 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) crates/jcode-base/src/provider/mod.rs:1836 — crates/jcode-base/src/provider/mod.rs:1836-1853 | crates/jcode-base/src/provider/mod.rs:2056-2068 — 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) crates/jcode-harness-api-server/src/translate.rs:2978 — crates/jcode-harness-api-server/src/translate.rs:2978-2992 | crates/jcode-harness-api-server/src/translate.rs:2994-3006 — 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/cli/cloud_runtime.rs:140 — src/cli/cloud_runtime.rs:140-152 | src/cli/cloud_runtime.rs:264-281 — 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) crates/jcode-app-core/src/server/swarm.rs:191 — crates/jcode-app-core/src/server/swarm.rs:191-203 | crates/jcode-app-core/src/server/swarm.rs:205-217 — 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) crates/jcode-harness-api/src/sockets.rs:16 — crates/jcode-harness-api/src/sockets.rs:16-28 | crates/jcode-storage/src/lib.rs:110-127 — 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) crates/jcode-app-core/src/agent.rs:1261 — crates/jcode-app-core/src/agent.rs:1261-1273 | crates/jcode-app-core/src/agent/turn_execution.rs:365-377 — 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) crates/jcode-app-core/src/server/state.rs:462 — crates/jcode-app-core/src/server/state.rs:462-474 | crates/jcode-app-core/src/server/state.rs:483-498 — 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) crates/jcode-base/src/memory/pending.rs:128 — crates/jcode-base/src/memory/pending.rs:128-142 | crates/jcode-sdk/src/collections.rs:252-264 — 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) crates/jcode-tui/src/tui/ui_messages.rs:3083 — crates/jcode-tui/src/tui/ui_messages.rs:3083-3095 | crates/jcode-tui/src/tui/ui_messages.rs:3537-3552 — 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) crates/jcode-base/src/browser.rs:1086 — crates/jcode-base/src/browser.rs:1086-1098 | crates/jcode-base/src/browser.rs:1100-1115 — 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) crates/jcode-provider-core/src/selection.rs:68 — crates/jcode-provider-core/src/selection.rs:68-80 | crates/jcode-provider-core/src/selection.rs:108-120 — 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) crates/jcode-base/src/subscription_api.rs:666 — crates/jcode-base/src/subscription_api.rs:666-678 | crates/jcode-base/src/subscription_api.rs:686-699 — 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) crates/jcode-harness-api/src/requests.rs:366 — crates/jcode-harness-api/src/requests.rs:366-378 | crates/jcode-protocol/src/wire.rs:932-944 — 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) crates/jcode-voice/src/dictation.rs:475 — crates/jcode-voice/src/dictation.rs:475-487 | crates/jcode-voice/src/dictation.rs:588-604 — 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) crates/jcode-base/src/auth/copilot.rs:511 — crates/jcode-base/src/auth/copilot.rs:511-523 | crates/jcode-base/src/github.rs:36-50 — 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) crates/jcode-tui/src/tui/app/local.rs:193 — crates/jcode-tui/src/tui/app/local.rs:193-205 | crates/jcode-tui/src/tui/app/remote.rs:564-580 — 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) crates/jcode-tui-mermaid/src/mermaid_inline.rs:58 — crates/jcode-tui-mermaid/src/mermaid_inline.rs:58-70 | crates/jcode-tui-mermaid/src/mermaid_runtime.rs:725-738 — 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) crates/jcode-provider-anthropic-runtime/src/error_classification.rs:40 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:40-55 | crates/jcode-provider-copilot-runtime/src/routing.rs:36-48 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/jcode-tui-markdown/src/markdown_types.rs:36 — crates/jcode-tui-markdown/src/markdown_types.rs:36-48 | crates/jcode-tui-markdown/src/markdown_types.rs:50-64 — 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) crates/jcode-provider-openai-runtime/src/lib.rs:421 — crates/jcode-provider-openai-runtime/src/lib.rs:421-434 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:437-449 — 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) crates/jcode-tui/src/tui/app/input.rs:3764 — crates/jcode-tui/src/tui/app/input.rs:3764-3776 | crates/jcode-tui/src/tui/app/input.rs:3830-3842 — 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) crates/jcode-base/src/copilot_usage.rs:20 — crates/jcode-base/src/copilot_usage.rs:20-37 | crates/jcode-base/src/provider_activity.rs:102-114 — 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/cli/provider_init.rs:759 — src/cli/provider_init.rs:759-771 | src/cli/provider_init.rs:773-786 — 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) crates/jcode-notify-email/src/lib.rs:419 — crates/jcode-notify-email/src/lib.rs:419-431 | crates/jcode-tui/src/tui/app/commands_cloud.rs:862-879 — 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.
  • + 6 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×30
  • Edited copy of a member (7 corresponding lines) crates/jcode-setup-hints/src/windows_setup.rs:159 — crates/jcode-setup-hints/src/windows_setup.rs:159-165 | src/cli/login/scriptable.rs:881-888 — 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) crates/jcode-app-core/src/server/swarm.rs:342 — crates/jcode-app-core/src/server/swarm.rs:342-348 | crates/jcode-base/src/scratch_maintenance.rs:35-41 — 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) crates/jcode-provider-core/src/openai_schema.rs:177 — crates/jcode-provider-core/src/openai_schema.rs:177-183 | crates/jcode-schema-dialect/src/dialect.rs:302-308 — 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) crates/jcode-companion/src/server.rs:207 — crates/jcode-companion/src/server.rs:207-213 | crates/jcode-companion/src/server.rs:216-225 — 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) crates/jcode-provider-antigravity/src/lib.rs:49 — crates/jcode-provider-antigravity/src/lib.rs:49-56 | crates/jcode-base/src/auth/grok_build.rs:69-75 — 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) crates/jcode-provider-gemini/src/lib.rs:582 — crates/jcode-provider-gemini/src/lib.rs:582-588 | crates/jcode-tui/src/tui/app/tui_state.rs:141-150 — 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) crates/jcode-tui/src/tui/ui_tests/palette_topology.rs:133 — crates/jcode-tui/src/tui/ui_tests/palette_topology.rs:133-143 | crates/jcode-base/src/process_title.rs:27-33 — 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) crates/jcode-app-core/src/server/lifecycle.rs:245 — crates/jcode-app-core/src/server/lifecycle.rs:245-259 | crates/jcode-storage/src/active_pids.rs:219-225 — 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/cli/login/google.rs:149 — src/cli/login/google.rs:149-155 | src/cli/login/presenter.rs:28-35 — 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) crates/jcode-tui-markdown/src/markdown_math_copy.rs:56 — crates/jcode-tui-markdown/src/markdown_math_copy.rs:56-64 | crates/jcode-base/src/mobile_sync.rs:528-534 — 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) crates/jcode-tui/src/tui/session_picker/loading.rs:647 — crates/jcode-tui/src/tui/session_picker/loading.rs:647-654 | crates/jcode-productivity-core/src/scan.rs:167-173 — 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) crates/jcode-app-core/src/server/runtime_commands.rs:26 — crates/jcode-app-core/src/server/runtime_commands.rs:26-32 | crates/jcode-app-core/src/server/runtime_special_commands.rs:8-14 — 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) crates/jcode-compaction-core/src/lib.rs:908 — crates/jcode-compaction-core/src/lib.rs:908-917 | crates/jcode-tui/src/tui/session_picker/loading_search_text.rs:21-27 — 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) crates/jcode-app-core/src/catchup.rs:266 — crates/jcode-app-core/src/catchup.rs:266-273 | crates/jcode-app-core/src/overnight.rs:1040-1046 — 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) crates/jcode-logging/src/lib.rs:316 — crates/jcode-logging/src/lib.rs:316-322 | crates/jcode-app-core/src/tool/codemode.rs:125-131 — 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) crates/jcode-base/src/memory_rerank.rs:92 — crates/jcode-base/src/memory_rerank.rs:92-98 | crates/jcode-sdk/src/structured.rs:512-519 — 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/cli/hot_exec.rs:8 — src/cli/hot_exec.rs:8-14 | src/cli/terminal.rs:517-524 — 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) crates/jcode-session-types/src/lib.rs:975 — crates/jcode-session-types/src/lib.rs:975-984 | crates/jcode-tui/src/tui/core.rs:23-29 — 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) crates/jcode-base/src/auth/google.rs:414 — crates/jcode-base/src/auth/google.rs:414-420 | crates/jcode-base/src/auth/oauth.rs:547-553 — 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) crates/jcode-tui/src/tui/ui_diagram_pane.rs:480 — crates/jcode-tui/src/tui/ui_diagram_pane.rs:480-486 | crates/jcode-tui/src/tui/ui_pinned.rs:504-512 — 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) crates/jcode-base/src/applets.rs:25 — crates/jcode-base/src/applets.rs:25-31 | crates/jcode-base/src/side_panel.rs:373-379 — 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) crates/jcode-core/src/id.rs:201 — crates/jcode-core/src/id.rs:201-207 | crates/jcode-provider-doctor/src/provider_e2e.rs:280-286 — 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) crates/jcode-tui-markdown/src/lib.rs:502 — crates/jcode-tui-markdown/src/lib.rs:502-508 | crates/jcode-tui-mermaid/src/lib.rs:1497-1503 — 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) crates/jcode-tui/src/tui/app/commands.rs:1413 — crates/jcode-tui/src/tui/app/commands.rs:1413-1420 | crates/jcode-tui/src/tui/app/inline_interactive/helpers.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) crates/jcode-app-core/src/mission.rs:58 — crates/jcode-app-core/src/mission.rs:58-64 | crates/jcode-app-core/src/server/reload_recovery.rs:215-221 — 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.
  • + 5 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×29
  • Change coupling: comm_session.rs ↔ debug_session_admin.rs crates/jcode-app-core/src/server/comm_session.rs:1 — `crates/jcode-app-core/src/server/comm_session.rs` and `crates/jcode-app-core/src/server/debug_session_admin.rs` change together 100% of the time (13 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 13 shared commits counted here, the most recent 3 are `d3303bad` refactor(swarm): make the headless memory scope a named choice (refs …; `3f384a6e` refactor(swarm): make the headless memory scope a named choice (refs …; `3e855091` fix(swarm): spawned workers keep real memory instead of test storage … — run `git show` on any of them.
  • Change coupling: markdown_render_full.rs ↔ markdown_render_lazy.rs crates/jcode-tui-markdown/src/markdown_render_full.rs:1 — `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` change together 95% of the time (19 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 19 shared commits counted here, the most recent 3 are `58c6662d` Make Markdown link URL suffixes opt-in via display config; `a6eab991` fix(tui): keep blockquote gutters continuous across paragraph breaks; `6e0234af` fix(tui): keep blockquote gutters continuous across paragraph breaks — run `git show` on any of them.
  • Change coupling: client_api.rs ↔ backend.rs crates/jcode-app-core/src/server/client_api.rs:1 — `crates/jcode-app-core/src/server/client_api.rs` and `crates/jcode-tui/src/tui/backend.rs` change together 76% of the time (19 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 19 shared commits counted here, the most recent 3 are `765f9e4c` Forward API Hello client name so jcode-ios sessions get every-turn push; `753f0d10` feat(router): server-side account failover for Desktop/SDK clients; `cfbf3d9e` fix(protocol): wire disconnect crash flag — run `git show` on any of them.
  • Change coupling: tests.rs ↔ dispatch.rs src/cli/args/tests.rs:1 — `src/cli/args/tests.rs` and `src/cli/dispatch.rs` change together 75% of the time (33 of the 44 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 33 shared commits counted here, the most recent 3 are `61d871c1` Add opt-in v1 preview update channel; `7f52d118` google: guided OAuth app setup like gog, plus auto-import and publish…; `a8869dc0` google: selectable services in Google login and a built-in calendar tool — run `git show` on any of them.
  • Change coupling: accessors.rs ↔ external.rs crates/jcode-base/src/provider/accessors.rs:1 — `crates/jcode-base/src/provider/accessors.rs` and `crates/jcode-base/src/provider/external.rs` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 8 shared commits counted here, the most recent 3 are `3e4f0933` refactor(providers): remove the Claude Code CLI subprocess transport; `3d187f4a` refactor(provider): move OpenRouter runtime out of jcode-base into do…; `a8faf98f` refactor(provider): move Anthropic runtime out of jcode-base (base wi… — run `git show` on any of them.
  • Change coupling: lib.rs ↔ lib.rs crates/jcode-harness-api/src/lib.rs:1 — `crates/jcode-harness-api/src/lib.rs` and `crates/jcode-sdk/src/lib.rs` change together 68% of the time (15 of the 22 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 15 shared commits counted here, the most recent 3 are `2f703919` Expose native runtime commands through harness and SDK; `adbf48bd` feat(sdk): expose structured abnormal turn stop reasons; `9a7be7be` fix(protocol): frame assistant text messages and preserve retry corre… — run `git show` on any of them.
  • Change coupling: core_events.rs ↔ server_events.rs crates/jcode-app-core/src/protocol_tests/core_events.rs:1 — `crates/jcode-app-core/src/protocol_tests/core_events.rs` and `crates/jcode-tui/src/tui/app/remote/server_events.rs` change together 64% of the time (9 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `5d20e9cc` fix(usage): report authoritative OAuth account to remote clients; `8ef93821` Track per-request cache prompt totals across providers and history; `827eee1c` feat(sdk): expose durable per-turn history response stats — run `git show` on any of them.
  • Change coupling: client_comm_context.rs ↔ input_format.rs crates/jcode-app-core/src/server/client_comm_context.rs:1 — `crates/jcode-app-core/src/server/client_comm_context.rs` and `crates/jcode-app-core/src/tool/communicate_tests/input_format.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 7 shared commits counted here, the most recent 3 are `e2ad1db3` swarm: add stalled-worker watchdog (#1703); `b9cb0aaf` feat(swarm): add agents.swarm_effort pin and show worker effort in sw…; `d7d5d8ad` feat(swarm): add agents.swarm_effort pin and show worker effort in sw… — run `git show` on any of them.
  • Change coupling: keybindings.rs ↔ input.rs crates/jcode-config-types/src/keybindings.rs:1 — `crates/jcode-config-types/src/keybindings.rs` and `crates/jcode-tui/src/tui/app/input.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 7 shared commits counted here, the most recent 3 are `fc34ea46` tui: Alt+Up/Down cycle speed tier (Standard, Fast, Ultrafast); `3309ad37` fix: configure auto-poke toggle key (fixes #945); `a5064b85` fix: configure auto-poke toggle key (fixes #945) — run `git show` on any of them.
  • Change coupling: env_overrides.rs ↔ hooks.rs crates/jcode-base/src/config/env_overrides.rs:1 — `crates/jcode-base/src/config/env_overrides.rs` and `crates/jcode-base/src/hooks.rs` change together 59% of the time (10 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 10 shared commits counted here, the most recent 3 are `dd86f266` hooks: expose tool input, call id, touched paths to post_tool; add po…; `75dd137b` feat: add pre-tool input transformers (#1279); `774c2254` Revert "Merge PR #758" — run `git show` on any of them.
  • Change coupling: onboarding_flow.rs ↔ ui_onboarding.rs crates/jcode-tui/src/tui/app/onboarding_flow.rs:1 — `crates/jcode-tui/src/tui/app/onboarding_flow.rs` and `crates/jcode-tui/src/tui/ui_onboarding.rs` change together 58% of the time (21 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 21 shared commits counted here, the most recent 3 are `92f2f034` Telemetry settings: per-category checkboxes with Continue on top; `17e5598b` onboarding: fix Import less committing on Enter, cleaner first page, …; `25ed7fe7` tui: remove Jcode subscription option from onboarding import summary — run `git show` on any of them.
  • Change coupling: requests.rs ↔ parity.rs crates/jcode-harness-api/src/requests.rs:1 — `crates/jcode-harness-api/src/requests.rs` and `crates/jcode-sdk/src/sdk_tests/parity.rs` change together 58% of the time (14 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 14 shared commits counted here, the most recent 3 are `2f703919` Expose native runtime commands through harness and SDK; `19110e6d` Move auto-poke and todo quality gates into a shared SDK policy; `14df6c06` harness api: expose background_tool (move running tool to background) — run `git show` on any of them.
  • Change coupling: todo.rs ↔ lifecycle.rs crates/jcode-app-core/src/tool/todo.rs:1 — `crates/jcode-app-core/src/tool/todo.rs` and `crates/jcode-telemetry-core/src/lifecycle.rs` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `4973f3e1` feat(todo): gate feedback loop relevance and coverage; `abb0baab` feat(todo): gate feedback loop relevance and coverage; `0d48b768` telemetry: count todo progress without quoting any of it — run `git show` on any of them.
  • Change coupling: core_events.rs ↔ server_events.rs crates/jcode-protocol/src/protocol_tests/core_events.rs:1 — `crates/jcode-protocol/src/protocol_tests/core_events.rs` and `crates/jcode-tui/src/tui/app/remote/server_events.rs` change together 58% of the time (15 of the 26 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 15 shared commits counted here, the most recent 3 are `4be17b27` Delta History: also skip rendered images the client already holds; `5d20e9cc` fix(usage): report authoritative OAuth account to remote clients; `8ef93821` Track per-request cache prompt totals across providers and history — run `git show` on any of them.
  • Change coupling: REDACTED ↔ bg.rs REDACTED:1 — `REDACTED` and `crates/jcode-app-core/src/tool/bg.rs` change together 55% of the time (11 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `bc0e25de` feat(bg): stall watchdog wakes the agent when a background task goes …; `b861f370` feat(bg): stall watchdog wakes the agent when a background task goes …; `039dc86a` Cap tool parameter descriptions at ~25 tokens — run `git show` on any of them.
  • Change coupling: events.rs ↔ tui_lifecycle.rs crates/jcode-protocol/src/wire/events.rs:1 — `crates/jcode-protocol/src/wire/events.rs` and `crates/jcode-tui/src/tui/app/tui_lifecycle.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `a36f6f19` server: push todo changes to attached clients, clients stop polling f…; `6c47789c` companion: [companion] config toggles, autostart from the TUI, live w…; `17a12d1a` Fence resumed observer events by runtime generation and turn identity — run `git show` on any of them.
  • Change coupling: external.rs ↔ catalog.rs crates/jcode-base/src/auth/external.rs:1 — `crates/jcode-base/src/auth/external.rs` and `crates/jcode-provider-metadata/src/catalog.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `1f9a56a4` feat(auth): add built-in Novita API-key login; `2ff0b799` feat(auth): add built-in Novita API-key login; `45c5469f` feat: add Conifer provider integration (fixes #1089) — run `git show` on any of them.
  • Change coupling: tests.rs ↔ proctitle.rs src/cli/args/tests.rs:1 — `src/cli/args/tests.rs` and `src/cli/proctitle.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `61d871c1` Add opt-in v1 preview update channel; `6fa94a88` fix: honor telemetry opt-out before install event (fixes #893); `0f675d89` fix: honor telemetry opt-out before install event (fixes #893) — run `git show` on any of them.
  • Change coupling: client_comm_context.rs ↔ comm_format.rs crates/jcode-app-core/src/server/client_comm_context.rs:1 — `crates/jcode-app-core/src/server/client_comm_context.rs` and `crates/jcode-protocol/src/comm_format.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `e2ad1db3` swarm: add stalled-worker watchdog (#1703); `b9cb0aaf` feat(swarm): add agents.swarm_effort pin and show worker effort in sw…; `d7d5d8ad` feat(swarm): add agents.swarm_effort pin and show worker effort in sw… — run `git show` on any of them.
  • Change coupling: keybindings.rs ↔ key_handling.rs crates/jcode-config-types/src/keybindings.rs:1 — `crates/jcode-config-types/src/keybindings.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `fc34ea46` tui: Alt+Up/Down cycle speed tier (Standard, Fast, Ultrafast); `3309ad37` fix: configure auto-poke toggle key (fixes #945); `a5064b85` fix: configure auto-poke toggle key (fixes #945) — run `git show` on any of them.
  • Change coupling: onboarding_flow.rs ↔ mod.rs crates/jcode-tui/src/tui/app/onboarding_flow.rs:1 — `crates/jcode-tui/src/tui/app/onboarding_flow.rs` and `crates/jcode-tui/src/tui/mod.rs` change together 53% of the time (19 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 19 shared commits counted here, the most recent 3 are `92f2f034` Telemetry settings: per-category checkboxes with Continue on top; `25ed7fe7` tui: remove Jcode subscription option from onboarding import summary; `145b8ba9` Offer Jcode subscription during onboarding — run `git show` on any of them.
  • Change coupling: client_api.rs ↔ misc_events.rs crates/jcode-app-core/src/server/client_api.rs:1 — `crates/jcode-app-core/src/server/client_api.rs` and `crates/jcode-protocol/src/protocol_tests/misc_events.rs` change together 52% of the time (13 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 13 shared commits counted here, the most recent 3 are `765f9e4c` Forward API Hello client name so jcode-ios sessions get every-turn push; `753f0d10` feat(router): server-side account failover for Desktop/SDK clients; `1e2c6de9` feat(server): opt in to disconnected remote turn continuation — run `git show` on any of them.
  • Change coupling: translate.rs ↔ parity.rs crates/jcode-harness-api-server/src/translate.rs:1 — `crates/jcode-harness-api-server/src/translate.rs` and `crates/jcode-sdk/src/sdk_tests/parity.rs` change together 52% of the time (14 of the 27 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 14 shared commits counted here, the most recent 3 are `2f703919` Expose native runtime commands through harness and SDK; `19110e6d` Move auto-poke and todo quality gates into a shared SDK policy; `14df6c06` harness api: expose background_tool (move running tool to background) — run `git show` on any of them.
  • Change coupling: translate.rs ↔ lib.rs crates/jcode-harness-api-server/src/translate.rs:1 — `crates/jcode-harness-api-server/src/translate.rs` and `crates/jcode-sdk/src/lib.rs` change together 51% of the time (21 of the 41 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 21 shared commits counted here, the most recent 3 are `0871234b` harness-api: carry tool call identity on history tool rows; `2f703919` Expose native runtime commands through harness and SDK; `19110e6d` Move auto-poke and todo quality gates into a shared SDK policy — run `git show` on any of them.
  • Change coupling: activation.rs ↔ selection.rs crates/jcode-base/src/provider/activation.rs:1 — `crates/jcode-base/src/provider/activation.rs` and `crates/jcode-base/src/provider/selection.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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 `659b8cc1` feat: add Grok Build ACP provider; `55ed0d77` feat: add Grok Build ACP provider; `d85dd178` fix: allow interactive cross-provider model switching (fixes #549) (#… — run `git show` on any of them.
  • + 4 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×28
  • TodoComment crates/jcode-tui-render/src/swarm_gallery.rs:1724 — // ---- Todo card ---- — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui-render/src/swarm_gallery_dock_tests.rs:27 — // Todo counter on the row. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui-render/src/swarm_gallery_tests.rs:723 — // Todo names replace the less actionable transcript tail when present. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/app.rs:1069 — /// todo list at all) must leave auto-poke armed for the next batch of work; — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/app.rs:1091 — /// Todo state at the final-response handoff. Unchanged finished work must — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/ui_messages.rs:782 — // Todo cards sit directly on the terminal background, so the global — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/ui_messages.rs:1107 — /// Todo card for the pinned band at the top of the viewport. The band owns — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/ui_messages.rs:3976 — // todo result while losing its paired ToolCall metadata. Recognize the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/ui_prepare.rs:1439 — // todo tool messages in display_messages for history/session fidelity, but — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/app/replay_export.rs:197 — /// Todo tools historically returned a JSON array followed by labeled JSON — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/app/subscribe_nudge.rs:211 — /// (todo tool completed locally or remotely). Arms a timer when incomplete — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/app/tests/remote_events_reload_05.rs:1040 — // todo list at all, and again whenever a cycle completed. In practice that — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-tui/src/tui/app/tests/state_model_poke_03.rs:2763 — // todo tool, the next completion check requests one clean final answer. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-todo-policy/src/lib.rs:337 — /// Todo group for goal-scoped observations; `None` for plan-level ones. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-todo-policy/src/lib.rs:887 — /// Todo groups are intended to name coherent goals, so the group containing the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-telemetry-core/src/lib.rs:97 — /// todo, goal, plan, or feedback-loop text those scores describe. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-task-types/src/lib.rs:516 — /// todo list's agent. Absence means ownership is unknown, not local. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-task-types/src/lib.rs:554 — /// todo write, so a sloppy stage can never cost the model its plan. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-protocol/src/wire/events.rs:132 — /// todo state changes, so the client need not poll. Absent on older — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-core/src/stdin_detect.rs:414 — // TODO: implement with windows-sys crate — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-base/src/todo.rs:1 — //! Todo persistence plus a re-export of the shared pure policy in — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-base/src/todo.rs:113 — /// todo list format (a bare `Vec<TodoItem>` array) stays readable by every — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-app-core/src/tool/communicate.rs:498 — /// todo lanes, which the server dispatches itself, and lane-owning `spawn`. Unlisted actions still — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-app-core/src/tool/tests.rs:715 — // todo carries a deliberate "use it very often" directive requested by the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/jcode-app-core/src/tool/tests.rs:1902 — // todo's update items are open on purpose: repeating every item field a — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×27
  • Edited copy of a member (9 corresponding lines) crates/jcode-base/src/auth/copilot.rs:468 — crates/jcode-base/src/auth/copilot.rs:468-476 | crates/jcode-base/src/auth/copilot.rs:527-540 — 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) crates/jcode-compaction-core/src/lib.rs:737 — crates/jcode-compaction-core/src/lib.rs:737-745 | crates/jcode-provider-core/src/failover.rs:60-70 — 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) crates/jcode-app-core/src/agents_status.rs:82 — crates/jcode-app-core/src/agents_status.rs:82-90 | crates/jcode-base/src/prompt.rs:182-194 — 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) crates/jcode-tui-markdown/src/markdown_latex_image.rs:419 — crates/jcode-tui-markdown/src/markdown_latex_image.rs:419-430 | crates/jcode-voice/src/command_capture.rs:172-180 — 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) crates/jcode-provider-openai/src/stream.rs:22 — crates/jcode-provider-openai/src/stream.rs:22-30 | crates/jcode-provider-openai/src/websocket_health.rs:63-71 — 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) crates/jcode-tui/src/tui/info_widget_memory_render.rs:69 — crates/jcode-tui/src/tui/info_widget_memory_render.rs:69-78 | crates/jcode-tui/src/tui/info_widget_swarm_background.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) crates/jcode-provider-cursor-runtime/src/wire.rs:1059 — crates/jcode-provider-cursor-runtime/src/wire.rs:1059-1072 | crates/jcode-provider-cursor-runtime/src/wire.rs:1159-1167 — 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) crates/jcode-base/src/goal.rs:607 — crates/jcode-base/src/goal.rs:607-618 | crates/jcode-tui/src/tui/app/voice_input.rs:502-510 — 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) crates/jcode-base/src/session.rs:588 — crates/jcode-base/src/session.rs:588-596 | crates/jcode-base/src/session.rs:605-613 — 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) crates/jcode-app-core/src/server/durable_state.rs:27 — crates/jcode-app-core/src/server/durable_state.rs:27-39 | crates/jcode-tui-markdown/src/markdown_latex_image.rs:845-853 — 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) crates/jcode-app-core/src/tool/session_search.rs:1776 — crates/jcode-app-core/src/tool/session_search.rs:1776-1786 | crates/jcode-message-types/src/lib.rs:322-330 — 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) crates/jcode-app-core/src/message_notifications.rs:85 — crates/jcode-app-core/src/message_notifications.rs:85-93 | crates/jcode-base/src/message/notifications.rs:147-157 — 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) crates/jcode-base/src/process_title.rs:35 — crates/jcode-base/src/process_title.rs:35-43 | crates/jcode-protocol/src/comm_format.rs:522-530 — 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) crates/jcode-terminal-image/src/metadata.rs:1 — crates/jcode-terminal-image/src/metadata.rs:1-9 | crates/jcode-productivity-core/src/scan.rs:361-369 — 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) crates/jcode-base/src/gmail.rs:583 — crates/jcode-base/src/gmail.rs:583-591 | crates/jcode-base/src/gmail.rs:706-715 — 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) crates/jcode-app-core/src/agent.rs:429 — crates/jcode-app-core/src/agent.rs:429-437 | crates/jcode-app-core/src/agent/utils.rs:5-13 — 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) crates/jcode-base/src/mcp/tool.rs:130 — crates/jcode-base/src/mcp/tool.rs:130-139 | crates/jcode-app-core/src/tool/mod.rs:275-283 — 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) crates/jcode-tui/src/tui/app/helpers.rs:401 — crates/jcode-tui/src/tui/app/helpers.rs:401-409 | crates/jcode-tui/src/tui/info_widget_usage.rs:724-732 — 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) crates/jcode-base/src/auth/muse.rs:974 — crates/jcode-base/src/auth/muse.rs:974-982 | crates/jcode-usage-types/src/lib.rs:263-272 — 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) crates/jcode-app-core/src/tool/bg.rs:106 — crates/jcode-app-core/src/tool/bg.rs:106-114 | crates/jcode-task-types/src/lib.rs:444-452 — 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) crates/jcode-tui/src/tui/ui_tests/mod.rs:196 — crates/jcode-tui/src/tui/ui_tests/mod.rs:196-204 | src/bin/tui_bench.rs:826-834 — 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) crates/jcode-base/src/auth/account_store.rs:229 — crates/jcode-base/src/auth/account_store.rs:229-239 | crates/jcode-tui-messages/src/message.rs:599-607 — 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) crates/jcode-app-core/src/agents_status.rs:337 — crates/jcode-app-core/src/agents_status.rs:337-347 | crates/jcode-tui/src/tui/session_picker/preview_io.rs:6-14 — 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) crates/jcode-tui/src/tui/app.rs:2842 — crates/jcode-tui/src/tui/app.rs:2842-2850 | crates/jcode-tui/src/tui/app/model_context.rs:640-648 — 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) crates/jcode-tui-account-picker/src/lib.rs:61 — crates/jcode-tui-account-picker/src/lib.rs:61-70 | crates/jcode-tui-usage-overlay/src/lib.rs:75-83 — 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.
  • + 2 more in this group — see findings.md.
D3 · God Classes · TooManyFields · ×24
  • TooManyFields: App crates/jcode-tui/src/tui/app.rs:935 — TooManyFields — 424 stored fields beside 1017 methods. The bar is 30 stored fields; this is 394 over it, 14.13× 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: SessionLifecycleEvent crates/jcode-usage-types/src/lib.rs:545 — TooManyFields — 142 stored fields. The bar is 30 stored fields; this is 112 over it, 4.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SessionTelemetry crates/jcode-telemetry-core/src/lib.rs:258 — TooManyFields — 110 stored fields. The bar is 30 stored fields; this is 80 over it, 3.67× 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: TurnEndEvent crates/jcode-usage-types/src/lib.rs:744 — TooManyFields — 79 stored fields. The bar is 30 stored fields; this is 49 over it, 2.63× 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: TurnTelemetry crates/jcode-telemetry-core/src/lib.rs:197 — TooManyFields — 57 stored fields beside 1 method. The bar is 30 stored fields; this is 27 over it, 1.90× 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: SessionPicker crates/jcode-tui/src/tui/session_picker.rs:272 — TooManyFields — 55 stored fields beside 140 methods. The bar is 30 stored fields; this is 25 over it, 1.83× 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: FramePerfStats crates/jcode-tui/src/tui/ui_frame_metrics.rs:11 — TooManyFields — 55 stored fields. The bar is 30 stored fields; this is 25 over it, 1.83× 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: MermaidDebugStats crates/jcode-tui-mermaid/src/lib.rs:1247 — TooManyFields — 49 stored fields. The bar is 30 stored fields; this is 19 over it, 1.63× 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: ProductivityReport crates/jcode-productivity-core/src/model.rs:72 — TooManyFields — 44 stored fields. The bar is 30 stored fields; this is 14 over it, 1.47× 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: Agent crates/jcode-app-core/src/agent.rs:266 — TooManyFields — 43 stored fields beside 275 methods. The bar is 30 stored fields; this is 13 over it, 1.43× 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: Session crates/jcode-base/src/session.rs:103 — TooManyFields — 43 stored fields beside 96 methods. The bar is 30 stored fields; this is 13 over it, 1.43× 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: InfoWidgetData crates/jcode-tui/src/tui/info_widget.rs:679 — TooManyFields — 41 stored fields beside 5 methods. The bar is 30 stored fields; this is 11 over it, 1.37× 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: TodoSessionEvent crates/jcode-usage-types/src/lib.rs:500 — TooManyFields — 41 stored fields. The bar is 30 stored fields; this is 11 over it, 1.37× 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: DisplayConfig crates/jcode-config-types/src/display.rs:12 — 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: BridgeState crates/jcode-harness-api-server/src/translate.rs:125 — TooManyFields — 39 stored fields beside 60 methods. The bar is 30 stored fields; this is 9 over it, 1.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: CommunicateInput crates/jcode-app-core/src/tool/communicate.rs:516 — TooManyFields — 36 stored fields beside 2 methods. The bar is 30 stored fields; this is 6 over it, 1.20× 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: BrowserInput crates/jcode-app-core/src/tool/browser.rs:39 — TooManyFields — 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× 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: KeybindingsConfig crates/jcode-config-types/src/lib.rs:1007 — TooManyFields — 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× 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: ClientRuntimeMemoryTotals crates/jcode-base/src/runtime_memory_log.rs:99 — TooManyFields — 35 stored fields. The bar is 30 stored fields; this is 5 over it, 1.17× 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: ScrollTestState crates/jcode-tui/src/tui/app/debug.rs:459 — TooManyFields — 33 stored fields beside 2 methods. The bar is 30 stored fields; this is 3 over it, 1.10× 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: MermaidMemoryProfile crates/jcode-tui-mermaid/src/lib.rs:1349 — TooManyFields — 32 stored fields. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SessionStartupStub crates/jcode-base/src/session.rs:221 — 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.
  • TooManyFields: RemoteStartupSessionSnapshot crates/jcode-base/src/session.rs:1738 — 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.
  • TooManyFields: SessionJournalMeta crates/jcode-base/src/session/journal.rs:10 — 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.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×23
  • Duplicated block (17 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:2498 — crates/jcode-app-core/src/server/client_lifecycle.rs:2498-2514 | crates/jcode-app-core/src/server/client_lifecycle.rs:2528-2544 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:2498` 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, `crates/jcode-app-core/src/server/client_lifecycle.rs:2497` calls `handle_notify_session` and `crates/jcode-app-core/src/server/client_lifecycle.rs:2527` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) crates/jcode-app-core/src/server/client_lifecycle_logging.rs:15 — crates/jcode-app-core/src/server/client_lifecycle_logging.rs:15-31 | crates/jcode-tui/src/tui/backend.rs:597-613 — 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 `crates/jcode-app-core/src/server/client_lifecycle_logging.rs:15` 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) crates/jcode-app-core/src/server/debug_swarm_read.rs:418 — crates/jcode-app-core/src/server/debug_swarm_read.rs:418-434 | crates/jcode-app-core/src/server/debug_swarm_read.rs:458-474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_swarm_read.rs:418` 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, `crates/jcode-app-core/src/server/debug_swarm_read.rs:455` calls `contains` and `crates/jcode-app-core/src/server/debug_swarm_read.rs:415` 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 (17 lines × 2) crates/jcode-app-core/src/usage_openai.rs:175 — crates/jcode-app-core/src/usage_openai.rs:175-191 | crates/jcode-base/src/usage/openai_helpers.rs:200-216 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (17 lines × 2) crates/jcode-base/src/auth/antigravity.rs:239 — crates/jcode-base/src/auth/antigravity.rs:239-255 | crates/jcode-base/REDACTED:365-381 — before extracting anything, compare `crates/jcode-base/src/auth/antigravity.rs` and `crates/jcode-base/REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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 `crates/jcode-base/src/auth/antigravity.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.
  • Duplicated block (17 lines × 2) crates/jcode-base/src/import.rs:1041 — crates/jcode-base/src/import.rs:1041-1057 | crates/jcode-tui/src/tui/session_picker/loading.rs:2373-2389 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-base/src/import.rs:1041` 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) crates/jcode-base/src/usage/api_keys.rs:155 — crates/jcode-base/src/usage/api_keys.rs:155-171 | crates/jcode-base/src/usage/api_keys.rs:195-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/usage/api_keys.rs:155` 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 (17 lines × 2) crates/jcode-tui-account-picker/src/overlay.rs:376 — crates/jcode-tui-account-picker/src/overlay.rs:376-392 | crates/jcode-tui/src/tui/login_picker.rs:265-281 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui/src/tui/login_picker.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 204 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 `crates/jcode-tui-account-picker/src/overlay.rs:376` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:369 — crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:369-385 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:432-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:369` 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 (17 lines × 2) crates/jcode-tui/src/tui/app/commands_improve.rs:306 — crates/jcode-tui/src/tui/app/commands_improve.rs:306-322 | crates/jcode-tui/src/tui/app/commands_improve.rs:353-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/commands_improve.rs:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:3581 — crates/jcode-tui/src/tui/app/inline_interactive.rs:3581-3597 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3606-3622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/inline_interactive.rs:3581` 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) crates/jcode-tui/src/tui/app/local.rs:308 — crates/jcode-tui/src/tui/app/local.rs:308-324 | crates/jcode-tui/src/tui/app/remote.rs:831-847 — before extracting anything, compare `crates/jcode-tui/src/tui/app/local.rs` and `crates/jcode-tui/src/tui/app/remote.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. 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 `crates/jcode-tui/src/tui/app/local.rs:308` 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) crates/jcode-tui/src/tui/app/local.rs:532 — crates/jcode-tui/src/tui/app/local.rs:532-548 | crates/jcode-tui/src/tui/app/local.rs:593-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/local.rs:532` 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 `task` to `BackgroundTaskCompleted` in one and `crate::bus::BackgroundTaskStalled` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (17 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1642 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1642-1658 | crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:823-839 — 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 `crates/jcode-tui/src/tui/app/remote/key_handling.rs:1642` 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, `crates/jcode-tui/src/tui/app/remote/key_handling.rs:1641` calls `set_premium_mode` and `crates/jcode-tui/src/tui/app/tui_lifecycle_runtime.rs:822` 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 (17 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1739 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1739-1755 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1895-1911 — both copies are in the same file, so extract the 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 (17 lines × 2) crates/jcode-tui/src/tui/app/state_ui_storage.rs:278 — crates/jcode-tui/src/tui/app/state_ui_storage.rs:278-294 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:384-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 `crates/jcode-tui/src/tui/app/state_ui_storage.rs:278` 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) crates/jcode-tui/src/tui/cloud_git.rs:224 — crates/jcode-tui/src/tui/cloud_git.rs:224-240 | REDACTED:368-384 — 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) crates/jcode-tui/src/tui/ui_file_diff.rs:10 — crates/jcode-tui/src/tui/ui_file_diff.rs:10-26 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:10-26 — before extracting anything, compare `crates/jcode-tui/src/tui/ui_file_diff.rs` and `crates/jcode-tui/src/tui/ui_pinned_selection.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. 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 `crates/jcode-tui/src/tui/ui_file_diff.rs:10` 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) crates/jcode-tui/src/tui/ui_inline_image.rs:1113 — crates/jcode-tui/src/tui/ui_inline_image.rs:1113-1129 | crates/jcode-tui/src/tui/ui_prepare.rs:233-249 — 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 `crates/jcode-tui/src/tui/ui_inline_image.rs:1113` 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 (17 lines × 2) crates/jcode-tui/src/tui/ui_messages.rs:1729 — crates/jcode-tui/src/tui/ui_messages.rs:1729-1745 | crates/jcode-tui/src/tui/ui_messages.rs:2109-2125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_messages.rs:1729` 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 (17 lines × 2) src/bin/memory_recall_bench.rs:496 — src/bin/memory_recall_bench.rs:496-512 | src/bin/memory_recall_bench.rs:2279-2295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/bin/memory_recall_bench.rs:496` 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) crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs:160 — crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs:160-176 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_terminal.rs:242-258 — before extracting anything, compare `crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs` and `crates/jcode-provider-openai-runtime/src/openai_tests/persistent_terminal.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 (17 lines × 2) scripts/benchmark_discovery.py:488 — scripts/benchmark_discovery.py:488-504 | scripts/benchmark_discovery_rate.py:448-464 — 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. 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.
D3 · God Classes · TooManyMethods · ×22
  • TooManyMethods: App crates/jcode-tui/src/tui/app.rs:935 — TooManyMethods — 1017 methods, declared across 84 files: app/navigation.rs (61), app/onboarding_flow_control.rs (59), app/inline_interactive.rs (56), app/input.rs (56), +80 more file(s). The bar is 30 methods; this is 987 over it, 33.90× 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: Agent crates/jcode-app-core/src/agent.rs:266 — TooManyMethods — 275 methods, declared across 16 files: agent/turn_execution.rs (65), src/agent.rs (52), agent/provider.rs (50), agent/interrupts.rs (23), +12 more file(s). The bar is 30 methods; this is 245 over it, 9.17× 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: SessionPicker crates/jcode-tui/src/tui/session_picker.rs:272 — TooManyMethods — 140 methods, declared across 11 files: tui/session_picker.rs (64), session_picker/filter.rs (23), session_picker/navigation.rs (19), session_picker/render.rs (12), +7 more file(s). The bar is 30 methods; this is 110 over it, 4.67× 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: MultiProvider crates/jcode-base/src/provider/mod.rs:387 — TooManyMethods — 99 methods, declared across 12 files: provider/mod.rs (21), provider/selection.rs (18), provider/startup.rs (18), provider/accessors.rs (13), +8 more file(s). The bar is 30 methods; this is 69 over it, 3.30× 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: Session crates/jcode-base/src/session.rs:103 — TooManyMethods — 96 methods, declared across 3 files: src/session.rs (78), session/persistence.rs (14), session/agent_models.rs (4). The bar is 30 methods; this is 66 over it, 3.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: RemoteConnection crates/jcode-tui/src/tui/backend.rs:245 — TooManyMethods — 95 methods, declared across 4 files: tui/backend.rs (80), tui/backend_auth.rs (7), tui/backend_cloud.rs (6), backend/ssh_sessions.rs (2). The bar is 30 methods; this is 65 over it, 3.17× 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: OpenRouterProvider crates/jcode-provider-openrouter-runtime/src/lib.rs:820 — TooManyMethods — 78 methods, declared across 3 files: src/lib.rs (70), src/openrouter_provider_impl.rs (7), src/openai_compatible_runtime.rs (1). The bar is 30 methods; this is 48 over it, 2.60× 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: JcodeClient crates/jcode-sdk/src/client.rs:354 — TooManyMethods — 78 methods, declared across 3 files: src/client.rs (76), src/native_ssh.rs (1), src/structured.rs (1). The bar is 30 methods; this is 48 over it, 2.60× 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: JcodeClient sdk/typescript/src/client.ts:223 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 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.
  • TooManyMethods: CompactionManager crates/jcode-base/src/compaction.rs:135 — TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MemoryManager crates/jcode-base/src/memory.rs:184 — TooManyMethods — 61 methods. The bar is 30 methods; this is 31 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BridgeState crates/jcode-harness-api-server/src/translate.rs:125 — TooManyMethods — 60 methods, declared across 4 files: src/translate.rs (45), translate/session_files.rs (8), translate/credentials.rs (6), translate/control_replies.rs (1). The bar is 30 methods; this is 30 over it, 2.00× 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: Registry crates/jcode-app-core/src/tool/mod.rs:364 — TooManyMethods — 50 methods, declared across 3 files: tool/mod.rs (48), tool/name_suggestions.rs (1), tool/remote_exec.rs (1). The bar is 30 methods; this is 20 over it, 1.67× 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: OpenAIProvider crates/jcode-provider-openai-runtime/src/lib.rs:688 — TooManyMethods — 48 methods, declared across 4 files: src/lib.rs (45), src/model_selection.rs (1), src/native_compaction.rs (1), src/openai_prewarm_request.rs (1). The bar is 30 methods; this is 18 over it, 1.60× 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: Config crates/jcode-base/src/config.rs:652 — TooManyMethods — 45 methods, declared across 4 files: config/config_file.rs (40), config/default_file.rs (2), config/display_summary.rs (2), config/env_overrides.rs (1). The bar is 30 methods; this is 15 over it, 1.50× 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: AnthropicProvider crates/jcode-provider-anthropic-runtime/src/lib.rs:482 — TooManyMethods — 45 methods, declared across 2 files: src/lib.rs (42), src/catalog.rs (3). The bar is 30 methods; this is 15 over it, 1.50× 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: BedrockProvider crates/jcode-provider-bedrock/src/lib.rs:98 — TooManyMethods — 44 methods, declared across 2 files: src/lib.rs (40), src/catalog.rs (4). The bar is 30 methods; this is 14 over it, 1.47× 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: SelfDevTool crates/jcode-app-core/src/tool/selfdev/mod.rs:478 — TooManyMethods — 43 methods, declared across 6 files: selfdev/mod.rs (19), selfdev/build_queue.rs (12), selfdev/setup.rs (5), selfdev/launch.rs (3), +2 more file(s). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BackgroundTaskManager crates/jcode-base/src/background.rs:36 — TooManyMethods — 39 methods, declared across 2 files: src/background.rs (37), background/cleanup.rs (2). The bar is 30 methods; this is 9 over it, 1.30× 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: SkillRegistry crates/jcode-base/src/skill.rs:45 — TooManyMethods — 34 methods, declared across 2 files: src/skill.rs (33), skill/invocation.rs (1). The bar is 30 methods; this is 4 over it, 1.13× 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: CopilotApiProvider crates/jcode-provider-copilot-runtime/src/lib.rs:46 — TooManyMethods — 32 methods, declared across 2 files: src/lib.rs (27), src/catalog.rs (5). The bar is 30 methods; this is 2 over it, 1.07× 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: GmailClient crates/jcode-base/src/gmail.rs:144 — 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 (14 corresponding lines) · ×20
  • Edited copy of a member (14 corresponding lines) crates/jcode-base/src/jev.rs:593 — crates/jcode-base/src/jev.rs:593-613 | crates/jcode-base/src/jev/laya.rs:73-86 — 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) crates/jcode-tui-permissions/src/lib.rs:53 — crates/jcode-tui-permissions/src/lib.rs:53-66 | crates/jcode-tui-permissions/src/lib.rs:68-81 — 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) crates/jcode-tui/src/tui/app/inline_interactive.rs:2605 — crates/jcode-tui/src/tui/app/inline_interactive.rs:2605-2620 | crates/jcode-tui/src/tui/app/inline_interactive.rs:2626-2639 — 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) crates/jcode-base/src/auth/oauth_callback_io.rs:53 — crates/jcode-base/src/auth/oauth_callback_io.rs:53-66 | crates/jcode-base/src/auth/oauth_callback_io.rs:73-90 — 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) crates/jcode-base/src/usage/openai_reset.rs:75 — crates/jcode-base/src/usage/openai_reset.rs:75-88 | src/cli/cloud_managed.rs:909-924 — 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) crates/jcode-app-core/src/tool/communicate.rs:51 — crates/jcode-app-core/src/tool/communicate.rs:51-64 | crates/jcode-app-core/src/tool/communicate.rs:98-111 — 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) crates/jcode-app-core/src/tool/mcp.rs:561 — crates/jcode-app-core/src/tool/mcp.rs:561-574 | crates/jcode-base/src/mcp/remote.rs:835-848 — 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) crates/jcode-harness-api-server/src/lib.rs:142 — crates/jcode-harness-api-server/src/lib.rs:142-155 | crates/jcode-harness-api-server/src/lib.rs:163-176 — 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) crates/jcode-base/src/auth/claude.rs:136 — crates/jcode-base/src/auth/claude.rs:136-149 | crates/jcode-base/src/auth/codex.rs:95-108 — 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) crates/jcode-app-core/src/tool/ambient.rs:420 — crates/jcode-app-core/src/tool/ambient.rs:420-433 | crates/jcode-tui-permissions/src/lib.rs:663-677 — 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) crates/jcode-tui-mermaid/src/lib.rs:1049 — crates/jcode-tui-mermaid/src/lib.rs:1049-1062 | crates/jcode-tui-mermaid/src/lib.rs:1147-1160 — 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) crates/jcode-base/src/memory_log.rs:28 — crates/jcode-base/src/memory_log.rs:28-41 | crates/jcode-logging/src/lib.rs:216-231 — 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) crates/jcode-base/src/memory.rs:490 — crates/jcode-base/src/memory.rs:490-504 | crates/jcode-base/src/memory.rs:512-525 — 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) crates/jcode-base/src/memory/activity.rs:45 — crates/jcode-base/src/memory/activity.rs:45-59 | crates/jcode-base/src/memory/activity.rs:87-100 — 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) crates/jcode-tui/src/tui/ui_inline_image.rs:586 — crates/jcode-tui/src/tui/ui_inline_image.rs:586-613 | crates/jcode-tui/src/tui/ui_inline_image.rs:665-678 — 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) crates/jcode-tui/src/tui/ui.rs:755 — crates/jcode-tui/src/tui/ui.rs:755-768 | crates/jcode-tui/src/tui/ui.rs:770-783 — 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/cli/commands/provider_setup.rs:363 — src/cli/commands/provider_setup.rs:363-376 | src/cli/commands/provider_setup.rs:378-391 — 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) crates/jcode-provider-cursor-runtime/src/lib.rs:639 — crates/jcode-provider-cursor-runtime/src/lib.rs:639-652 | crates/jcode-provider-gemini-runtime/src/lib.rs:998-1011 — 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) crates/jcode-base/src/usage/accessors.rs:82 — crates/jcode-base/src/usage/accessors.rs:82-96 | crates/jcode-base/src/usage/accessors.rs:146-159 — 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) crates/jcode-tui/src/tui/ui_tests/basic/body_cache.rs:870 — crates/jcode-tui/src/tui/ui_tests/basic/body_cache.rs:870-883 | crates/jcode-tui/src/tui/ui_tests/basic/image_regions.rs:25-38 — 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 · Duplicated block (16 lines × 2) · ×20
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/server/client_processing.rs:568 — crates/jcode-app-core/src/server/client_processing.rs:568-583 | crates/jcode-app-core/src/server/client_processing.rs:679-694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_processing.rs:568` 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) crates/jcode-app-core/src/server/comm_plan.rs:176 — crates/jcode-app-core/src/server/comm_plan.rs:176-191 | crates/jcode-app-core/src/server/comm_plan.rs:542-557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/comm_plan.rs:176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/server/debug_session_admin.rs:178 — crates/jcode-app-core/src/server/debug_session_admin.rs:178-193 | crates/jcode-app-core/src/server/swarm.rs:1231-1246 — 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 `crates/jcode-app-core/src/server/debug_session_admin.rs:178` 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 (16 lines × 2) crates/jcode-app-core/src/server/reload_trace.rs:17 — crates/jcode-app-core/src/server/reload_trace.rs:17-32 | crates/jcode-message-types/src/lib.rs:599-614 — 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 `crates/jcode-message-types/src/lib.rs:599` 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) crates/jcode-app-core/src/usage_display.rs:99 — crates/jcode-app-core/src/usage_display.rs:99-114 | crates/jcode-base/src/usage/display.rs:106-121 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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 (16 lines × 2) crates/jcode-app-core/src/usage_openai.rs:219 — crates/jcode-app-core/src/usage_openai.rs:219-234 | crates/jcode-base/src/usage/openai_helpers.rs:244-259 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (16 lines × 2) crates/jcode-base/src/provider/openrouter.rs:287 — crates/jcode-base/src/provider/openrouter.rs:287-302 | crates/jcode-provider-openrouter-runtime/src/lib.rs:367-382 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-base/src/provider/openrouter.rs:287` 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) crates/jcode-tui-render/src/swarm_gallery.rs:409 — crates/jcode-tui-render/src/swarm_gallery.rs:409-424 | crates/jcode-tui-render/src/swarm_gallery.rs:481-496 — both copies are in the same file, so extract the 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) crates/jcode-tui-style/src/theme_mode.rs:85 — crates/jcode-tui-style/src/theme_mode.rs:85-100 | crates/jcode-tui/src/bin/replay_frames.rs:38-53 — 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 (16 lines × 2) crates/jcode-tui/src/tui/app/auth.rs:1301 — crates/jcode-tui/src/tui/app/auth.rs:1301-1316 | crates/jcode-tui/src/tui/app/auth.rs:1707-1722 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/auth.rs:1301` 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) crates/jcode-tui/src/tui/app/remote/input_dispatch.rs:296 — crates/jcode-tui/src/tui/app/remote/input_dispatch.rs:296-311 | crates/jcode-tui/src/tui/app/remote/input_dispatch.rs:318-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/input_dispatch.rs:296` 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 (16 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1795 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1795-1810 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1951-1966 — both copies are in the same file, so extract the 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) crates/jcode-tui/src/tui/ui.rs:2608 — crates/jcode-tui/src/tui/ui.rs:2608-2623 | crates/jcode-tui/src/tui/ui.rs:2635-2650 — both copies are in the same file, so extract the 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 (16 lines × 2) crates/jcode-tui-style/src/color.rs:223 — crates/jcode-tui-style/src/color.rs:223-238 | crates/jcode-tui-workspace/src/color_support.rs:185-200 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 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 (16 lines × 2) src/bin/memory_recall_bench.rs:471 — src/bin/memory_recall_bench.rs:471-486 | src/bin/memory_recall_bench.rs:2255-2270 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/tool/discover.rs:846 — crates/jcode-app-core/src/tool/discover.rs:846-861 | crates/jcode-app-core/src/tool/discover.rs:932-949 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/discover.rs:846` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:1345 — crates/jcode-app-core/src/server/comm_control.rs:1345-1360 | crates/jcode-app-core/src/server/comm_plan.rs:488-503 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-app-core/src/server/comm_control.rs:1345` 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 (16 lines × 2) crates/jcode-base/src/auth/oauth_tests/openai_device_code.rs:11 — crates/jcode-base/src/auth/oauth_tests/openai_device_code.rs:11-26 | crates/jcode-base/src/auth/oauth_tests/openai_refresh_deadline.rs:12-27 — 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 (16 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:689 — crates/jcode-provider-doctor/src/provider_e2e.rs:689-704 | crates/jcode-provider-doctor/src/provider_e2e.rs:1047-1062 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/provider_e2e.rs:689` 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) scripts/repro_expand_edit_shortcut.py:264 — scripts/repro_expand_edit_shortcut.py:264-279 | scripts/repro_live_duplicate.py:227-242 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `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) · ×19
  • Duplicated block (9 lines × 3) crates/jcode-app-core/src/agent/status.rs:10 — crates/jcode-app-core/src/agent/status.rs:10-19 | crates/jcode-app-core/src/agent/status.rs:154-162 | crates/jcode-app-core/src/agent/turn_execution.rs:264-272 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) crates/jcode-app-core/src/channel.rs:228 — crates/jcode-app-core/src/channel.rs:228-237 | crates/jcode-app-core/src/channel.rs:437-446 | crates/jcode-app-core/src/channel.rs:699-707 — 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 `crates/jcode-app-core/src/channel.rs:228` 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) crates/jcode-app-core/src/notifications.rs:806 — crates/jcode-app-core/src/notifications.rs:806-814 | crates/jcode-app-core/src/notifications.rs:821-829 | crates/jcode-setup-hints/src/cli_launch_hints.rs:370-378 — before extracting anything, compare `crates/jcode-app-core/src/notifications.rs` and `crates/jcode-setup-hints/src/cli_launch_hints.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/notifications.rs:806` 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, `crates/jcode-app-core/src/notifications.rs:820` calls `arg` and `crates/jcode-app-core/src/notifications.rs:805` 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) crates/jcode-app-core/src/server/debug_swarm_read.rs:416 — crates/jcode-app-core/src/server/debug_swarm_read.rs:416-424 | crates/jcode-app-core/src/server/debug_swarm_read.rs:456-464 | crates/jcode-app-core/src/server/debug_swarm_read.rs:482-490 — 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 `crates/jcode-app-core/src/server/debug_swarm_read.rs:416` 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, `crates/jcode-app-core/src/server/debug_swarm_read.rs:455` calls `contains` and `crates/jcode-app-core/src/server/debug_swarm_read.rs:415` 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 × 3) crates/jcode-app-core/src/server/jade_relay.rs:366 — crates/jcode-app-core/src/server/jade_relay.rs:366-374 | crates/jcode-app-core/src/server/jade_relay.rs:720-728 | crates/jcode-app-core/src/server/jade_relay.rs:764-772 — 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 `crates/jcode-app-core/src/server/jade_relay.rs:366` 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) crates/jcode-app-core/src/session_launch.rs:703 — crates/jcode-app-core/src/session_launch.rs:703-711 | crates/jcode-app-core/src/session_launch.rs:718-726 | crates/jcode-app-core/src/session_launch.rs:733-741 — 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 `crates/jcode-app-core/src/session_launch.rs:703` 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) crates/jcode-app-core/src/telemetry_state.rs:270 — crates/jcode-app-core/src/telemetry_state.rs:270-278 | crates/jcode-telemetry-core/src/state_support.rs:313-321 | crates/jcode-tui/src/tui/app/support.rs:77-85 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (9 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:887 — crates/jcode-provider-doctor/src/live_provider_probes.rs:887-895 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1211-1219 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1403-1411 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.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 (9 lines × 3) crates/jcode-tui/src/tui/app/turn.rs:283 — crates/jcode-tui/src/tui/app/turn.rs:283-291 | crates/jcode-tui/src/tui/app/turn.rs:887-895 | crates/jcode-tui/src/tui/app/turn.rs:1189-1197 — 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 after the matched lines, `crates/jcode-tui/src/tui/app/turn.rs:292` calls `reset_status_spinner_interval` and `crates/jcode-tui/src/tui/app/turn.rs:896` 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 × 3) crates/jcode-tui/src/tui/session_picker.rs:420 — crates/jcode-tui/src/tui/session_picker.rs:420-428 | crates/jcode-tui/src/tui/session_picker.rs:485-493 | crates/jcode-tui/src/tui/session_picker.rs:582-590 — 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 after the matched lines, `crates/jcode-tui/src/tui/session_picker.rs:494` calls `Some`, `to_string`, `default` and `crates/jcode-tui/src/tui/session_picker.rs:429` 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/cli/commands.rs:606 — src/cli/commands.rs:606-614 | src/cli/commands.rs:859-867 | src/cli/commands.rs:1149-1157 — 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/cli/commands.rs:606` 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/cli/commands.rs:870` calls `display` and `src/cli/commands.rs:1160` 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) crates/jcode-setup-hints/src/lib.rs:874 — crates/jcode-setup-hints/src/lib.rs:874-882 | crates/jcode-setup-hints/src/lib.rs:1144-1152 | crates/jcode-setup-hints/src/lib.rs:1417-1425 — 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 (9 lines × 3) crates/jcode-tui/src/tui/app/observe.rs:59 — crates/jcode-tui/src/tui/app/observe.rs:59-67 | crates/jcode-tui/src/tui/app/split_view.rs:31-39 | crates/jcode-tui/src/tui/app/todos_view.rs:362-370 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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 `crates/jcode-tui/src/tui/app/observe.rs:59` 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 `self` to `super) fn set_observe_mode_enabled(&mut` in one and `super) fn set_split_view_enabled(&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 (9 lines × 3) crates/jcode-app-core/src/server/jade_relay.rs:109 — crates/jcode-app-core/src/server/jade_relay.rs:109-117 | crates/jcode-base/src/auth/mod.rs:171-179 | src/cli/commands/menubar.rs:334-342 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (9 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:1287 — crates/jcode-provider-doctor/src/live_provider_probes.rs:1287-1295 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1345-1356 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1448-1465 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.rs:1287` 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) crates/jcode-base/src/auth/cursor.rs:557 — crates/jcode-base/src/auth/cursor.rs:557-565 | crates/jcode-base/src/auth/cursor.rs:603-611 | crates/jcode-base/src/provider/antigravity.rs:105-113 — 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 (9 lines × 3) crates/jcode-app-core/src/server/comm_control.rs:1467 — crates/jcode-app-core/src/server/comm_control.rs:1467-1475 | crates/jcode-app-core/src/server/comm_plan.rs:529-537 | crates/jcode-app-core/src/server/comm_plan.rs:675-683 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-app-core/src/server/comm_control.rs:1467` 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 after the matched lines, `crates/jcode-app-core/src/server/comm_plan.rs:538` calls `push` and `crates/jcode-app-core/src/server/comm_control.rs:1476` 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) scripts/benchmark_swarm.py:204 — scripts/benchmark_swarm.py:204-212 | scripts/benchmark_swarm.py:369-377 | scripts/benchmark_takehome.py:177-185 — 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 (9 lines × 3) scripts/repro_expand_edit_shortcut.py:436 — scripts/repro_expand_edit_shortcut.py:436-444 | scripts/repro_live_duplicate.py:447-455 | scripts/repro_startup_lag.py:83-91 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×18
  • Edited copy of a member (10 corresponding lines) crates/jcode-app-core/src/tool/desktop_selfdev.rs:43 — crates/jcode-app-core/src/tool/desktop_selfdev.rs:43-52 | crates/jcode-app-core/src/tool/side_panel.rs:48-81 — 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/cli/commands.rs:253 — src/cli/commands.rs:253-263 | src/cli/commands.rs:476-485 — 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) crates/jcode-base/src/gmail.rs:475 — crates/jcode-base/src/gmail.rs:475-489 | crates/jcode-base/src/gmail.rs:502-511 — 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) crates/jcode-base/src/gmail.rs:521 — crates/jcode-base/src/gmail.rs:521-531 | crates/jcode-base/src/gmail.rs:594-603 — 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) crates/jcode-tui-permissions/src/lib.rs:83 — crates/jcode-tui-permissions/src/lib.rs:83-92 | crates/jcode-tui-permissions/src/lib.rs:94-103 — 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) crates/jcode-telemetry-core/src/concurrency.rs:116 — crates/jcode-telemetry-core/src/concurrency.rs:116-130 | src/cli/cloud_session_ops.rs:231-240 — 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) crates/jcode-tui/src/tui/keybind.rs:521 — crates/jcode-tui/src/tui/keybind.rs:521-530 | crates/jcode-tui/src/tui/keybind.rs:534-546 — 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) crates/jcode-app-core/src/server/debug_server_state.rs:1088 — crates/jcode-app-core/src/server/debug_server_state.rs:1088-1101 | crates/jcode-app-core/src/server/debug_server_state.rs:1136-1145 — 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) crates/jcode-app-core/src/tool/mod.rs:1425 — crates/jcode-app-core/src/tool/mod.rs:1425-1434 | crates/jcode-app-core/src/tool/mod.rs:1436-1446 — 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) crates/jcode-base/src/usage/banked.rs:107 — crates/jcode-base/src/usage/banked.rs:107-116 | crates/jcode-base/src/usage/remote_accounts.rs:18-27 — 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) crates/jcode-tui-markdown/src/markdown_math_copy.rs:29 — crates/jcode-tui-markdown/src/markdown_math_copy.rs:29-38 | crates/jcode-tui/src/tui/ui_file_diff.rs:87-98 — 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) crates/jcode-tui/src/tui/ui_tools.rs:789 — crates/jcode-tui/src/tui/ui_tools.rs:789-798 | crates/jcode-voice/src/dictation.rs:642-653 — 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) crates/jcode-base/src/account_login.rs:372 — crates/jcode-base/src/account_login.rs:372-382 | src/cli/login/jcode_device.rs:95-104 — 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) crates/jcode-app-core/src/tool/agentgrep/args.rs:223 — crates/jcode-app-core/src/tool/agentgrep/args.rs:223-232 | crates/jcode-selfdev-types/src/lib.rs:44-54 — 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) crates/jcode-app-core/src/tool/discover.rs:75 — crates/jcode-app-core/src/tool/discover.rs:75-84 | crates/jcode-base/src/subscription_catalog.rs:383-393 — 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) crates/jcode-provider-grok-build-runtime/src/lib.rs:108 — crates/jcode-provider-grok-build-runtime/src/lib.rs:108-117 | crates/jcode-provider-openai-runtime/src/openai_stream_diagnostics.rs:38-49 — 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) crates/jcode-tui-mermaid/src/mermaid_runtime.rs:111 — crates/jcode-tui-mermaid/src/mermaid_runtime.rs:111-120 | crates/jcode-tui/src/tui/ui_prepare.rs:2957-2966 — 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) crates/jcode-app-core/src/agent_tests/concurrency.rs:28 — crates/jcode-app-core/src/agent_tests/concurrency.rs:28-39 | crates/jcode-app-core/src/agent_tests/desktop_selfdev.rs: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.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×18
  • Edited copy of a member (6 corresponding lines) crates/jcode-harness-api-server/src/timing.rs:16 — crates/jcode-harness-api-server/src/timing.rs:16-21 | crates/jcode-harness-api-server/src/translate.rs:3050-3056 — 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) crates/jcode-transport/src/windows.rs:168 — crates/jcode-transport/src/windows.rs:168-173 | crates/jcode-transport/src/windows.rs:181-186 — 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) crates/jcode-build-support/src/storage_helpers.rs:225 — crates/jcode-build-support/src/storage_helpers.rs:225-231 | crates/jcode-telemetry-core/src/desktop.rs:17-22 — 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) crates/jcode-app-core/src/tool/selfdev/mod.rs:188 — crates/jcode-app-core/src/tool/selfdev/mod.rs:188-194 | src/cli/commands.rs:2846-2851 — 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) crates/jcode-app-core/src/tool/selfdev/mod.rs:766 — crates/jcode-app-core/src/tool/selfdev/mod.rs:766-771 | src/cli/commands/restart.rs:172-177 — 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) crates/jcode-tui/src/tui/app/onboarding_flow.rs:632 — crates/jcode-tui/src/tui/app/onboarding_flow.rs:632-637 | crates/jcode-tui/src/tui/app/onboarding_repair.rs:96-101 — 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) crates/jcode-import-core/src/lib.rs:454 — crates/jcode-import-core/src/lib.rs:454-459 | crates/jcode-tui/src/tui/session_picker/loading.rs:1002-1007 — 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) crates/jcode-app-core/src/tool/bridge_reload.rs:36 — crates/jcode-app-core/src/tool/bridge_reload.rs:36-41 | crates/jcode-tui/src/tui/app/helpers.rs:1008-1013 — 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) crates/jcode-base/src/provider/antigravity.rs:40 — crates/jcode-base/src/provider/antigravity.rs:40-48 | crates/jcode-provider-cursor-runtime/src/lib.rs:440-445 — 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) crates/jcode-base/src/applets.rs:257 — crates/jcode-base/src/applets.rs:257-262 | crates/jcode-base/src/embedding.rs:163-168 — 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) crates/jcode-logging/src/watchdog.rs:114 — crates/jcode-logging/src/watchdog.rs:114-119 | src/cli/commands.rs:2771-2777 — 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) crates/jcode-base/src/auth/refresh_state.rs:192 — crates/jcode-base/src/auth/refresh_state.rs:192-198 | crates/jcode-base/src/goal.rs:571-576 — 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) crates/jcode-base/src/browser.rs:1296 — crates/jcode-base/src/browser.rs:1296-1301 | crates/jcode-base/src/browser_update.rs:94-99 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) crates/jcode-storage/src/active_pids.rs:326 — crates/jcode-storage/src/active_pids.rs:326-332 | src/cli/commands/menubar.rs:48-53 — 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) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:238 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:238-243 | crates/jcode-provider-cursor-runtime/src/wire.rs:49-54 — 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) crates/jcode-tui/src/tui/info_widget_frame.rs:32 — crates/jcode-tui/src/tui/info_widget_frame.rs:32-37 | crates/jcode-tui/src/tui/ui_todo_changes.rs:296-301 — 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) crates/jcode-app-core/src/server/socket.rs:7 — crates/jcode-app-core/src/server/socket.rs:7-12 | crates/jcode-harness-api/src/sockets.rs:76-81 — 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) crates/jcode-tui/src/tui/ui_frame_metrics.rs:215 — crates/jcode-tui/src/tui/ui_frame_metrics.rs:215-220 | crates/jcode-tui/src/tui/ui_smoothness.rs:120-125 — 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.
D2 · Cognitive Complexity · MultiProvider · ×17
  • MultiProvider::complete_with_failover (cognitive 74) crates/jcode-base/src/provider/mod.rs:600 — MultiProvider::complete_with_failover has cognitive complexity 74 (threshold 15). Drivers by points: if/else 27 (62 pts), match/switch 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::new_with_auth_status (cognitive 58) crates/jcode-base/src/provider/startup.rs:71 — MultiProvider::new_with_auth_status has cognitive complexity 58 (threshold 15). Drivers by points: if/else 36 (45 pts), match/switch 3 (7 pts), boolean chains 6 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • MultiProvider::set_model_on_provider_with_credential_modes (cognitive 48) crates/jcode-base/src/provider/mod.rs:1164 — MultiProvider::set_model_on_provider_with_credential_modes has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 4 (10 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.
  • MultiProvider::cross_provider_pool_prompt (cognitive 45) crates/jcode-base/src/provider/multi_provider.rs:105 — MultiProvider::cross_provider_pool_prompt has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 9, match/switch 3 (5 pts), loops 3 (4 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.
  • MultiProvider::handle_auth_changed (cognitive 44) crates/jcode-base/src/provider/mod.rs:1444 — MultiProvider::handle_auth_changed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 10, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::compute_fresh_session_pool_route (cognitive 34) crates/jcode-base/src/provider/startup.rs:517 — MultiProvider::compute_fresh_session_pool_route has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 4 (7 pts), boolean chains 6, match/switch 2 (4 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.
  • MultiProvider::set_model (cognitive 32) crates/jcode-base/src/provider/mod.rs:2165 — MultiProvider::set_model has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 6, 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.
  • MultiProvider::fresh_routes_memo_entry (cognitive 26) crates/jcode-base/src/provider/catalog_memo.rs:186 — MultiProvider::fresh_routes_memo_entry has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, match/switch 1 (2 pts), 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.
  • MultiProvider::complete_on_provider (cognitive 25) crates/jcode-base/src/provider/dispatch.rs:57 — MultiProvider::complete_on_provider has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). 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. This shape REPEATS in the file: one other method here (MultiProvider::complete_split_on_provider) 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.
  • MultiProvider::complete_split_on_provider (cognitive 25) crates/jcode-base/src/provider/dispatch.rs:183 — MultiProvider::complete_split_on_provider has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). 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. This shape REPEATS in the file: one other method here (MultiProvider::complete_on_provider) 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.
  • MultiProvider::is_failover_route_pool_approved (cognitive 23) crates/jcode-base/src/provider/multi_provider.rs:7 — MultiProvider::is_failover_route_pool_approved has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 3 (5 pts), boolean chains 3 (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.
  • MultiProvider::refresh_catalogs (cognitive 20) crates/jcode-base/src/provider/catalog_refresh.rs:13 — MultiProvider::refresh_catalogs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::native_compact (cognitive 19) crates/jcode-base/src/provider/mod.rs:2742 — MultiProvider::native_compact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (nesting depth added 6). 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.
  • MultiProvider::explicit_session_provider_key_for_model_request (cognitive 19) crates/jcode-base/src/provider/selection.rs:242 — MultiProvider::explicit_session_provider_key_for_model_request has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MultiProvider::model_switch_request_for_session_model (cognitive 18) crates/jcode-base/src/provider/selection.rs:371 — MultiProvider::model_switch_request_for_session_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • MultiProvider::fork_model_switch_request (cognitive 17) crates/jcode-base/src/provider/mod.rs:1747 — MultiProvider::fork_model_switch_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 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.
  • MultiProvider::auto_select_multi_account_for_provider (cognitive 16) crates/jcode-base/src/provider/startup.rs:724 — MultiProvider::auto_select_multi_account_for_provider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×17
  • Edited copy of a member (19 corresponding lines) crates/jcode-tui/src/tui/ui_diagram_pane.rs:637 — crates/jcode-tui/src/tui/ui_diagram_pane.rs:637-655 | crates/jcode-tui/src/tui/ui_diagram_pane.rs:674-692 — 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) crates/jcode-app-core/src/tool/session_search.rs:1481 — crates/jcode-app-core/src/tool/session_search.rs:1481-1499 | crates/jcode-app-core/src/tool/session_search.rs:1737-1762 — 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) crates/jcode-provider-antigravity/src/lib.rs:233 — crates/jcode-provider-antigravity/src/lib.rs:233-256 | crates/jcode-provider-gemini/src/lib.rs:601-619 — 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) crates/jcode-app-core/src/session_launch.rs:327 — crates/jcode-app-core/src/session_launch.rs:327-345 | crates/jcode-tui/src/tui/app/helpers.rs:1142-1160 — 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) crates/jcode-setup-hints/src/lib.rs:2390 — crates/jcode-setup-hints/src/lib.rs:2390-2408 | crates/jcode-tui-style/src/color.rs:59-81 — 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) crates/jcode-todo-policy/src/lib.rs:563 — crates/jcode-todo-policy/src/lib.rs:563-581 | crates/jcode-todo-policy/src/lib.rs:586-604 — 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/cli/acp.rs:1565 — src/cli/acp.rs:1565-1592 | src/cli/acp.rs:1594-1612 — 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) crates/jcode-telemetry-core/src/lib.rs:2222 — crates/jcode-telemetry-core/src/lib.rs:2222-2242 | crates/jcode-telemetry-core/src/lib.rs:2257-2275 — 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) crates/jcode-app-core/src/tool/selfdev/reload.rs:44 — crates/jcode-app-core/src/tool/selfdev/reload.rs:44-62 | crates/jcode-app-core/src/tool/selfdev/reload.rs:65-85 — 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) crates/jcode-base/src/provider/mod.rs:2535 — crates/jcode-base/src/provider/mod.rs:2535-2557 | crates/jcode-base/src/provider/mod.rs:2590-2608 — 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) crates/jcode-base/src/subscription_api.rs:707 — crates/jcode-base/src/subscription_api.rs:707-725 | crates/jcode-base/src/subscription_api.rs:736-755 — 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) crates/jcode-voice/src/lib.rs:568 — crates/jcode-voice/src/lib.rs:568-586 | crates/jcode-voice/src/streaming_capture.rs:259-278 — 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) crates/jcode-tui/src/tui/ui_diff.rs:99 — crates/jcode-tui/src/tui/ui_diff.rs:99-122 | crates/jcode-tui/src/tui/ui_diff.rs:124-142 — 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) crates/jcode-tui/src/tui/ui_inline_interactive.rs:9 — crates/jcode-tui/src/tui/ui_inline_interactive.rs:9-32 | crates/jcode-tui/src/tui/ui_messages/usage.rs:748-766 — 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) crates/jcode-app-core/src/session_rebuild.rs:167 — crates/jcode-app-core/src/session_rebuild.rs:167-185 | crates/jcode-app-core/src/session_rebuild.rs:187-205 — 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) crates/jcode-compaction-core/src/lib.rs:410 — crates/jcode-compaction-core/src/lib.rs:410-432 | crates/jcode-compaction-core/src/lib.rs:442-460 — 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) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:939 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:939-958 | crates/jcode-tui-markdown/src/markdown_latex_image.rs:127-145 — 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 (8 corresponding lines) · ×17
  • Edited copy of a member (8 corresponding lines) crates/jcode-base/src/provider/mod.rs:2521 — crates/jcode-base/src/provider/mod.rs:2521-2533 | crates/jcode-base/src/provider/mod.rs:2581-2588 — 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) crates/jcode-schema-dialect/src/rejection.rs:150 — crates/jcode-schema-dialect/src/rejection.rs:150-158 | crates/jcode-schema-dialect/src/rejection.rs:181-188 — 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) crates/jcode-provider-bedrock/src/lib.rs:212 — crates/jcode-provider-bedrock/src/lib.rs:212-222 | crates/jcode-provider-bedrock/src/lib.rs:225-232 — 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) crates/jcode-tui-mermaid/src/mermaid_debug.rs:522 — crates/jcode-tui-mermaid/src/mermaid_debug.rs:522-529 | crates/jcode-tui/src/tui/app/input.rs:86-93 — 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) crates/jcode-storage/src/lib.rs:163 — crates/jcode-storage/src/lib.rs:163-170 | crates/jcode-storage/src/lib.rs:221-229 — 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) crates/jcode-provider-antigravity-runtime/src/lib.rs:938 — crates/jcode-provider-antigravity-runtime/src/lib.rs:938-945 | crates/jcode-provider-gemini-runtime/src/lib.rs:1028-1035 — 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) crates/jcode-tui/src/tui/ui_input.rs:1905 — crates/jcode-tui/src/tui/ui_input.rs:1905-1915 | crates/jcode-base/src/mcp/remote.rs:289-296 — 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) crates/jcode-base/src/session/window_closures.rs:51 — crates/jcode-base/src/session/window_closures.rs:51-58 | crates/jcode-base/src/mobile_runner_process.rs:19-28 — 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) crates/jcode-app-core/src/update_metadata.rs:56 — crates/jcode-app-core/src/update_metadata.rs:56-64 | crates/jcode-base/src/mcp/protocol.rs:436-443 — 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) crates/jcode-app-core/src/server/comm_control.rs:747 — crates/jcode-app-core/src/server/comm_control.rs:747-754 | crates/jcode-app-core/src/server/state.rs:572-579 — 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) crates/jcode-base/src/config.rs:828 — crates/jcode-base/src/config.rs:828-835 | crates/jcode-base/src/goal.rs:18-26 — 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) crates/jcode-provider-antigravity-runtime/src/lib.rs:45 — crates/jcode-provider-antigravity-runtime/src/lib.rs:45-52 | crates/jcode-provider-gemini-runtime/src/lib.rs:1044-1051 — 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) crates/jcode-base/src/usage/anthropic_reset.rs:78 — crates/jcode-base/src/usage/anthropic_reset.rs:78-85 | crates/jcode-base/src/usage/openai_reset.rs:294-301 — 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) crates/jcode-app-core/src/tool/selfdev/mod.rs:238 — crates/jcode-app-core/src/tool/selfdev/mod.rs:238-245 | crates/jcode-build-support/src/storage_helpers.rs:100-107 — 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) crates/jcode-base/src/auth/codex.rs:122 — crates/jcode-base/src/auth/codex.rs:122-129 | crates/jcode-base/REDACTED:218-225 — 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) crates/jcode-app-core/src/catchup.rs:476 — crates/jcode-app-core/src/catchup.rs:476-483 | crates/jcode-sdk/src/launch.rs:798-805 — 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) scripts/bench_memory_cli.py:196 — scripts/bench_memory_cli.py:196-203 | scripts/bench_startup_visible_ready.py:161-168 — 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 · Edited copy of a member (15 corresponding lines) · ×16
  • Edited copy of a member (15 corresponding lines) crates/jcode-base/src/embedding_stub.rs:164 — crates/jcode-base/src/embedding_stub.rs:164-181 | crates/jcode-embedding/src/lib.rs:369-383 — 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) crates/jcode-tui-markdown/src/lib.rs:1049 — crates/jcode-tui-markdown/src/lib.rs:1049-1066 | crates/jcode-tui-markdown/src/render_core_adapter.rs:54-68 — 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) crates/jcode-base/src/mcp/oauth.rs:592 — crates/jcode-base/src/mcp/oauth.rs:592-606 | crates/jcode-base/src/mcp/oauth.rs:608-623 — 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) crates/jcode-app-core/src/tool/browser.rs:423 — crates/jcode-app-core/src/tool/browser.rs:423-441 | crates/jcode-app-core/src/tool/browser.rs:447-461 — 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) crates/jcode-app-core/src/ssh_remote.rs:125 — crates/jcode-app-core/src/ssh_remote.rs:125-141 | crates/jcode-app-core/src/ssh_remote.rs:159-173 — 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) crates/jcode-base/src/auth/claude.rs:393 — crates/jcode-base/src/auth/claude.rs:393-407 | crates/jcode-base/src/auth/codex.rs:255-269 — 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) crates/jcode-base/src/auth/claude.rs:376 — crates/jcode-base/src/auth/claude.rs:376-390 | crates/jcode-base/src/auth/codex.rs:239-253 — 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) crates/jcode-tui/src/tui/app/debug.rs:133 — crates/jcode-tui/src/tui/app/debug.rs:133-147 | crates/jcode-tui/src/tui/memory_profile.rs:134-152 — 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) crates/jcode-tui-mermaid/src/mermaid_content.rs:306 — crates/jcode-tui-mermaid/src/mermaid_content.rs:306-328 | crates/jcode-tui-mermaid/src/mermaid_content.rs:375-389 — 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) crates/jcode-app-core/src/server/turn_failover.rs:187 — crates/jcode-app-core/src/server/turn_failover.rs:187-204 | crates/jcode-app-core/src/server/turn_failover.rs:236-250 — 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) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:860 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:860-874 | crates/jcode-tui/src/tui/ui_inline_image.rs:467-481 — 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) crates/jcode-harness-api-server/src/translate.rs:1440 — crates/jcode-harness-api-server/src/translate.rs:1440-1454 | crates/jcode-harness-api-server/src/translate.rs:1456-1471 — 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) crates/jcode-tui/src/tui/ui/display_width.rs:8 — crates/jcode-tui/src/tui/ui/display_width.rs:8-22 | crates/jcode-tui/src/tui/ui/display_width.rs:27-41 — 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) crates/jcode-base/src/provider/catalog_routes.rs:751 — crates/jcode-base/src/provider/catalog_routes.rs:751-765 | crates/jcode-base/src/provider/catalog_routes.rs:773-787 — 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) crates/jcode-base/src/power_inhibit.rs:469 — crates/jcode-base/src/power_inhibit.rs:469-485 | crates/jcode-base/src/power_inhibit.rs:487-501 — 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) crates/jcode-tui/src/tui/app/onboarding_flow.rs:272 — crates/jcode-tui/src/tui/app/onboarding_flow.rs:272-286 | crates/jcode-tui/src/tui/app/onboarding_flow.rs:290-304 — 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 · Duplicated block (18 lines × 2) · ×16
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/message_notifications.rs:168 — crates/jcode-app-core/src/message_notifications.rs:168-185 | crates/jcode-base/src/message/notifications.rs:530-547 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/message_notifications.rs:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:997 — crates/jcode-app-core/src/server/client_lifecycle.rs:997-1014 | crates/jcode-app-core/src/server/client_lifecycle.rs:3285-3302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/server/client_session.rs:48 — crates/jcode-app-core/src/server/client_session.rs:48-65 | crates/jcode-app-core/src/server/client_state.rs:720-737 — 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 `crates/jcode-app-core/src/server/client_session.rs:48` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/jcode-app-core/src/usage_openai.rs:264 — crates/jcode-app-core/src/usage_openai.rs:264-281 | crates/jcode-base/src/usage/openai_helpers.rs:289-306 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (18 lines × 2) crates/jcode-provider-copilot/src/lib.rs:167 — crates/jcode-provider-copilot/src/lib.rs:167-184 | crates/jcode-provider-openrouter/src/request.rs:227-244 — before extracting anything, compare `crates/jcode-provider-copilot/src/lib.rs` and `crates/jcode-provider-openrouter/src/request.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-provider-copilot/src/lib.rs:167` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:769 — crates/jcode-provider-doctor/src/live_provider_probes.rs:769-786 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1097-1114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/jcode-tui-render/src/swarm_gallery.rs:838 — crates/jcode-tui-render/src/swarm_gallery.rs:838-855 | crates/jcode-tui-render/src/swarm_gallery.rs:1186-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 `crates/jcode-tui-render/src/swarm_gallery.rs:838` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) crates/jcode-tui-style/src/color.rs:200 — crates/jcode-tui-style/src/color.rs:200-217 | crates/jcode-tui-workspace/src/color_support.rs:162-179 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 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 (18 lines × 2) crates/jcode-tui-tool-display/src/lib.rs:161 — crates/jcode-tui-tool-display/src/lib.rs:161-178 | crates/jcode-tui/src/tui/ui_tools.rs:282-299 — before extracting anything, compare `crates/jcode-tui-tool-display/src/lib.rs` and `crates/jcode-tui/src/tui/ui_tools.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 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 (18 lines × 2) crates/jcode-tui/src/tui/app/commands_improve.rs:498 — crates/jcode-tui/src/tui/app/commands_improve.rs:498-515 | crates/jcode-tui/src/tui/app/commands_improve.rs:567-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 `crates/jcode-tui/src/tui/app/commands_improve.rs:498` 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) crates/jcode-tui/src/tui/app/debug.rs:437 — crates/jcode-tui/src/tui/app/debug.rs:437-454 | crates/jcode-tui/src/tui/memory_profile.rs:280-297 — before extracting anything, compare `crates/jcode-tui/src/tui/app/debug.rs` and `crates/jcode-tui/src/tui/memory_profile.rs` as WHOLE FILES: this scan already matched 4 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 (18 lines × 2) crates/jcode-voice/src/lib.rs:482 — crates/jcode-voice/src/lib.rs:482-499 | crates/jcode-voice/src/streaming_capture.rs:324-341 — 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 `crates/jcode-voice/src/lib.rs:482` 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, `crates/jcode-voice/src/streaming_capture.rs:342` calls `mark` and `crates/jcode-voice/src/lib.rs:500` 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 (18 lines × 2) REDACTED:335 — REDACTED:335-352 | REDACTED:355-372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:335` 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) crates/jcode-provider-openai/src/request.rs:471 — crates/jcode-provider-openai/src/request.rs:471-488 | crates/jcode-provider-openai/src/request.rs:645-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-openai/src/request.rs:471` 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) crates/jcode-app-core/src/tool/discover.rs:731 — crates/jcode-app-core/src/tool/discover.rs:731-748 | crates/jcode-app-core/src/tool/discover.rs:909-926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/discover.rs:731` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) scripts/repro_expand_edit_shortcut.py:235 — scripts/repro_expand_edit_shortcut.py:235-252 | scripts/repro_live_duplicate.py:205-222 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 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 · Edited copy of a member (17 corresponding lines) · ×15
  • Edited copy of a member (17 corresponding lines) crates/jcode-telemetry-core/src/lib.rs:1007 — crates/jcode-telemetry-core/src/lib.rs:1007-1026 | crates/jcode-telemetry-core/src/lib.rs:1028-1044 — 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) crates/jcode-base/src/memory.rs:786 — crates/jcode-base/src/memory.rs:786-808 | src/bin/memory_recall_bench.rs:191-207 — 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) crates/jcode-app-core/src/server/reload.rs:34 — crates/jcode-app-core/src/server/reload.rs:34-53 | crates/jcode-base/src/mobile_runner.rs:306-322 — 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) crates/jcode-setup-hints/src/keymap/chord.rs:65 — crates/jcode-setup-hints/src/keymap/chord.rs:65-81 | crates/jcode-setup-hints/src/keymap/chord.rs:87-103 — 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) crates/jcode-base/src/embedding_stub.rs:183 — crates/jcode-base/src/embedding_stub.rs:183-203 | crates/jcode-embedding/src/lib.rs:385-401 — 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) crates/jcode-tui/src/tui/app/commands_overnight.rs:153 — crates/jcode-tui/src/tui/app/commands_overnight.rs:153-171 | crates/jcode-tui/src/tui/app/commands_overnight.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) crates/jcode-build-support/src/lib.rs:171 — crates/jcode-build-support/src/lib.rs:171-187 | crates/jcode-build-support/src/lib.rs:189-209 — 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) crates/jcode-provider-antigravity-runtime/src/lib.rs:261 — crates/jcode-provider-antigravity-runtime/src/lib.rs:261-286 | crates/jcode-provider-gemini-runtime/src/lib.rs:477-493 — 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) crates/jcode-base/src/provider/mod.rs:2559 — crates/jcode-base/src/provider/mod.rs:2559-2579 | crates/jcode-base/src/provider/mod.rs:2610-2626 — 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) crates/jcode-base/src/memory.rs:1367 — crates/jcode-base/src/memory.rs:1367-1383 | crates/jcode-base/src/memory.rs:1386-1405 — 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) crates/jcode-provider-openrouter-runtime/src/lib.rs:930 — crates/jcode-provider-openrouter-runtime/src/lib.rs:930-946 | crates/jcode-provider-openrouter-runtime/src/lib.rs:967-985 — 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) crates/jcode-app-core/src/ssh_remote.rs:106 — crates/jcode-app-core/src/ssh_remote.rs:106-123 | crates/jcode-logging/src/lib.rs:494-510 — 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) crates/jcode-tui/src/tui/ui.rs:696 — crates/jcode-tui/src/tui/ui.rs:696-712 | crates/jcode-tui/src/tui/ui.rs:785-804 — 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) crates/jcode-tui-account-picker/src/lib.rs:108 — crates/jcode-tui-account-picker/src/lib.rs:108-124 | crates/jcode-tui-usage-overlay/src/lib.rs:96-114 — 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) crates/jcode-app-core/src/server/reload_trace.rs:16 — crates/jcode-app-core/src/server/reload_trace.rs:16-32 | crates/jcode-message-types/src/lib.rs:595-614 — 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 · Edited copy of a member (16 corresponding lines) · ×15
  • Edited copy of a member (16 corresponding lines) crates/jcode-app-core/src/server/jade_relay.rs:311 — crates/jcode-app-core/src/server/jade_relay.rs:311-326 | crates/jcode-app-core/src/server/jade_relay.rs:664-680 — 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) crates/jcode-base/src/usage/api_keys.rs:439 — crates/jcode-base/src/usage/api_keys.rs:439-454 | crates/jcode-base/src/usage/api_keys.rs:609-624 — 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) crates/jcode-tui-messages/src/message.rs:296 — crates/jcode-tui-messages/src/message.rs:296-311 | crates/jcode-tui/src/tui/session_picker/performance.rs:168-183 — 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) crates/jcode-provider-core/src/fallback_pick.rs:423 — crates/jcode-provider-core/src/fallback_pick.rs:423-438 | crates/jcode-tui/src/tui/app/model_context.rs:692-712 — 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) crates/jcode-provider-anthropic-runtime/src/lib.rs:271 — crates/jcode-provider-anthropic-runtime/src/lib.rs:271-286 | crates/jcode-provider-anthropic-runtime/src/lib.rs:294-310 — 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) crates/jcode-provider-anthropic-runtime/src/lib.rs:1412 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1412-1427 | crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:33-52 — 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) crates/jcode-tui/src/tui/app/inline_interactive.rs:195 — crates/jcode-tui/src/tui/app/inline_interactive.rs:195-210 | crates/jcode-tui/src/tui/app/inline_interactive.rs:247-262 — 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) crates/jcode-tui/src/tui/ui_inline_image.rs:433 — crates/jcode-tui/src/tui/ui_inline_image.rs:433-448 | crates/jcode-tui/src/tui/ui_inline_image.rs:450-465 — 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) crates/jcode-app-core/src/message_notifications.rs:195 — crates/jcode-app-core/src/message_notifications.rs:195-212 | crates/jcode-base/src/message/notifications.rs:559-574 — 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) crates/jcode-tui/src/tui/app/commands_improve.rs:233 — crates/jcode-tui/src/tui/app/commands_improve.rs:233-248 | crates/jcode-tui/src/tui/app/commands_improve.rs:266-281 — 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) crates/jcode-base/src/auth/google.rs:593 — crates/jcode-base/src/auth/google.rs:593-608 | crates/jcode-base/src/auth/google.rs:610-630 — 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) crates/jcode-app-core/src/server/live_turn.rs:249 — crates/jcode-app-core/src/server/live_turn.rs:249-264 | crates/jcode-app-core/src/server/live_turn.rs:271-286 — 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) crates/jcode-base/src/goal.rs:290 — crates/jcode-base/src/goal.rs:290-305 | crates/jcode-base/src/goal.rs:311-326 — 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) crates/jcode-tui/src/tui/app/auth.rs:1042 — crates/jcode-tui/src/tui/app/auth.rs:1042-1057 | crates/jcode-tui/src/tui/app/auth.rs:1063-1078 — 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) crates/jcode-tui/src/tui/app/commands.rs:2429 — crates/jcode-tui/src/tui/app/commands.rs:2429-2444 | crates/jcode-tui/src/tui/app/commands.rs:2446-2461 — 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 (11 corresponding lines) · ×15
  • Edited copy of a member (11 corresponding lines) crates/jcode-tui/src/tui/app/helpers.rs:937 — crates/jcode-tui/src/tui/app/helpers.rs:937-947 | src/cli/tui_launch.rs:575-593 — 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) crates/jcode-app-core/src/server/debug_server_state.rs:1103 — crates/jcode-app-core/src/server/debug_server_state.rs:1103-1123 | crates/jcode-app-core/src/server/debug_server_state.rs:1147-1157 — 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) crates/jcode-provider-antigravity-runtime/src/lib.rs:83 — crates/jcode-provider-antigravity-runtime/src/lib.rs:83-95 | crates/jcode-provider-gemini-runtime/src/lib.rs:75-85 — 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) crates/jcode-setup-hints/src/keymap/terminal.rs:137 — crates/jcode-setup-hints/src/keymap/terminal.rs:137-154 | crates/jcode-setup-hints/src/keymap/terminal.rs:157-167 — 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) crates/jcode-base/src/mcp/client.rs:39 — crates/jcode-base/src/mcp/client.rs:39-49 | crates/jcode-base/src/mcp/remote.rs:373-386 — 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) crates/jcode-tui-usage-overlay/src/lib.rs:317 — crates/jcode-tui-usage-overlay/src/lib.rs:317-327 | crates/jcode-tui/src/tui/login_picker.rs:188-198 — 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) crates/jcode-base/src/auth/claude.rs:434 — crates/jcode-base/src/auth/claude.rs:434-444 | crates/jcode-base/src/auth/codex.rs:295-305 — 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) crates/jcode-setup-hints/src/lib.rs:2341 — crates/jcode-setup-hints/src/lib.rs:2341-2353 | crates/jcode-setup-hints/src/lib.rs:2413-2423 — 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) crates/jcode-base/src/provider/model_provider_availability.rs:80 — crates/jcode-base/src/provider/model_provider_availability.rs:80-93 | crates/jcode-base/src/provider/model_provider_availability.rs:103-113 — 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) crates/jcode-base/src/todo.rs:45 — crates/jcode-base/src/todo.rs:45-55 | crates/jcode-base/src/todo.rs:159-169 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) crates/jcode-app-core/src/agent/tools.rs:7 — crates/jcode-app-core/src/agent/tools.rs:7-19 | crates/jcode-app-core/src/agent/tools.rs:21-31 — 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) crates/jcode-app-core/src/server/client_lifecycle_logging.rs:42 — crates/jcode-app-core/src/server/client_lifecycle_logging.rs:42-52 | crates/jcode-app-core/src/tool/communicate/transport.rs:60-70 — 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) crates/jcode-core/src/id.rs:222 — crates/jcode-core/src/id.rs:222-234 | crates/jcode-core/src/id.rs:263-273 — 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/cli/cloud_move.rs:146 — src/cli/cloud_move.rs:146-158 | src/cli/cloud_session_ops.rs:214-224 — 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) scripts/check_code_size_budget.py:67 — scripts/check_code_size_budget.py:67-77 | scripts/check_test_size_budget.py:56-66 — 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.
D1 · Cyclomatic Complexity · MultiProvider · ×14
  • MultiProvider::cross_provider_pool_prompt (cyclomatic 41) crates/jcode-base/src/provider/multi_provider.rs:105 — MultiProvider::cross_provider_pool_prompt has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MultiProvider::complete_with_failover (cyclomatic 34) crates/jcode-base/src/provider/mod.rs:600 — MultiProvider::complete_with_failover has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MultiProvider::handle_auth_changed (cyclomatic 34) crates/jcode-base/src/provider/mod.rs:1444 — MultiProvider::handle_auth_changed has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MultiProvider::new_with_auth_status (cyclomatic 33) crates/jcode-base/src/provider/startup.rs:71 — MultiProvider::new_with_auth_status has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • MultiProvider::set_model_on_provider_with_credential_modes (cyclomatic 30) crates/jcode-base/src/provider/mod.rs:1164 — MultiProvider::set_model_on_provider_with_credential_modes 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.
  • MultiProvider::set_model (cyclomatic 26) crates/jcode-base/src/provider/mod.rs:2165 — MultiProvider::set_model has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • MultiProvider::compute_fresh_session_pool_route (cyclomatic 22) crates/jcode-base/src/provider/startup.rs:517 — MultiProvider::compute_fresh_session_pool_route 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.
  • MultiProvider::model_switch_request_for_session_route (cyclomatic 21) crates/jcode-base/src/provider/selection.rs:472 — MultiProvider::model_switch_request_for_session_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: MultiProvider::default_model_selection_from_route (cyclomatic 29) 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.
  • MultiProvider::is_failover_route_pool_approved (cyclomatic 20) crates/jcode-base/src/provider/multi_provider.rs:7 — MultiProvider::is_failover_route_pool_approved 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.
  • MultiProvider::fresh_routes_memo_entry (cyclomatic 17) crates/jcode-base/src/provider/catalog_memo.rs:186 — MultiProvider::fresh_routes_memo_entry 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.
  • MultiProvider::complete_on_provider (cyclomatic 16) crates/jcode-base/src/provider/dispatch.rs:57 — MultiProvider::complete_on_provider has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (MultiProvider::complete_split_on_provider) 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.
  • MultiProvider::complete_split_on_provider (cyclomatic 16) crates/jcode-base/src/provider/dispatch.rs:183 — MultiProvider::complete_split_on_provider has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (MultiProvider::complete_on_provider) 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.
  • MultiProvider::fork_model_switch_request (cyclomatic 16) crates/jcode-base/src/provider/mod.rs:1747 — MultiProvider::fork_model_switch_request 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.
  • MultiProvider::model_switch_request_for_session_model (cyclomatic 16) crates/jcode-base/src/provider/selection.rs:371 — MultiProvider::model_switch_request_for_session_model has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: MultiProvider::default_model_selection_from_route (cyclomatic 29) 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.
D2 · Cognitive Complexity · jcode_tui_markdown · ×14
  • jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls (cognitive 250) crates/jcode-tui-markdown/src/markdown_render_full.rs:24 — jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls has cognitive complexity 250 (threshold 15). Drivers by points: if/else 78 (183 pts), match/switch 10 (31 pts), loops 7 (19 pts), boolean chains 17 (nesting depth added 138). 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.
  • jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls (cognitive 243) crates/jcode-tui-markdown/src/markdown_render_lazy.rs:16 — jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls has cognitive complexity 243 (threshold 15). Drivers by points: if/else 75 (179 pts), match/switch 10 (31 pts), loops 5 (18 pts), boolean chains 15 (nesting depth added 138). 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.
  • jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines (cognitive 57) crates/jcode-tui-markdown/src/markdown_render_support.rs:10 — jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 5 (18 pts), boolean chains 5 (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.
  • jcode_tui_markdown::markdown_wrap::wrap_line (cognitive 55) crates/jcode-tui-markdown/src/markdown_wrap.rs:5 — jcode_tui_markdown::markdown_wrap::wrap_line has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (43 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_markdown::markdown_links::markdown_link_target (cognitive 54) crates/jcode-tui-markdown/src/markdown_links.rs:12 — jcode_tui_markdown::markdown_links::markdown_link_target has cognitive complexity 54 (threshold 15). Drivers by points: if/else 9 (43 pts), loops 4 (7 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.
  • jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars (cognitive 53) crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:3 — jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 6 (13 pts), boolean chains 9 (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.
  • jcode_tui_markdown::markdown_render_support::render_table_aligned (cognitive 52) crates/jcode-tui-markdown/src/markdown_render_support.rs:168 — jcode_tui_markdown::markdown_render_support::render_table_aligned has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 7 (17 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 30). 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.
  • jcode_tui_markdown::markdown_incremental::find_stable_split (cognitive 24) crates/jcode-tui-markdown/src/markdown_incremental.rs:448 — jcode_tui_markdown::markdown_incremental::find_stable_split has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, 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.
  • jcode_tui_markdown::markdown_text_preprocess::preserve_line_oriented_softbreaks (cognitive 23) crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:144 — jcode_tui_markdown::markdown_text_preprocess::preserve_line_oriented_softbreaks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 6, 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.
  • jcode_tui_markdown::markdown_render_support::wrap_table_cell (cognitive 21) crates/jcode-tui-markdown/src/markdown_render_support.rs:307 — jcode_tui_markdown::markdown_render_support::wrap_table_cell has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_markdown::markdown_wrap::balanced_wrap_breaks (cognitive 21) crates/jcode-tui-markdown/src/markdown_wrap.rs:459 — jcode_tui_markdown::markdown_wrap::balanced_wrap_breaks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 2 (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.
  • jcode_tui_markdown::recenter_structured_blocks_for_display (cognitive 18) crates/jcode-tui-markdown/src/lib.rs:925 — jcode_tui_markdown::recenter_structured_blocks_for_display has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 4 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • jcode_tui_markdown::normalize_block_separators (cognitive 17) crates/jcode-tui-markdown/src/lib.rs:404 — jcode_tui_markdown::normalize_block_separators has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2, 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.
  • jcode_tui_markdown::markdown_wrap::tokenize_balanced_wrap (cognitive 17) crates/jcode-tui-markdown/src/markdown_wrap.rs:381 — jcode_tui_markdown::markdown_wrap::tokenize_balanced_wrap has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×14
  • Edited copy of a member (18 corresponding lines) crates/jcode-base/src/session/prewarm.rs:100 — crates/jcode-base/src/session/prewarm.rs:100-117 | crates/jcode-storage/src/active_pids.rs:145-162 — 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) crates/jcode-tui/src/tui/ui_inline_image.rs:1111 — crates/jcode-tui/src/tui/ui_inline_image.rs:1111-1129 | crates/jcode-tui/src/tui/ui_prepare.rs:232-249 — 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) crates/jcode-base/src/prompt.rs:15 — crates/jcode-base/src/prompt.rs:15-32 | crates/jcode-base/src/prompt.rs:77-94 — 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/cli/dispatch.rs:1046 — src/cli/dispatch.rs:1046-1063 | src/cli/selfdev.rs:79-99 — 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) crates/jcode-tui/src/tui/app/helpers.rs:952 — crates/jcode-tui/src/tui/app/helpers.rs:952-971 | src/cli/ssh.rs:250-267 — 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/cli/acp.rs:1519 — src/cli/acp.rs:1519-1536 | src/cli/acp.rs:1538-1560 — 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) crates/jcode-base/src/memory/pending.rs:589 — crates/jcode-base/src/memory/pending.rs:589-612 | crates/jcode-base/src/memory/pending.rs:639-656 — 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) crates/jcode-app-core/src/ambient/prompt.rs:555 — crates/jcode-app-core/src/ambient/prompt.rs:555-573 | crates/jcode-base/src/provider_activity.rs:292-309 — 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) crates/jcode-base/src/auth/claude.rs:447 — crates/jcode-base/src/auth/claude.rs:447-464 | crates/jcode-base/src/auth/codex.rs:349-367 — 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) crates/jcode-base/src/session.rs:1601 — crates/jcode-base/src/session.rs:1601-1618 | crates/jcode-base/src/session.rs:1627-1650 — 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) crates/jcode-base/src/usage/accessors.rs:161 — crates/jcode-base/src/usage/accessors.rs:161-178 | crates/jcode-base/src/usage/accessors.rs:560-580 — 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) crates/jcode-tui/src/tui/ui.rs:1614 — crates/jcode-tui/src/tui/ui.rs:1614-1631 | crates/jcode-tui/src/tui/ui.rs:1707-1734 — 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) scripts/jcode_harbor_claude_agent.py:59 — scripts/jcode_harbor_claude_agent.py:59-78 | scripts/jcode_harbor_claude_agent.py:92-109 — 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) crates/jcode-tui/src/tui/ui_tests/basic/redraw_cadence.rs:15 — crates/jcode-tui/src/tui/ui_tests/basic/redraw_cadence.rs:15-32 | crates/jcode-tui/src/tui/ui_tests/basic/redraw_cadence.rs:262-281 — 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.
D3 · God Classes · TooManyFunctions · ×13
  • TooManyFunctions: jcode_base::auth::codex crates/jcode-base/src/auth/codex.rs:62 — TooManyFunctions — 44 free functions. The bar is 30 free functions; this is 14 over it, 1.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.
  • TooManyFunctions: jcode_telemetry_core::state_support crates/jcode-telemetry-core/src/state_support.rs:7 — TooManyFunctions — 40 free functions. The bar is 30 free functions; this is 10 over it, 1.33× 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: jcode_build_support::paths crates/jcode-build-support/src/paths.rs:14 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_logging crates/jcode-logging/src/lib.rs:67 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_tui_mermaid::mermaid_runtime crates/jcode-tui-mermaid/src/mermaid_runtime.rs:39 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_app_core::telemetry_state crates/jcode-app-core/src/telemetry_state.rs:7 — TooManyFunctions — 38 free functions. The bar is 30 free functions; this is 8 over it, 1.27× 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: jcode_base::auth::external crates/jcode-base/src/auth/external.rs:66 — TooManyFunctions — 36 free functions. The bar is 30 free functions; 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.
  • TooManyFunctions: jcode_base::auth::gemini crates/jcode-base/REDACTED:39 — 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: jcode_base::auth::cursor crates/jcode-base/src/auth/cursor.rs:93 — 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.
  • TooManyFunctions: jcode_tui_style::theme crates/jcode-tui-style/src/theme.rs:5 — 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.
  • TooManyFunctions: jcode_base::memory::pending crates/jcode-base/src/memory/pending.rs:72 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_tui::tui::keybind crates/jcode-tui/src/tui/keybind.rs:26 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: jcode_tui::tui::redraw_schedule crates/jcode-tui/src/tui/redraw_schedule.rs:43 — TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×13
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/jcode-app-core/src/agent/status.rs:77 — crates/jcode-app-core/src/agent/status.rs:77-119 | crates/jcode-app-core/src/agent/turn_execution.rs:1564-1670 | crates/jcode-app-core/src/tool/conversation_search.rs:83-234 | crates/jcode-base/src/memory_agent.rs:34-79 — 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) crates/jcode-app-core/src/server/comm_session.rs:33 — crates/jcode-app-core/src/server/comm_session.rs:33-46 | crates/jcode-app-core/src/server/swarm_persistence.rs:34-45 | crates/jcode-app-core/src/server/swarm_persistence.rs:47-58 | crates/jcode-base/src/usage/flight.rs:13-25 — 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) crates/jcode-app-core/src/tool/session_search.rs:866 — crates/jcode-app-core/src/tool/session_search.rs:866-907 | crates/jcode-app-core/src/tool/session_search.rs:938-974 | crates/jcode-app-core/src/tool/session_search.rs:1145-1183 | crates/jcode-app-core/src/tool/session_search.rs:1251-1320 — 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) crates/jcode-base/src/embedding_stub.rs:47 — crates/jcode-base/src/embedding_stub.rs:47-85 | crates/jcode-embedding/src/lib.rs:47-84 | crates/jcode-memory-types/src/graph.rs:50-87 | crates/jcode-memory-types/src/lib.rs:872-910 — 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) crates/jcode-core/src/panic_util.rs:1 — crates/jcode-core/src/panic_util.rs:1-9 | crates/jcode-pdf/src/lib.rs:22-30 | crates/jcode-tui-mermaid/src/lib.rs:194-202 | src/cli/terminal.rs:224-232 — 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) crates/jcode-tui-render/src/lib.rs:71 — crates/jcode-tui-render/src/lib.rs:71-110 | crates/jcode-tui-render/src/lib.rs:112-160 | crates/jcode-tui-render/src/swarm_tiles.rs:308-330 | crates/jcode-tui/src/tui/info_widget_usage.rs:453-480 — 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) crates/jcode-tui/src/tui/app/auth_account_picker.rs:466 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:466-746 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:748-881 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:274-324 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:330-385 — 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) crates/jcode-tui/src/tui/app/inline_interactive.rs:1161 — crates/jcode-tui/src/tui/app/inline_interactive.rs:1161-1399 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1498-1619 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1673-2140 | crates/jcode-tui/src/tui/app/inline_interactive.rs:2236-2391 — 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) crates/jcode-provider-doctor/src/provider_e2e.rs:402 — crates/jcode-provider-doctor/src/provider_e2e.rs:402-554 | crates/jcode-provider-doctor/src/provider_e2e.rs:618-848 | crates/jcode-provider-doctor/src/provider_e2e.rs:1018-1208 | crates/jcode-provider-doctor/src/provider_e2e.rs:1649-1858 — 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) scripts/check_code_size_budget.py:41 — scripts/check_code_size_budget.py:41-58 | scripts/check_panic_budget.py:40-55 | scripts/check_swallowed_error_budget.py:47-62 | scripts/check_test_size_budget.py:32-47 — 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) scripts/diagnose_idle_render_cost.py:114 — scripts/diagnose_idle_render_cost.py:114-124 | scripts/repro_input_flicker.py:125-135 | scripts/repro_input_lag.py:127-137 | scripts/repro_slash_flicker.py:121-131 — 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) scripts/diagnose_idle_render_cost.py:200 — scripts/diagnose_idle_render_cost.py:200-215 | scripts/repro_input_flicker.py:275-290 | scripts/repro_input_lag.py:249-264 | scripts/repro_slash_flicker.py:218-233 — 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) scripts/diagnose_idle_render_cost.py:220 — scripts/diagnose_idle_render_cost.py:220-237 | scripts/repro_input_flicker.py:295-317 | scripts/repro_input_lag.py:270-290 | scripts/repro_slash_flicker.py:238-255 — 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 · Duplicated block (10 lines × 3) · ×13
  • Duplicated block (10 lines × 3) crates/jcode-app-core/src/server/client_lifecycle.rs:1188 — crates/jcode-app-core/src/server/client_lifecycle.rs:1188-1202 | crates/jcode-app-core/src/server/client_lifecycle.rs:1298-1312 | crates/jcode-app-core/src/server/client_lifecycle.rs:2472-2481 — 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:1188` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 3) crates/jcode-app-core/src/usage_display.rs:117 — crates/jcode-app-core/src/usage_display.rs:117-126 | crates/jcode-base/src/usage/display.rs:124-133 | crates/jcode-tui-usage-overlay/src/lib.rs:732-741 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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) crates/jcode-app-core/src/usage_openai.rs:109 — crates/jcode-app-core/src/usage_openai.rs:109-118 | crates/jcode-base/src/usage/openai_helpers.rs:112-121 | crates/jcode-base/src/usage/openai_helpers.rs:123-132 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 `crates/jcode-app-core/src/usage_openai.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) crates/jcode-base/src/auth/antigravity.rs:542 — crates/jcode-base/src/auth/antigravity.rs:542-551 | crates/jcode-base/REDACTED:585-594 | crates/jcode-base/REDACTED:599-608 — before extracting anything, compare `crates/jcode-base/src/auth/antigravity.rs` and `crates/jcode-base/REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 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 `crates/jcode-base/src/auth/antigravity.rs:542` 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 × 3) crates/jcode-base/src/provider/dispatch.rs:94 — crates/jcode-base/src/provider/dispatch.rs:94-103 | crates/jcode-base/src/provider/dispatch.rs:124-133 | crates/jcode-base/src/provider/dispatch.rs:141-150 — 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 `crates/jcode-base/src/provider/dispatch.rs:94` 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) crates/jcode-tui-account-picker/src/overlay.rs:476 — crates/jcode-tui-account-picker/src/overlay.rs:476-485 | crates/jcode-tui-usage-overlay/src/lib.rs:458-467 | crates/jcode-tui/src/tui/login_picker.rs:364-373 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 `crates/jcode-tui-account-picker/src/overlay.rs:476` 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) crates/jcode-tui-permissions/src/lib.rs:120 — crates/jcode-tui-permissions/src/lib.rs:120-129 | crates/jcode-tui-permissions/src/lib.rs:445-454 | crates/jcode-tui-permissions/src/lib.rs:474-483 — 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 `crates/jcode-tui-permissions/src/lib.rs:120` 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) crates/jcode-tui/src/tui/app/runtime_memory.rs:81 — crates/jcode-tui/src/tui/app/runtime_memory.rs:81-90 | crates/jcode-tui/src/tui/app/runtime_memory.rs:131-140 | crates/jcode-tui/src/tui/app/runtime_memory.rs:168-177 — 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 `crates/jcode-tui/src/tui/app/runtime_memory.rs:81` 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, `crates/jcode-tui/src/tui/app/runtime_memory.rs:179` calls `mark_attribution_heartbeat_pending` and `crates/jcode-tui/src/tui/app/runtime_memory.rs:141` 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) crates/jcode-tui/src/tui/ui_messages.rs:3568 — crates/jcode-tui/src/tui/ui_messages.rs:3568-3577 | crates/jcode-tui/src/tui/ui_messages.rs:3748-3757 | crates/jcode-tui/src/tui/ui_messages.rs:3775-3784 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) crates/jcode-provider-copilot/src/lib.rs:78 — crates/jcode-provider-copilot/src/lib.rs:78-87 | crates/jcode-provider-openai/src/request.rs:201-210 | crates/jcode-provider-openrouter/src/request.rs:81-90 — before extracting anything, compare `crates/jcode-provider-copilot/src/lib.rs` and `crates/jcode-provider-openrouter/src/request.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 × 3) crates/jcode-base/src/hooks.rs:370 — crates/jcode-base/src/hooks.rs:370-379 | crates/jcode-core/src/util.rs:5-15 | crates/jcode-import-core/src/lib.rs:20-29 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) src/cli/auth_test/types.rs:72 — src/cli/auth_test/types.rs:72-81 | src/cli/auth_test/types.rs:87-96 | src/cli/auth_test/types.rs:133-142 — 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/cli/auth_test/types.rs:72` 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 × 3) scripts/jcode_harbor_agent.py:289 — scripts/jcode_harbor_agent.py:289-298 | scripts/jcode_harbor_agent.py:306-315 | scripts/jcode_harbor_claude_agent.py:318-327 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 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 · Edited copy of a member (23 corresponding lines) · ×12
  • Edited copy of a member (23 corresponding lines) crates/jcode-tui/src/tui/info_widget_memory_utils.rs:4 — crates/jcode-tui/src/tui/info_widget_memory_utils.rs:4-26 | crates/jcode-tui/src/tui/info_widget_memory_utils.rs:47-71 — 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) crates/jcode-app-core/src/server/jade_relay.rs:328 — crates/jcode-app-core/src/server/jade_relay.rs:328-350 | crates/jcode-app-core/src/server/jade_relay.rs:682-704 — 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) crates/jcode-app-core/src/agent/turn_execution.rs:950 — crates/jcode-app-core/src/agent/turn_execution.rs:950-972 | crates/jcode-app-core/src/agent/turn_execution.rs:978-1006 — 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) crates/jcode-base/src/auth/antigravity.rs:414 — crates/jcode-base/src/auth/antigravity.rs:414-440 | crates/jcode-base/REDACTED:558-580 — 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) crates/jcode-base/src/memory_prompt.rs:121 — crates/jcode-base/src/memory_prompt.rs:121-143 | crates/jcode-base/src/memory_prompt.rs:238-260 — 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) crates/jcode-tui/src/tui/app/inline_interactive.rs:3449 — crates/jcode-tui/src/tui/app/inline_interactive.rs:3449-3480 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3482-3504 — 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) crates/jcode-base/src/auth/external.rs:539 — crates/jcode-base/src/auth/external.rs:539-561 | crates/jcode-base/src/auth/external.rs:567-593 — 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) crates/jcode-base/src/platform.rs:409 — crates/jcode-base/src/platform.rs:409-433 | crates/jcode-desktop-open/src/lib.rs:80-102 — 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) crates/jcode-app-core/src/server/comm_session.rs:152 — crates/jcode-app-core/src/server/comm_session.rs:152-174 | crates/jcode-app-core/src/server/jade_relay.rs:1144-1167 — 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) crates/jcode-tui/src/tui/app/auth_account_picker.rs:1184 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:1184-1206 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:186-208 — 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) scripts/bench_startup.py:169 — scripts/bench_startup.py:169-200 | scripts/profile_spawn.py:329-351 — 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) scripts/profile_remote_resume_burst.py:162 — scripts/profile_remote_resume_burst.py:162-190 | scripts/repro_expand_edit_shortcut.py:257-279 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×12
  • Duplicated block (6 lines × 3) crates/jcode-app-core/src/ambient/runner.rs:441 — crates/jcode-app-core/src/ambient/runner.rs:441-446 | crates/jcode-app-core/src/server/client_actions.rs:849-854 | crates/jcode-tui/src/tui/app/commands.rs:408-413 — before extracting anything, compare `crates/jcode-app-core/src/server/client_actions.rs` and `crates/jcode-tui/src/tui/app/commands.rs` as WHOLE FILES: this scan already matched 4 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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `parent` to `&Session` in one and `&crate::session::Session` 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 × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:177 — crates/jcode-provider-doctor/src/live_provider_probes.rs:177-182 | crates/jcode-provider-doctor/src/live_provider_probes.rs:246-251 | crates/jcode-provider-doctor/src/live_provider_probes.rs:361-366 — 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 (6 lines × 3) crates/jcode-tui/src/tui/app/observe.rs:182 — crates/jcode-tui/src/tui/app/observe.rs:182-187 | crates/jcode-tui/src/tui/app/split_view.rs:52-57 | crates/jcode-tui/src/tui/app/todos_view.rs:383-388 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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 `crates/jcode-tui/src/tui/app/observe.rs:182` 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) crates/jcode-tui/src/tui/ui_inline_image.rs:1097 — crates/jcode-tui/src/tui/ui_inline_image.rs:1097-1102 | crates/jcode-tui/src/tui/ui_inline_image.rs:1117-1122 | crates/jcode-tui/src/tui/ui_prepare.rs:237-242 — 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 (6 lines × 3) crates/jcode-app-core/src/server/durable_state.rs:7 — crates/jcode-app-core/src/server/durable_state.rs:7-12 | crates/jcode-app-core/src/server/swarm_persistence.rs:140-145 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:448-453 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) crates/jcode-provider-copilot-runtime/src/lib.rs:1006 — crates/jcode-provider-copilot-runtime/src/lib.rs:1006-1011 | crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:841-847 | crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:347-352 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) crates/jcode-tui-account-picker/src/overlay_render.rs:232 — crates/jcode-tui-account-picker/src/overlay_render.rs:232-237 | crates/jcode-tui-usage-overlay/src/lib.rs:656-661 | crates/jcode-tui/src/tui/login_picker.rs:613-618 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 × 3) crates/jcode-tui/src/tui/app/observe.rs:322 — crates/jcode-tui/src/tui/app/observe.rs:322-327 | crates/jcode-tui/src/tui/app/split_view.rs:343-348 | crates/jcode-tui/src/tui/app/todos_view.rs:913-918 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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) crates/jcode-tui/src/tui/app/remote/swarm_status_core.rs:36 — crates/jcode-tui/src/tui/app/remote/swarm_status_core.rs:36-41 | crates/jcode-tui/src/tui/info_widget_swarm_background.rs:125-130 | crates/jcode-tui/src/tui/info_widget_swarm_gallery.rs:20-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) crates/jcode-tui/src/tui/app/hotkey_feedback.rs:643 — crates/jcode-tui/src/tui/app/hotkey_feedback.rs:643-648 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:136-141 | crates/jcode-tui/src/tui/app/swarm_hint.rs:35-40 — 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.
  • Duplicated block (6 lines × 3) crates/jcode-app-core/src/server/client_session_tests/resume/live_events_before_history.rs:107 — crates/jcode-app-core/src/server/client_session_tests/resume/live_events_before_history.rs:107-112 | crates/jcode-app-core/src/server/client_session_tests/resume/live_events_before_history.rs:115-120 | crates/jcode-app-core/src/server/client_session_tests/resume/live_events_before_history.rs:122-127 — 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 (6 lines × 3) scripts/bench_headless_memory.py:150 — scripts/bench_headless_memory.py:150-155 | scripts/bench_headless_memory.py:241-246 | scripts/bench_headless_memory.py:473-478 — 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.
D2 · Cognitive Complexity · jcode_tui_mermaid · ×11
  • jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner (cognitive 57) crates/jcode-tui-mermaid/src/mermaid_widget.rs:334 — jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner has cognitive complexity 57 (threshold 15). Drivers by points: if/else 38 (50 pts), boolean chains 7 (nesting depth added 12). 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.
  • jcode_tui_mermaid::mermaid_inline::dimensions_from_header (cognitive 48) crates/jcode-tui-mermaid/src/mermaid_inline.rs:269 — jcode_tui_mermaid::mermaid_inline::dimensions_from_header has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 14, loops 1 (2 pts) (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.
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise (cognitive 48) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1355 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise has cognitive complexity 48 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 9, match/switch 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner (cognitive 46) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1030 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 6, match/switch 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal (cognitive 44) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1173 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal has cognitive complexity 44 (threshold 15). Drivers by points: if/else 29 (42 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.
  • jcode_tui_mermaid::mermaid_widget::render_image_widget (cognitive 41) crates/jcode-tui-mermaid/src/mermaid_widget.rs:81 — jcode_tui_mermaid::mermaid_widget::render_image_widget has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 7 (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.
  • jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame (cognitive 39) crates/jcode-tui-mermaid/src/mermaid_kitty_classic.rs:226 — jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 7 (11 pts), boolean chains 4, match/switch 1 (4 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.
  • jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport (cognitive 32) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:454 — jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 3 (6 pts), boolean chains 2, match/switch 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.
  • jcode_tui_mermaid::debug::debug_test_scroll (cognitive 29) crates/jcode-tui-mermaid/src/debug.rs:307 — jcode_tui_mermaid::debug::debug_test_scroll has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 2 (5 pts), boolean chains 3, loops 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.
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable (cognitive 18) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1205 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, boolean chains 4, match/switch 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.
  • jcode_tui_mermaid::mermaid_viewport::render_non_kitty_fit_stable (cognitive 17) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1062 — jcode_tui_mermaid::mermaid_viewport::render_non_kitty_fit_stable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3 (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, 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.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×11
  • Edited copy of a member (4 corresponding lines) src/bin/memory_recall_bench.rs:151 — src/bin/memory_recall_bench.rs:151-156 | src/cli/cloud_move.rs:2664-2667 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-app-core/src/server/turn_failover.rs:41 — crates/jcode-app-core/src/server/turn_failover.rs:41-44 | crates/jcode-tui/src/tui/app/model_context.rs:651-654 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-tui/src/tui/session_picker/transcript_search/text_cache.rs:148 — crates/jcode-tui/src/tui/session_picker/transcript_search/text_cache.rs:148-151 | crates/jcode-tui/src/tui/session_picker/transcript_search/token_cache.rs:228-231 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-tui/src/tui/ui_memory_estimates.rs:38 — crates/jcode-tui/src/tui/ui_memory_estimates.rs:38-41 | crates/jcode-tui/src/tui/ui_pinned.rs:217-220 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-app-core/src/perf.rs:501 — crates/jcode-app-core/src/perf.rs:501-504 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:906-910 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-base/src/client_focus.rs:12 — crates/jcode-base/src/client_focus.rs:12-15 | crates/jcode-schema-dialect/src/quirks.rs:94-97 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-app-core/src/tool/session_search.rs:565 — crates/jcode-app-core/src/tool/session_search.rs:565-568 | crates/jcode-tui/src/tui/app.rs:159-164 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) src/cli/commands/menubar.rs:527 — src/cli/commands/menubar.rs:527-530 | src/cli/macos_notification_broker.rs:96-100 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) crates/jcode-tui-style/src/color.rs:240 — crates/jcode-tui-style/src/color.rs:240-243 | crates/jcode-tui-workspace/src/color_support.rs:202-205 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) scripts/post_discord_release.py:103 — scripts/mock_sponsor_service.py:63-66 | scripts/post_discord_release.py:103-117 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) scripts/demo_shop.py:66 — scripts/demo_shop.py:66-70 | scripts/benchmark_discovery.py:735-738 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · jcode_tui_mermaid · ×10
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise (cyclomatic 36) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1355 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_viewport_precise 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.
  • jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner (cyclomatic 35) crates/jcode-tui-mermaid/src/mermaid_widget.rs:334 — jcode_tui_mermaid::mermaid_widget::render_image_widget_fit_inner has cyclomatic complexity 35 (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.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal (cyclomatic 31) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1173 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_sized_internal 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.
  • jcode_tui_mermaid::mermaid_inline::dimensions_from_header (cyclomatic 31) crates/jcode-tui-mermaid/src/mermaid_inline.rs:269 — jcode_tui_mermaid::mermaid_inline::dimensions_from_header 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.
  • jcode_tui_mermaid::mermaid_widget::render_image_widget (cyclomatic 28) crates/jcode-tui-mermaid/src/mermaid_widget.rs:81 — jcode_tui_mermaid::mermaid_widget::render_image_widget 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.
  • jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner (cyclomatic 24) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1030 — jcode_tui_mermaid::mermaid_cache_render::render_mermaid_deferred_inner 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.
  • jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame (cyclomatic 24) crates/jcode-tui-mermaid/src/mermaid_kitty_classic.rs:226 — jcode_tui_mermaid::mermaid_kitty_classic::finish_terminal_image_frame 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.
  • jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable (cyclomatic 18) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1205 — jcode_tui_mermaid::mermaid_viewport::render_image_widget_fit_stable 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.
  • jcode_tui_mermaid::debug::debug_test_scroll (cyclomatic 17) crates/jcode-tui-mermaid/src/debug.rs:307 — jcode_tui_mermaid::debug::debug_test_scroll 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.
  • jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport (cyclomatic 17) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:454 — jcode_tui_mermaid::mermaid_viewport::render_kitty_virtual_viewport 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.
D2 · Cognitive Complexity · jcode_tui_render · ×10
  • jcode_tui_render::swarm_gallery::render_swarm_strip_vertical (cognitive 121) crates/jcode-tui-render/src/swarm_gallery.rs:957 — jcode_tui_render::swarm_gallery::render_swarm_strip_vertical has cognitive complexity 121 (threshold 15). Drivers by points: if/else 53 (97 pts), loops 6 (13 pts), boolean chains 11 (nesting depth added 51). 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.
  • jcode_tui_render::swarm_gallery::render_swarm_strip (cognitive 93) crates/jcode-tui-render/src/swarm_gallery.rs:624 — jcode_tui_render::swarm_gallery::render_swarm_strip has cognitive complexity 93 (threshold 15). Drivers by points: if/else 41 (72 pts), loops 6 (11 pts), boolean chains 8, match/switch 1 (2 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.
  • jcode_tui_render::memory_tiles::render_memory_tiles (cognitive 59) crates/jcode-tui-render/src/memory_tiles.rs:413 — jcode_tui_render::memory_tiles::render_memory_tiles has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 8 (19 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 33). 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.
  • jcode_tui_render::swarm_gallery::hovered_detail_body (cognitive 49) crates/jcode-tui-render/src/swarm_gallery.rs:1705 — jcode_tui_render::swarm_gallery::hovered_detail_body has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 3 (8 pts), match/switch 2 (8 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.
  • jcode_tui_render::memory_tiles::memory_tile_content_lines (cognitive 38) crates/jcode-tui-render/src/memory_tiles.rs:217 — jcode_tui_render::memory_tiles::memory_tile_content_lines has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 3 (7 pts) (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.
  • jcode_tui_render::memory_tiles::parse_memory_display_entries (cognitive 23) crates/jcode-tui-render/src/memory_tiles.rs:38 — jcode_tui_render::memory_tiles::parse_memory_display_entries has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (21 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.
  • jcode_tui_render::swarm_tiles::render_swarm_gallery (cognitive 21) crates/jcode-tui-render/src/swarm_tiles.rs:353 — jcode_tui_render::swarm_tiles::render_swarm_gallery has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (6 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.
  • jcode_tui_render::truncate_line_to_width (cognitive 19) crates/jcode-tui-render/src/lib.rs:71 — jcode_tui_render::truncate_line_to_width has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 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.
  • jcode_tui_render::truncate_line_with_ellipsis_to_width (cognitive 19) crates/jcode-tui-render/src/lib.rs:112 — jcode_tui_render::truncate_line_with_ellipsis_to_width has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 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.
  • jcode_tui_render::swarm_gallery::render_swarm_dock (cognitive 16) crates/jcode-tui-render/src/swarm_gallery.rs:1282 — jcode_tui_render::swarm_gallery::render_swarm_dock has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 2, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×10
  • Edited copy of a member (29 corresponding lines) crates/jcode-render-core/src/math.rs:610 — crates/jcode-render-core/src/math.rs:610-638 | crates/jcode-render-core/src/preprocess.rs:662-690 — 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) crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:3 — crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:3-37 | crates/jcode-tui/src/tui/ui_tools/patch_summary.rs:39-67 — 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) crates/jcode-tui/src/tui/ui_messages.rs:2361 — crates/jcode-tui/src/tui/ui_messages.rs:2361-2389 | crates/jcode-tui/src/tui/ui_messages.rs:3118-3155 — 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) crates/jcode-tui-style/src/harmony.rs:375 — crates/jcode-tui-style/src/harmony.rs:375-403 | crates/jcode-tui-style/src/harmony.rs:664-698 — 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) crates/jcode-tui-mermaid/src/lib.rs:1075 — crates/jcode-tui-mermaid/src/lib.rs:1075-1103 | crates/jcode-tui-mermaid/src/lib.rs:1178-1207 — 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) crates/jcode-setup-hints/src/lib.rs:2212 — crates/jcode-setup-hints/src/lib.rs:2212-2248 | crates/jcode-setup-hints/src/windows_setup.rs:591-619 — 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) crates/jcode-app-core/src/server/comm_control.rs:2477 — crates/jcode-app-core/src/server/comm_control.rs:2477-2510 | crates/jcode-app-core/src/server/comm_sync.rs:399-427 — 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) crates/jcode-app-core/src/server/runtime.rs:155 — crates/jcode-app-core/src/server/runtime.rs:155-185 | crates/jcode-app-core/src/server/runtime.rs:191-219 — 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) crates/jcode-base/src/skill.rs:260 — crates/jcode-base/src/skill.rs:260-288 | crates/jcode-base/src/skill.rs:613-647 — 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) scripts/jcode_harbor_agent.py:203 — scripts/jcode_harbor_agent.py:203-231 | scripts/jcode_harbor_claude_agent.py:228-257 — 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 copy of a member (20 corresponding lines) · ×10
  • Edited copy of a member (20 corresponding lines) crates/jcode-tui/src/tui/app/debug.rs:436 — crates/jcode-tui/src/tui/app/debug.rs:436-455 | crates/jcode-tui/src/tui/memory_profile.rs:279-306 — 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) crates/jcode-app-core/src/session_window.rs:101 — crates/jcode-app-core/src/session_window.rs:101-127 | crates/jcode-tui/src/tui/window_visibility.rs:272-291 — 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) crates/jcode-base/src/auth/copilot.rs:585 — crates/jcode-base/src/auth/copilot.rs:585-609 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:104-123 — 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) crates/jcode-app-core/src/server/client_session.rs:45 — crates/jcode-app-core/src/server/client_session.rs:45-65 | crates/jcode-app-core/src/server/client_state.rs:718-737 — 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) crates/jcode-tui/src/tui/app/model_context.rs:394 — crates/jcode-tui/src/tui/app/model_context.rs:394-416 | crates/jcode-tui/src/tui/app/model_context.rs:669-688 — 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) crates/jcode-base/src/mcp/pool.rs:161 — crates/jcode-base/src/mcp/pool.rs:161-180 | crates/jcode-base/src/mcp/pool.rs:183-202 — 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) crates/jcode-tui-render/src/swarm_gallery_labels.rs:3 — crates/jcode-tui-render/src/swarm_gallery_labels.rs:3-24 | crates/jcode-tui/src/tui/ui_input.rs:2821-2840 — 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) crates/jcode-app-core/src/update.rs:1266 — crates/jcode-app-core/src/update.rs:1266-1285 | src/cli/hot_exec.rs:463-488 — 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) crates/jcode-tui/src/tui/app/commands.rs:160 — crates/jcode-tui/src/tui/app/commands.rs:160-179 | crates/jcode-tui/src/tui/app/commands_auto_poke_errors.rs:3-73 — 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) crates/jcode-base/src/auth/oauth_tests/openai_device_code.rs:7 — crates/jcode-base/src/auth/oauth_tests/openai_device_code.rs:7-29 | crates/jcode-base/src/auth/oauth_tests/openai_refresh_deadline.rs:10-29 — 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 (16–17 lines × 2) · ×10
  • Duplicated block (16–17 lines × 2) crates/jcode-base/src/platform.rs:410 — crates/jcode-base/src/platform.rs:410-426 | crates/jcode-desktop-open/src/lib.rs:81-96 — 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 `crates/jcode-base/src/platform.rs:410` 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 `cmd` to `&mut std::process::Command` in one and `&mut Command` 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 (16–17 lines × 2) crates/jcode-base/src/provider/dispatch.rs:84 — crates/jcode-base/src/provider/dispatch.rs:84-99 | crates/jcode-base/src/provider/dispatch.rs:222-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider/dispatch.rs:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) crates/jcode-base/src/provider/dispatch.rs:114 — crates/jcode-base/src/provider/dispatch.rs:114-129 | crates/jcode-base/src/provider/dispatch.rs:264-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider/dispatch.rs:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) crates/jcode-base/src/provider/dispatch.rs:131 — crates/jcode-base/src/provider/dispatch.rs:131-146 | crates/jcode-base/src/provider/dispatch.rs:287-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider/dispatch.rs:131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) crates/jcode-base/src/session.rs:1603 — crates/jcode-base/src/session.rs:1603-1618 | crates/jcode-base/src/session.rs:1634-1650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/session.rs:1603` 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–17 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:784 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:784-799 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:811-827 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/key_handling.rs:784` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) crates/jcode-tui/src/tui/ui.rs:2436 — crates/jcode-tui/src/tui/ui.rs:2436-2451 | crates/jcode-tui/src/tui/ui.rs:2457-2473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui.rs:2457` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16–17 lines × 2) crates/jcode-tui/src/tui/ui/copy_selection.rs:264 — crates/jcode-tui/src/tui/ui/copy_selection.rs:264-280 | crates/jcode-tui/src/tui/ui/copy_selection.rs:448-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui/copy_selection.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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) crates/jcode-tui/src/tui/ui_prepare.rs:2705 — crates/jcode-tui/src/tui/ui_prepare.rs:2705-2721 | crates/jcode-tui/src/tui/ui_prepare.rs:2836-2851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_prepare.rs:2705` 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–17 lines × 2) crates/jcode-embedding/src/lib.rs:144 — crates/jcode-embedding/src/lib.rs:144-160 | crates/jcode-embedding/src/lib.rs:302-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.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×10
  • Duplicated block (8 lines × 3) crates/jcode-app-core/src/tool/agentgrep/context.rs:839 — crates/jcode-app-core/src/tool/agentgrep/context.rs:839-846 | crates/jcode-app-core/src/tool/agentgrep/context.rs:856-863 | crates/jcode-app-core/src/tool/agentgrep/context.rs:874-881 — 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 `crates/jcode-app-core/src/tool/agentgrep/context.rs:839` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `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 first that the copies are not typed on the same thing: the declarations holding them bind `known` to `AgentGrepKnownFile` in one and `AgentGrepKnownRegion` 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 × 3) crates/jcode-base/src/auth/mod.rs:280 — crates/jcode-base/src/auth/mod.rs:280-287 | crates/jcode-base/src/auth/mod.rs:309-316 | crates/jcode-base/src/auth/mod.rs:385-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. 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 (8 lines × 3) crates/jcode-core/src/panic_util.rs:2 — crates/jcode-core/src/panic_util.rs:2-9 | crates/jcode-tui-mermaid/src/lib.rs:195-202 | src/cli/terminal.rs:225-232 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 3) crates/jcode-provider-anthropic-runtime/src/error_classification.rs:43 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:43-51 | crates/jcode-provider-copilot-runtime/src/routing.rs:38-45 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2000-2009 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) crates/jcode-tui/src/tui/app/hotkey_feedback.rs:651 — crates/jcode-tui/src/tui/app/hotkey_feedback.rs:651-658 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:144-151 | crates/jcode-tui/src/tui/app/swarm_hint.rs:43-50 — 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 `crates/jcode-tui/src/tui/app/hotkey_feedback.rs:651` 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 `state` to `&HotkeyUsageState` in one and `&ProficiencyState` 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 × 3) crates/jcode-tui/src/tui/ui_input.rs:2332 — crates/jcode-tui/src/tui/ui_input.rs:2332-2339 | crates/jcode-tui/src/tui/ui_overlays.rs:108-115 | crates/jcode-tui/src/tui/ui_viewport.rs:916-923 — 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 `crates/jcode-tui/src/tui/ui_input.rs:2332` 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) crates/jcode-tui/src/tui/app/observe.rs:193 — crates/jcode-tui/src/tui/app/observe.rs:193-200 | crates/jcode-tui/src/tui/app/split_view.rs:63-70 | crates/jcode-tui/src/tui/app/todos_view.rs:394-401 — before extracting anything, compare `crates/jcode-tui/src/tui/app/observe.rs` and `crates/jcode-tui/src/tui/app/split_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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 × 3) crates/jcode-tui/src/tui/app/state_ui_storage.rs:224 — crates/jcode-tui/src/tui/app/state_ui_storage.rs:224-231 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:290-313 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:360-387 — 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 `crates/jcode-tui/src/tui/app/state_ui_storage.rs:224` 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 (8 lines × 3) crates/jcode-app-core/src/server/debug_swarm_write.rs:256 — crates/jcode-app-core/src/server/debug_swarm_write.rs:256-263 | crates/jcode-app-core/src/server/debug_swarm_write.rs:345-352 | crates/jcode-app-core/src/server/debug_swarm_write.rs:448-455 — 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 (8 lines × 3) crates/jcode-app-core/src/server/comm_control.rs:1411 — crates/jcode-app-core/src/server/comm_control.rs:1411-1418 | crates/jcode-app-core/src/server/comm_control.rs:1466-1473 | crates/jcode-app-core/src/server/comm_plan.rs:528-535 — before extracting anything, compare `crates/jcode-app-core/src/server/comm_control.rs` and `crates/jcode-app-core/src/server/comm_plan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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 `crates/jcode-app-core/src/server/comm_control.rs:1411` 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, `crates/jcode-app-core/src/server/comm_plan.rs:538` calls `push` and `crates/jcode-app-core/src/server/comm_control.rs:1476` 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.
D2 · Cognitive Complexity · Agent · ×9
  • Agent::run_turn_streaming_mpsc (cognitive 448) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:14 — Agent::run_turn_streaming_mpsc has cognitive complexity 448 (threshold 15). Drivers by points: if/else 112 (340 pts), match/switch 15 (50 pts), loops 14 (43 pts), boolean chains 15 (nesting depth added 292). 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.
  • Agent::run_turn (cognitive 417) crates/jcode-app-core/src/agent/turn_loops.rs:45 — Agent::run_turn has cognitive complexity 417 (threshold 15). Drivers by points: if/else 113 (362 pts), match/switch 7 (23 pts), loops 7 (18 pts), boolean chains 14 (nesting depth added 276). 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.
  • Agent::repair_missing_tool_outputs (cognitive 32) crates/jcode-app-core/src/agent.rs:1069 — Agent::repair_missing_tool_outputs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 6 (10 pts), match/switch 2 (5 pts) (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.
  • Agent::extract_session_memories (cognitive 31) crates/jcode-app-core/src/agent/turn_execution.rs:1564 — Agent::extract_session_memories has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 4 (9 pts), loops 3 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Agent::repl (cognitive 26) crates/jcode-app-core/src/agent/turn_execution.rs:1476 — Agent::repl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 1, loops 1 (nesting depth added 14). 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.
  • Agent::export_conversation_markdown (cognitive 22) crates/jcode-app-core/src/agent/messages.rs:89 — Agent::export_conversation_markdown has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 2 (5 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.
  • Agent::validate_tool_allowed (cognitive 18) crates/jcode-app-core/src/agent/turn_execution.rs:1178 — Agent::validate_tool_allowed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (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, 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.
  • Agent::messages_for_provider (cognitive 18) crates/jcode-app-core/src/agent.rs:947 — Agent::messages_for_provider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Agent::seed_announced_skills_from_transcript (cognitive 16) crates/jcode-app-core/src/agent/turn_execution.rs:950 — Agent::seed_announced_skills_from_transcript has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_core · ×9
  • jcode_provider_core::models::open_weight_family_context_limit (cognitive 34) crates/jcode-provider-core/src/models.rs:365 — jcode_provider_core::models::open_weight_family_context_limit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 7 (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.
  • jcode_provider_core::model_names::pretty_picker_model_name (cognitive 24) crates/jcode-provider-core/src/model_names.rs:401 — jcode_provider_core::model_names::pretty_picker_model_name has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, match/switch 3 (4 pts), loops 2 (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.
  • jcode_provider_core::openai_schema::schema_supports_strict::check_map (cognitive 20) crates/jcode-provider-core/src/openai_schema.rs:43 — jcode_provider_core::openai_schema::schema_supports_strict::check_map has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, match/switch 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::reasoning::inferred_reasoning_efforts (cognitive 20) crates/jcode-provider-core/src/reasoning.rs:39 — jcode_provider_core::reasoning::inferred_reasoning_efforts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5 (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.
  • jcode_provider_core::model_names::pretty_picker_token (cognitive 19) crates/jcode-provider-core/src/model_names.rs:511 — jcode_provider_core::model_names::pretty_picker_token has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::ws_deflate::parse_extension_response (cognitive 18) crates/jcode-provider-core/src/ws_deflate.rs:62 — jcode_provider_core::ws_deflate::parse_extension_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (7 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_core::anthropic::anthropic_reasoning_caps (cognitive 17) crates/jcode-provider-core/src/anthropic.rs:343 — jcode_provider_core::anthropic::anthropic_reasoning_caps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), 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.
  • jcode_provider_core::models::context_limit_for_model_with_provider_and_cache (cognitive 17) crates/jcode-provider-core/src/models.rs:245 — jcode_provider_core::models::context_limit_for_model_with_provider_and_cache has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 5, match/switch 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.
  • jcode_provider_core::openai_schema::make_schema_nullable (cognitive 16) crates/jcode-provider-core/src/openai_schema.rs:193 — jcode_provider_core::openai_schema::make_schema_nullable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×9
  • Edited copy of a member (26 corresponding lines) crates/jcode-tui-account-picker/src/overlay.rs:374 — crates/jcode-tui-account-picker/src/overlay.rs:374-400 | crates/jcode-tui/src/tui/login_picker.rs:263-288 — 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) crates/jcode-app-core/src/tool/ambient.rs:435 — crates/jcode-app-core/src/tool/ambient.rs:435-460 | crates/jcode-tui-permissions/src/lib.rs:679-704 — 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) crates/jcode-app-core/src/agent/turn_execution.rs:41 — crates/jcode-app-core/src/agent/turn_execution.rs:41-72 | crates/jcode-app-core/src/agent/turn_execution.rs:83-108 — 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) crates/jcode-base/src/runtime_memory_log.rs:635 — crates/jcode-base/src/runtime_memory_log.rs:635-660 | crates/jcode-base/src/runtime_memory_log.rs:662-687 — 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) crates/jcode-sdk/src/client.rs:230 — crates/jcode-sdk/src/client.rs:230-259 | crates/jcode-sdk/src/client.rs:262-287 — 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) crates/jcode-tui-mermaid/src/mermaid_inline.rs:212 — crates/jcode-tui-mermaid/src/mermaid_inline.rs:212-237 | crates/jcode-tui-mermaid/src/mermaid_runtime.rs:743-769 — 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) crates/jcode-base/src/provider/models.rs:685 — crates/jcode-base/src/provider/models.rs:685-716 | crates/jcode-base/src/provider/models.rs:718-743 — 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/cli/provider_init.rs:1223 — src/cli/provider_init.rs:1223-1248 | src/cli/provider_init.rs:1275-1300 — 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) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1984 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1984-2020 | scripts/repro/tls-bad-record-mac/src/main.rs:68-93 — 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 (5 corresponding lines) · ×9
  • Edited copy of a member (5 corresponding lines) crates/jcode-tui/src/tui/ui_memory_estimates.rs:28 — crates/jcode-tui/src/tui/ui_memory_estimates.rs:28-32 | crates/jcode-tui/src/tui/ui_pinned.rs:207-211 — 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) crates/jcode-base/src/auth/codex.rs:623 — crates/jcode-base/src/auth/codex.rs:623-627 | crates/jcode-base/src/auth/cursor.rs:635-639 — 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) crates/jcode-tui-mermaid/src/lib.rs:71 — crates/jcode-tui-mermaid/src/lib.rs:71-78 | crates/jcode-tui-mermaid/src/mermaid_model.rs:148-152 — 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) crates/jcode-base/src/registry.rs:113 — crates/jcode-base/src/registry.rs:113-117 | crates/jcode-base/src/skill.rs:574-578 — 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) crates/jcode-base/src/provider/models.rs:198 — crates/jcode-base/src/provider/models.rs:198-203 | src/cli/commands.rs:403-407 — 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) crates/jcode-app-core/src/server/swarm_persistence.rs:237 — crates/jcode-app-core/src/server/swarm_persistence.rs:237-243 | crates/jcode-tui/src/tui/mod.rs:329-333 — 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) crates/jcode-base/src/auth/mod.rs:1552 — crates/jcode-base/src/auth/mod.rs:1552-1557 | crates/jcode-tui/src/tui/app/commands.rs:3138-3142 — 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) crates/jcode-core/src/id.rs:6 — crates/jcode-core/src/id.rs:6-10 | crates/jcode-memory-types/src/lib.rs:303-307 — 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) crates/jcode-app-core/src/server/state.rs:42 — crates/jcode-app-core/src/server/state.rs:42-46 | crates/jcode-base/src/auth/commands.rs:48-52 — 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 (21 lines × 2) · ×9
  • Duplicated block (21 lines × 2) crates/jcode-app-core/src/tool/discover.rs:612 — crates/jcode-app-core/src/tool/discover.rs:612-632 | crates/jcode-app-core/src/tool/discover.rs:638-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/discover.rs:612` 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) crates/jcode-base/src/provider/openrouter.rs:106 — crates/jcode-base/src/provider/openrouter.rs:106-126 | crates/jcode-provider-openrouter-runtime/src/lib.rs:111-131 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-base/src/provider/openrouter.rs:106` 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) crates/jcode-base/src/session.rs:816 — crates/jcode-base/src/session.rs:816-836 | crates/jcode-base/src/session.rs:876-896 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/session.rs:816` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) crates/jcode-base/src/usage/model.rs:10 — crates/jcode-base/src/usage/model.rs:10-30 | crates/jcode-tui/src/tui/app/helpers.rs:891-911 — 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 (21 lines × 2) crates/jcode-import-core/src/lib.rs:378 — crates/jcode-import-core/src/lib.rs:378-398 | crates/jcode-tui/src/tui/session_picker/loading.rs:722-742 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (21 lines × 2) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:658 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:658-678 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:683-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (21 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:222 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:222-242 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:464-484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_widget.rs:222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) crates/jcode-provider-copilot-runtime/src/lib.rs:111 — crates/jcode-provider-copilot-runtime/src/lib.rs:111-131 | crates/jcode-provider-copilot-runtime/src/lib.rs:148-168 — both copies are in the same file, so extract the 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 (21 lines × 2) scripts/profile_remote_resume_burst.py:162 — scripts/profile_remote_resume_burst.py:162-182 | scripts/profile_single_spawn.py:148-168 — before extracting anything, compare `scripts/profile_remote_resume_burst.py` and `scripts/profile_single_spawn.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 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 (11–12 lines × 2) · ×9
  • Duplicated block (11–12 lines × 2) crates/jcode-base/src/provider_activity_oauth.rs:175 — crates/jcode-base/src/provider_activity_oauth.rs:175-185 | crates/jcode-base/src/provider_activity_oauth.rs:283-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider_activity_oauth.rs:283` 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) crates/jcode-tui-markdown/src/markdown_render_full.rs:419 — crates/jcode-tui-markdown/src/markdown_render_full.rs:419-430 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:395-405 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:419` 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) crates/jcode-tui-mermaid/src/lib.rs:1092 — crates/jcode-tui-mermaid/src/lib.rs:1092-1103 | crates/jcode-tui-mermaid/src/lib.rs:1197-1207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/lib.rs:1092` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) crates/jcode-tui/src/tui/app/remote/server_events.rs:255 — crates/jcode-tui/src/tui/app/remote/server_events.rs:255-266 | crates/jcode-tui/src/tui/app/remote/server_events.rs:445-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/server_events.rs:255` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–12 lines × 2) crates/jcode-tui/src/tui/ui_header.rs:788 — crates/jcode-tui/src/tui/ui_header.rs:788-799 | crates/jcode-tui/src/tui/ui_header.rs:803-813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_header.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. 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/bin/memory_recall_bench.rs:520 — src/bin/memory_recall_bench.rs:520-531 | src/bin/memory_recall_bench.rs:2296-2306 — both copies are in the same file, so extract the 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/bin/memory_recall_bench.rs:878 — src/bin/memory_recall_bench.rs:878-889 | src/bin/memory_recall_bench.rs:1197-1207 — both copies are in the same file, so extract the 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/cli/commands/provider_setup.rs:473 — src/cli/commands/provider_setup.rs:473-484 | src/cli/commands/provider_setup.rs:488-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/commands/provider_setup.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.
  • Duplicated block (11–12 lines × 2) crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:512 — crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:512-522 | crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:528-539 — both copies are in the same file, so extract the 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 (9–10 lines × 2) · ×9
  • Duplicated block (9–10 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1868 — crates/jcode-app-core/src/server/client_session.rs:1868-1876 | crates/jcode-app-core/src/server/debug_session_admin.rs:207-216 — 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 `crates/jcode-app-core/src/server/debug_session_admin.rs:207` 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–10 lines × 2) crates/jcode-base/src/auth/google.rs:388 — crates/jcode-base/src/auth/google.rs:388-397 | crates/jcode-base/src/auth/oauth.rs:740-748 — 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 (9–10 lines × 2) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1995 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1995-2004 | scripts/repro/tls-bad-record-mac/src/main.rs:79-87 — 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) crates/jcode-tui/src/tui/app/input.rs:3766 — crates/jcode-tui/src/tui/app/input.rs:3766-3775 | crates/jcode-tui/src/tui/app/input.rs:3832-3840 — both copies are in the same file, so extract the 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 `super) fn clear_streaming_render_state(&mut` in one and `super) fn take_streaming_text(&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 (9–10 lines × 2) crates/jcode-tui/src/tui/session_picker/transcript_search/text_cache.rs:177 — crates/jcode-tui/src/tui/session_picker/transcript_search/text_cache.rs:177-185 | crates/jcode-tui/src/tui/session_picker/transcript_search/text_cache.rs:190-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–10 lines × 2) crates/jcode-tui/src/tui/ui_frame_metrics.rs:1243 — crates/jcode-tui/src/tui/ui_frame_metrics.rs:1243-1252 | crates/jcode-tui/src/tui/ui_header.rs:598-606 — 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 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) crates/jcode-tui/src/tui/ui_tests/inline_picker.rs:17 — crates/jcode-tui/src/tui/ui_tests/inline_picker.rs:17-26 | crates/jcode-tui/src/tui/ui_tests/onboarding.rs:17-25 — 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 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) scripts/bench_startup.py:170 — scripts/bench_startup.py:170-179 | scripts/profile_spawn.py:332-340 — 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 (9–10 lines × 2) scripts/profile_real_spawn.py:33 — scripts/profile_real_spawn.py:33-41 | scripts/repro_real_spawn_lag.py:149-158 — 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 `scripts/repro_real_spawn_lag.py:149` 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 (8–9 lines × 2) · ×9
  • Duplicated block (8–9 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:995 — crates/jcode-app-core/src/server/comm_control.rs:995-1003 | crates/jcode-app-core/src/server/comm_session.rs:1287-1294 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8–9 lines × 2) crates/jcode-app-core/src/server/provider_control.rs:186 — crates/jcode-app-core/src/server/provider_control.rs:186-193 | crates/jcode-tui/src/tui/app/model_context.rs:1066-1074 — 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–9 lines × 2) crates/jcode-app-core/src/session_window.rs:105 — crates/jcode-app-core/src/session_window.rs:105-113 | crates/jcode-tui/src/tui/window_visibility.rs:276-283 — 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–9 lines × 2) crates/jcode-base/src/memory/activity.rs:187 — crates/jcode-base/src/memory/activity.rs:187-194 | crates/jcode-base/src/memory/activity.rs:241-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/memory/activity.rs:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) crates/jcode-base/src/session/prewarm.rs:108 — crates/jcode-base/src/session/prewarm.rs:108-116 | crates/jcode-storage/src/active_pids.rs:98-105 — 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 `crates/jcode-base/src/session/prewarm.rs:108` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `pid` to `u32` in one and `u32) -> (usize` 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–9 lines × 2) crates/jcode-render-core/src/markdown.rs:504 — crates/jcode-render-core/src/markdown.rs:504-511 | crates/jcode-render-core/src/markdown.rs:519-527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-render-core/src/markdown.rs:504` 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) crates/jcode-tui/src/tui/app/debug.rs:369 — crates/jcode-tui/src/tui/app/debug.rs:369-376 | crates/jcode-tui/src/tui/memory_profile.rs:211-219 — before extracting anything, compare `crates/jcode-tui/src/tui/app/debug.rs` and `crates/jcode-tui/src/tui/memory_profile.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/debug.rs:369` 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–9 lines × 2) crates/jcode-tui/src/tui/app/turn.rs:255 — crates/jcode-tui/src/tui/app/turn.rs:255-262 | crates/jcode-tui/src/tui/app/turn.rs:350-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/turn.rs:255` 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, `crates/jcode-tui/src/tui/app/turn.rs:359` calls `flush_smooth_frame`, `apply_stream_ops`, `poll_compaction_completion` and `crates/jcode-tui/src/tui/app/turn.rs:263` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–9 lines × 2) src/bin/memory_recall_bench.rs:2611 — src/bin/memory_recall_bench.rs:2611-2619 | src/bin/memory_recall_bench.rs:2621-2628 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/bin/memory_recall_bench.rs:2611` 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 (8 lines × 4) · ×9
  • Duplicated block (8 lines × 4) crates/jcode-app-core/src/server/debug_swarm_read.rs:416 — crates/jcode-app-core/src/server/debug_swarm_read.rs:416-423 | crates/jcode-app-core/src/server/debug_swarm_read.rs:456-463 | crates/jcode-app-core/src/server/debug_swarm_read.rs:482-489 | crates/jcode-app-core/src/server/debug_swarm_read.rs:517-524 — 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, `crates/jcode-app-core/src/server/debug_swarm_read.rs:455` calls `contains` and `crates/jcode-app-core/src/server/debug_swarm_read.rs:415` 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 (8 lines × 4) crates/jcode-app-core/src/tool/read.rs:410 — crates/jcode-app-core/src/tool/read.rs:410-417 | crates/jcode-base/src/provider/image_clamp.rs:413-420 | crates/jcode-terminal-image/src/display.rs:238-245 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:280-287 — before extracting anything, compare `crates/jcode-app-core/src/tool/read.rs` and `crates/jcode-base/src/provider/image_clamp.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/tool/read.rs:410` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1244 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1244-1251 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1309-1316 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1341-1348 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1351-1358 — 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 `crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1244` 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 × 4) crates/jcode-tui/src/tui/app/inline_interactive.rs:1212 — crates/jcode-tui/src/tui/app/inline_interactive.rs:1212-1219 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1528-1535 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1686-1693 | crates/jcode-tui/src/tui/app/inline_interactive.rs:2259-2266 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 4) crates/jcode-app-core/src/mobile_push.rs:676 — crates/jcode-app-core/src/mobile_push.rs:676-683 | crates/jcode-app-core/src/server/background_tasks.rs:712-719 | crates/jcode-tui/src/tui/app/turn_notify.rs:373-380 | crates/jcode-tui/src/tui/ui_input.rs:1835-1842 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
  • Duplicated block (8 lines × 4) crates/jcode-core/src/panic_util.rs:2 — crates/jcode-core/src/panic_util.rs:2-9 | crates/jcode-pdf/src/lib.rs:23-30 | crates/jcode-tui-mermaid/src/lib.rs:195-202 | src/cli/terminal.rs:225-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times. 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 `payload` to `&(dyn std::any::Any + Send)` in one and `&Box<dyn std::any::Any + Send>` 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 × 4) scripts/check_code_size_budget.py:41 — scripts/check_code_size_budget.py:41-48 | scripts/check_panic_budget.py:40-47 | scripts/check_swallowed_error_budget.py:47-54 | scripts/check_test_size_budget.py:32-39 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 4) scripts/diagnose_idle_render_cost.py:227 — scripts/diagnose_idle_render_cost.py:227-234 | scripts/repro_input_flicker.py:305-312 | scripts/repro_input_lag.py:280-287 | scripts/repro_slash_flicker.py:245-252 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 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, `scripts/repro_input_flicker.py:304` calls `setdefault` and `scripts/diagnose_idle_render_cost.py:226` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) scripts/diagnose_idle_render_cost.py:241 — scripts/diagnose_idle_render_cost.py:241-248 | scripts/repro_input_flicker.py:321-328 | scripts/repro_input_lag.py:294-301 | scripts/repro_slash_flicker.py:259-266 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeout_s` to `float = 60.0` in one and `float = 40.0` 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–8 lines × 2) · ×9
  • Duplicated block (7–8 lines × 2) crates/jcode-app-core/src/server/debug.rs:344 — crates/jcode-app-core/src/server/debug.rs:344-351 | crates/jcode-companion/src/server.rs:422-428 — 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 `crates/jcode-app-core/src/server/debug.rs:344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) crates/jcode-app-core/src/server/provider_control.rs:392 — crates/jcode-app-core/src/server/provider_control.rs:392-399 | crates/jcode-tui/src/tui/app/model_context.rs:133-139 — 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 (7–8 lines × 2) crates/jcode-base/src/memory_log.rs:416 — crates/jcode-base/src/memory_log.rs:416-422 | crates/jcode-logging/src/lib.rs:611-618 — 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 `crates/jcode-base/src/memory_log.rs:416` 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–8 lines × 2) crates/jcode-provider-openrouter/src/lib.rs:529 — crates/jcode-provider-openrouter/src/lib.rs:529-536 | crates/jcode-provider-openrouter/src/lib.rs:639-645 — both copies are in the same file, so extract the 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) crates/jcode-sdk/src/cloud.rs:177 — crates/jcode-sdk/src/cloud.rs:177-183 | src/cli/cloud_managed.rs:400-407 — 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 `crates/jcode-sdk/src/cloud.rs:177` 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 `reply` to `&ConnectReply` in one and `&Reply` 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–8 lines × 2) crates/jcode-tui-render/src/memory_tiles.rs:265 — crates/jcode-tui-render/src/memory_tiles.rs:265-271 | crates/jcode-tui-render/src/memory_tiles.rs:277-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-render/src/memory_tiles.rs:265` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:3637 — crates/jcode-tui/src/tui/app/inline_interactive.rs:3637-3644 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3682-3688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/inline_interactive.rs:3637` 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–8 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:739 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:739-746 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:764-770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/key_handling.rs:739` 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 (7–8 lines × 2) src/cli/login.rs:1113 — src/cli/login.rs:1113-1119 | src/cli/login/scriptable.rs:652-659 — 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/cli/login.rs:1113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×9
  • Duplicated block (7 lines × 3) crates/jcode-base/src/auth/codex.rs:542 — crates/jcode-base/src/auth/codex.rs:542-548 | crates/jcode-base/src/auth/codex.rs:555-561 | crates/jcode-base/src/auth/codex.rs:573-579 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) crates/jcode-provider-bedrock/src/lib.rs:420 — crates/jcode-provider-bedrock/src/lib.rs:420-426 | crates/jcode-schema-dialect/src/dialect.rs:368-374 | crates/jcode-schema-dialect/src/dialect.rs:544-550 — before extracting anything, compare `crates/jcode-provider-bedrock/src/lib.rs` and `crates/jcode-schema-dialect/src/dialect.rs` as WHOLE FILES: this scan already matched 3 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. 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 `crates/jcode-provider-bedrock/src/lib.rs:420` 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 × 3) crates/jcode-render-core/src/markdown.rs:199 — crates/jcode-render-core/src/markdown.rs:199-205 | crates/jcode-tui-markdown/src/markdown_render_full.rs:82-88 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:70-76 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 × 3) crates/jcode-tui/src/tui/app/turn.rs:429 — crates/jcode-tui/src/tui/app/turn.rs:429-435 | crates/jcode-tui/src/tui/app/turn.rs:488-494 | crates/jcode-tui/src/tui/app/turn.rs:1502-1508 — 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 `crates/jcode-tui/src/tui/app/turn.rs:429` 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, `crates/jcode-tui/src/tui/app/turn.rs:437` calls `display_turn_duration_secs` and `crates/jcode-tui/src/tui/app/turn.rs:496` 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) crates/jcode-base/src/session/memory_profile.rs:90 — crates/jcode-base/src/session/memory_profile.rs:90-96 | crates/jcode-tui/src/tui/app/debug.rs:374-380 | crates/jcode-tui/src/tui/memory_profile.rs:217-223 — before extracting anything, compare `crates/jcode-tui/src/tui/app/debug.rs` and `crates/jcode-tui/src/tui/memory_profile.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/session/memory_profile.rs:90` 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 × 3) crates/jcode-base/src/transcript_sample.rs:424 — crates/jcode-base/src/transcript_sample.rs:424-430 | crates/jcode-base/src/transcript_sample.rs:448-454 | crates/jcode-base/src/transcript_sample.rs:576-582 — 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 `crates/jcode-base/src/transcript_sample.rs:424` 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 × 3) crates/jcode-app-core/src/server/debug_command_exec.rs:456 — crates/jcode-app-core/src/server/debug_command_exec.rs:456-462 | crates/jcode-app-core/src/server/debug_command_exec.rs:498-504 | crates/jcode-app-core/src/server/debug_command_exec.rs:524-530 — 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 `crates/jcode-app-core/src/server/debug_command_exec.rs:456` 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 × 3) scripts/check_donut_animates_live.py:58 — scripts/check_donut_animates_live.py:58-64 | scripts/repro_slash_flicker.py:326-332 | scripts/verify_donut_still_animates.py:58-64 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/verify_donut_still_animates.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 × 3) scripts/jcode_harbor_agent.py:43 — scripts/jcode_harbor_agent.py:43-49 | scripts/jcode_harbor_claude_agent.py:45-51 | scripts/run_terminal_bench_campaign.py:37-43 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `candidates` to `tuple[str | None, ...]` in one and `list[str | None]` 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 (5 lines × 3) · ×9
  • Duplicated block (5 lines × 3) crates/jcode-app-core/src/server/client_actions.rs:797 — crates/jcode-app-core/src/server/client_actions.rs:797-804 | crates/jcode-app-core/src/server/client_actions.rs:844-848 | src/cli/cloud_session_ops.rs:53-57 — 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) crates/jcode-app-core/src/ssh_remote.rs:136 — crates/jcode-app-core/src/ssh_remote.rs:136-141 | crates/jcode-app-core/src/ssh_remote.rs:152-157 | crates/jcode-base/src/browser.rs:1177-1181 — 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 `crates/jcode-app-core/src/ssh_remote.rs:136` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-app-core/src/ssh_remote.rs:150` calls `arg` and `crates/jcode-app-core/src/ssh_remote.rs:134` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) crates/jcode-base/src/gmail.rs:568 — crates/jcode-base/src/gmail.rs:568-573 | crates/jcode-base/src/gmail.rs:628-632 | crates/jcode-base/src/gmail.rs:682-687 — 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) crates/jcode-base/src/session/prewarm.rs:107 — crates/jcode-base/src/session/prewarm.rs:107-112 | crates/jcode-storage/src/active_pids.rs:98-102 | crates/jcode-storage/src/active_pids.rs:152-157 — 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 `crates/jcode-base/src/session/prewarm.rs:107` 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) crates/jcode-app-core/src/usage_display.rs:171 — crates/jcode-app-core/src/usage_display.rs:171-175 | crates/jcode-base/src/usage/display.rs:178-184 | crates/jcode-tui-usage-overlay/src/lib.rs:775-781 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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 `crates/jcode-app-core/src/usage_display.rs:171` 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) crates/jcode-provider-openrouter-runtime/src/lib.rs:1483 — crates/jcode-provider-openrouter-runtime/src/lib.rs:1483-1487 | crates/jcode-provider-openrouter-runtime/src/lib.rs:1782-1786 | crates/jcode-provider-openrouter-runtime/src/lib.rs:2038-2042 — 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) scripts/check_code_size_budget.py:83 — scripts/check_code_size_budget.py:83-87 | scripts/check_panic_budget.py:82-86 | scripts/check_test_size_budget.py:72-76 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) scripts/check_code_size_budget.py:90 — scripts/check_code_size_budget.py:90-95 | scripts/check_panic_budget.py:89-93 | scripts/check_test_size_budget.py:79-83 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `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 (5 lines × 3) scripts/measure_animation_cpu_cost.py:145 — scripts/measure_animation_cpu_cost.py:145-149 | scripts/sweep_animation_fps.py:134-138 | scripts/why_no_animation_area.py:37-41 — before extracting anything, compare `scripts/measure_animation_cpu_cost.py` and `scripts/sweep_animation_fps.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 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, `scripts/measure_animation_cpu_cost.py:142` calls `add_argument` and `scripts/why_no_animation_area.py:36` 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.
D1 · Cyclomatic Complexity · jcode_tui_markdown · ×8
  • jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls (cyclomatic 149) crates/jcode-tui-markdown/src/markdown_render_full.rs:24 — jcode_tui_markdown::markdown_render_full::render_markdown_with_link_urls has cyclomatic complexity 149 (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.
  • jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls (cyclomatic 141) crates/jcode-tui-markdown/src/markdown_render_lazy.rs:16 — jcode_tui_markdown::markdown_render_lazy::render_markdown_lazy_with_link_urls has cyclomatic complexity 141 (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.
  • jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars (cyclomatic 29) crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:3 — jcode_tui_markdown::markdown_text_preprocess::escape_currency_dollars 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.
  • jcode_tui_markdown::markdown_wrap::wrap_line (cyclomatic 28) crates/jcode-tui-markdown/src/markdown_wrap.rs:5 — jcode_tui_markdown::markdown_wrap::wrap_line 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.
  • jcode_tui_markdown::markdown_links::markdown_link_target (cyclomatic 23) crates/jcode-tui-markdown/src/markdown_links.rs:12 — jcode_tui_markdown::markdown_links::markdown_link_target 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.
  • jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines (cyclomatic 21) crates/jcode-tui-markdown/src/markdown_render_support.rs:10 — jcode_tui_markdown::markdown_render_support::extract_copy_targets_from_rendered_lines 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.
  • jcode_tui_markdown::markdown_render_support::render_table_aligned (cyclomatic 21) crates/jcode-tui-markdown/src/markdown_render_support.rs:168 — jcode_tui_markdown::markdown_render_support::render_table_aligned 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.
  • jcode_tui_markdown::markdown_incremental::find_stable_split (cyclomatic 16) crates/jcode-tui-markdown/src/markdown_incremental.rs:448 — jcode_tui_markdown::markdown_incremental::find_stable_split 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 · jcode_provider_cursor_runtime · ×8
  • jcode_provider_cursor_runtime::agent_transport::run_agent_turn (cognitive 167) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:758 — jcode_provider_cursor_runtime::agent_transport::run_agent_turn has cognitive complexity 167 (threshold 15). Drivers by points: if/else 38 (111 pts), match/switch 9 (24 pts), loops 9 (23 pts), boolean chains 9 (nesting depth added 102). 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.
  • jcode_provider_cursor_runtime::wire::decode_exec_server_message (cognitive 149) crates/jcode-provider-cursor-runtime/src/wire.rs:691 — jcode_provider_cursor_runtime::wire::decode_exec_server_message has cognitive complexity 149 (threshold 15). Drivers by points: if/else 31 (77 pts), loops 15 (43 pts), boolean chains 27, match/switch 1 (2 pts) (nesting depth added 75). 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.
  • jcode_provider_cursor_runtime::wire::decode_google_protobuf_value (cognitive 53) crates/jcode-provider-cursor-runtime/src/wire.rs:207 — jcode_provider_cursor_runtime::wire::decode_google_protobuf_value has cognitive complexity 53 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 4 (12 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::wire::decode_cursor_args_map (cognitive 37) crates/jcode-provider-cursor-runtime/src/wire.rs:506 — jcode_provider_cursor_runtime::wire::decode_cursor_args_map has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 3 (15 pts), if/else 5 (14 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog (cognitive 33) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:376 — jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (2 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.
  • jcode_provider_cursor_runtime::wire::extract_checkpoint_used_tokens (cognitive 24) crates/jcode-provider-cursor-runtime/src/wire.rs:1106 — jcode_provider_cursor_runtime::wire::extract_checkpoint_used_tokens has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_cursor_runtime::agent_transport::extract_answer_text (cognitive 18) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:657 — jcode_provider_cursor_runtime::agent_transport::extract_answer_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_provider_cursor_runtime::agent_transport::extract_thinking_text) 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.
  • jcode_provider_cursor_runtime::agent_transport::extract_thinking_text (cognitive 18) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:682 — jcode_provider_cursor_runtime::agent_transport::extract_thinking_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_provider_cursor_runtime::agent_transport::extract_answer_text) 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 · jcode_command_risk · ×8
  • jcode_command_risk::tokenize::tokenize (cognitive 83) crates/jcode-command-risk/src/tokenize.rs:95 — jcode_command_risk::tokenize::tokenize has cognitive complexity 83 (threshold 15). Drivers by points: if/else 22 (68 pts), loops 4 (11 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 54). 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.
  • jcode_command_risk::assess_segment (cognitive 71) crates/jcode-command-risk/src/lib.rs:238 — jcode_command_risk::assess_segment has cognitive complexity 71 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 15, loops 7 (11 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_command_risk::tokenize::heredoc_delimiters (cognitive 56) crates/jcode-command-risk/src/tokenize.rs:397 — jcode_command_risk::tokenize::heredoc_delimiters has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (43 pts), boolean chains 8, loops 3 (5 pts) (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.
  • jcode_command_risk::assess_find (cognitive 37) crates/jcode-command-risk/src/lib.rs:446 — jcode_command_risk::assess_find has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_command_risk::paths::classify_target (cognitive 19) crates/jcode-command-risk/src/paths.rs:193 — jcode_command_risk::paths::classify_target has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6 (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.
  • jcode_command_risk::tokenize::embedded_substitutions (cognitive 18) crates/jcode-command-risk/src/tokenize.rs:266 — jcode_command_risk::tokenize::embedded_substitutions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 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.
  • jcode_command_risk::tokenize::scan_substitutions (cognitive 17) crates/jcode-command-risk/src/tokenize.rs:304 — jcode_command_risk::tokenize::scan_substitutions has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (7 pts), boolean chains 4, if/else 1 (4 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.
  • jcode_command_risk::tokenize::matching_paren_body (cognitive 17) crates/jcode-command-risk/src/tokenize.rs:354 — jcode_command_risk::tokenize::matching_paren_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (5 pts), 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.
D2 · Cognitive Complexity · jcode_provider_anthropic · ×8
  • jcode_provider_anthropic::format_messages_with_native (cognitive 76) crates/jcode-provider-anthropic/src/lib.rs:71 — jcode_provider_anthropic::format_messages_with_native has cognitive complexity 76 (threshold 15). Drivers by points: if/else 20 (52 pts), loops 8 (16 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 43). 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.
  • jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools (cognitive 54) crates/jcode-provider-anthropic/src/history_repair.rs:443 — jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (41 pts), loops 4 (6 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 33). 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.
  • jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results (cognitive 38) crates/jcode-provider-anthropic/src/history_repair.rs:244 — jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 4 (16 pts), if/else 7 (13 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::format_content_blocks_with_native (cognitive 34) crates/jcode-provider-anthropic/src/lib.rs:389 — jcode_provider_anthropic::format_content_blocks_with_native has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic::history_repair::hoist_late_tool_results (cognitive 33) crates/jcode-provider-anthropic/src/history_repair.rs:12 — jcode_provider_anthropic::history_repair::hoist_late_tool_results has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 6 (12 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.
  • jcode_provider_anthropic::history_repair::apply_tool_references (cognitive 27) crates/jcode-provider-anthropic/src/history_repair.rs:155 — jcode_provider_anthropic::history_repair::apply_tool_references has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 2 (5 pts), loops 3 (4 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.
  • jcode_provider_anthropic::add_message_cache_breakpoint (cognitive 24) crates/jcode-provider-anthropic/src/lib.rs:777 — jcode_provider_anthropic::add_message_cache_breakpoint has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (5 pts), match/switch 1 (4 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.
  • jcode_provider_anthropic::history_repair::answer_unpaired_tool_uses (cognitive 20) crates/jcode-provider-anthropic/src/history_repair.rs:351 — jcode_provider_anthropic::history_repair::answer_unpaired_tool_uses has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionPicker · ×8
  • SessionPicker::rebuild_items_inner (cognitive 58) crates/jcode-tui/src/tui/session_picker/filter.rs:449 — SessionPicker::rebuild_items_inner has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 10 (21 pts), boolean chains 9, match/switch 2 (4 pts) (nesting depth added 25). 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.
  • SessionPicker::render_session_list_impl (cognitive 54) crates/jcode-tui/src/tui/session_picker/render.rs:418 — SessionPicker::render_session_list_impl has cognitive complexity 54 (threshold 15). Drivers by points: if/else 38 (41 pts), boolean chains 9, match/switch 2 (4 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.
  • SessionPicker::run_with_session_updates (cognitive 45) crates/jcode-tui/src/tui/session_picker.rs:2417 — SessionPicker::run_with_session_updates has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 5 (18 pts), boolean chains 2, loops 1 (nesting depth added 25). 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.
  • SessionPicker::render_preview (cognitive 32) crates/jcode-tui/src/tui/session_picker.rs:1671 — SessionPicker::render_preview has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22 (25 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • SessionPicker::render_session_item_lines_at_frame (cognitive 29) crates/jcode-tui/src/tui/session_picker/render.rs:196 — SessionPicker::render_session_item_lines_at_frame has cognitive complexity 29 (threshold 15). Drivers by points: if/else 26 (28 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • SessionPicker::handle_overlay_key_inner (cognitive 28) crates/jcode-tui/src/tui/session_picker.rs:1514 — SessionPicker::handle_overlay_key_inner has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 7). 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.
  • SessionPicker::maybe_refresh_cloud_presence (cognitive 27) crates/jcode-tui/src/tui/session_picker/cloud_presence.rs:119 — SessionPicker::maybe_refresh_cloud_presence has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SessionPicker::highlight_spans (cognitive 25) crates/jcode-tui/src/tui/session_picker/render.rs:114 — SessionPicker::highlight_spans has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5 (10 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_import_core · ×8
  • jcode_import_core::extract_opencode_part_text (cognitive 33) crates/jcode-import-core/src/lib.rs:511 — jcode_import_core::extract_opencode_part_text has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (27 pts), boolean chains 3, match/switch 1 (2 pts), loops 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.
  • jcode_import_core::load_codex_external_session (cognitive 30) crates/jcode-import-core/src/lib.rs:643 — jcode_import_core::load_codex_external_session has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 1, loops 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.
  • jcode_import_core::ordered_claude_code_message_entries (cognitive 24) crates/jcode-import-core/src/lib.rs:288 — jcode_import_core::ordered_claude_code_message_entries has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (5 pts), boolean chains 4, match/switch 2 (4 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.
  • jcode_import_core::load_pi_external_session (cognitive 20) crates/jcode-import-core/src/lib.rs:734 — jcode_import_core::load_pi_external_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (2 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.
  • jcode_import_core::load_opencode_external_session (cognitive 20) crates/jcode-import-core/src/lib.rs:826 — jcode_import_core::load_opencode_external_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_import_core::tool_result_content_to_text (cognitive 18) crates/jcode-import-core/src/lib.rs:170 — jcode_import_core::tool_result_content_to_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). 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.
  • jcode_import_core::extract_external_text_from_json::visit (cognitive 18) crates/jcode-import-core/src/lib.rs:462 — jcode_import_core::extract_external_text_from_json::visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). 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.
  • jcode_import_core::extract_text_from_json_value::visit (cognitive 17) crates/jcode-import-core/src/lib.rs:1120 — jcode_import_core::extract_text_from_json_value::visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×8
  • Edited copy of a member (28 corresponding lines) crates/jcode-app-core/src/usage_display.rs:32 — crates/jcode-app-core/src/usage_display.rs:32-65 | crates/jcode-base/src/usage/display.rs:32-72 — 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) crates/jcode-tui/src/tui/ui_diagram_pane.rs:699 — crates/jcode-tui/src/tui/ui_diagram_pane.rs:699-726 | crates/jcode-tui/src/tui/ui_pinned_layout.rs:339-382 — 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) crates/jcode-app-core/src/tool/computer/input.rs:160 — crates/jcode-app-core/src/tool/computer/input.rs:160-187 | crates/jcode-app-core/src/tool/computer/input.rs:209-238 — 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) crates/jcode-app-core/src/server/client_lifecycle_logging.rs:10 — crates/jcode-app-core/src/server/client_lifecycle_logging.rs:10-40 | crates/jcode-tui/src/tui/backend.rs:591-618 — 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) crates/jcode-tui-render/src/swarm_gallery.rs:1614 — crates/jcode-tui-render/src/swarm_gallery.rs:1614-1641 | crates/jcode-tui/src/tui/info_widget_swarm_gallery.rs:480-508 — 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) crates/jcode-tui-tool-display/src/lib.rs:182 — crates/jcode-tui-tool-display/src/lib.rs:182-209 | crates/jcode-tui/src/tui/app/dictation.rs:461-492 — 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) crates/jcode-base/src/auth/mod.rs:1349 — crates/jcode-base/src/auth/mod.rs:1349-1378 | crates/jcode-base/src/auth/mod.rs:1380-1407 — 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) crates/jcode-tui/src/tui/ui_tests/pinned_todo_regressions.rs:5 — crates/jcode-tui/src/tui/ui_tests/pinned_todo_regressions.rs:5-32 | crates/jcode-tui/src/tui/ui_tests/prepare.rs:1200-1230 — 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 (24 corresponding lines) · ×8
  • Edited copy of a member (24 corresponding lines) crates/jcode-provider-copilot-runtime/src/lib.rs:109 — crates/jcode-provider-copilot-runtime/src/lib.rs:109-133 | crates/jcode-provider-copilot-runtime/src/lib.rs:147-170 — 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) crates/jcode-base/src/import.rs:1039 — crates/jcode-base/src/import.rs:1039-1062 | crates/jcode-tui/src/tui/session_picker/loading.rs:2367-2394 — 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) crates/jcode-tui-style/src/theme_mode.rs:78 — crates/jcode-tui-style/src/theme_mode.rs:78-106 | crates/jcode-tui/src/bin/replay_frames.rs:33-56 — 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) crates/jcode-app-core/src/server/client_api.rs:118 — crates/jcode-app-core/src/server/client_api.rs:118-141 | crates/jcode-app-core/src/server/client_api.rs:178-203 — 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) crates/jcode-tui/src/tui/ui_frame_metrics.rs:791 — crates/jcode-tui/src/tui/ui_frame_metrics.rs:791-814 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:1297-1323 — 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) crates/jcode-app-core/src/server/socket.rs:284 — crates/jcode-app-core/src/server/socket.rs:284-307 | src/cli/dispatch.rs:1092-1123 — 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) crates/jcode-tui/src/tui/app/input.rs:1947 — crates/jcode-tui/src/tui/app/input.rs:1947-1976 | crates/jcode-tui/src/tui/app/input.rs:2820-2843 — 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) crates/jcode-tui/src/tui/ui_frame_metrics.rs:665 — crates/jcode-tui/src/tui/ui_frame_metrics.rs:665-688 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:704-731 — 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 (21 corresponding lines) · ×8
  • Edited copy of a member (21 corresponding lines) crates/jcode-tui/src/tui/ui_header/account_router.rs:500 — crates/jcode-tui/src/tui/ui_header/account_router.rs:500-522 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:322-342 — 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) crates/jcode-tui-account-picker/src/overlay_render.rs:239 — crates/jcode-tui-account-picker/src/overlay_render.rs:239-260 | crates/jcode-tui/src/tui/login_picker.rs:620-640 — 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) crates/jcode-app-core/src/perf.rs:513 — crates/jcode-app-core/src/perf.rs:513-534 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:928-948 — 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) crates/jcode-tui-markdown/src/markdown_render_support.rs:354 — crates/jcode-tui-markdown/src/markdown_render_support.rs:354-374 | crates/jcode-tui-render/src/memory_tiles.rs:123-145 — 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) crates/jcode-app-core/src/agent/status.rs:143 — crates/jcode-app-core/src/agent/status.rs:143-166 | crates/jcode-app-core/src/agent/status.rs:176-196 — 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) crates/jcode-base/src/skill.rs:476 — crates/jcode-base/src/skill.rs:476-496 | crates/jcode-base/src/skill.rs:650-672 — 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) crates/jcode-app-core/src/server/provider_control.rs:1204 — crates/jcode-app-core/src/server/provider_control.rs:1204-1224 | crates/jcode-app-core/src/server/provider_control.rs:1231-1251 — 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) crates/jcode-tui/src/tui/ui_tests/inline_picker.rs:7 — crates/jcode-tui/src/tui/ui_tests/inline_picker.rs:7-27 | crates/jcode-tui/src/tui/ui_tests/onboarding.rs:7-27 — 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 · Duplicated block (20 lines × 2) · ×8
  • Duplicated block (20 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:3331 — crates/jcode-app-core/src/server/client_lifecycle.rs:3331-3350 | crates/jcode-app-core/src/server/client_lifecycle.rs:3437-3456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:3331` 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 (20 lines × 2) crates/jcode-app-core/src/server/comm_control.rs:1731 — crates/jcode-app-core/src/server/comm_control.rs:1731-1750 | crates/jcode-app-core/src/server/comm_control.rs:1774-1793 — both copies are in the same file, so extract the 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-app-core/src/server/comm_control.rs:1729` calls `Some`, `requester_owns_target` and `crates/jcode-app-core/src/server/comm_control.rs:1773` 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 (20 lines × 2) crates/jcode-base/src/background.rs:1017 — crates/jcode-base/src/background.rs:1017-1036 | crates/jcode-base/src/background.rs:1072-1091 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:72 — crates/jcode-tui-markdown/src/markdown_render_full.rs:72-91 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:60-79 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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, `crates/jcode-tui-markdown/src/markdown_render_full.rs:69` calls `default` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs:57` 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 (20 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:1049 — crates/jcode-tui-markdown/src/markdown_render_full.rs:1049-1068 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:962-981 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 (20 lines × 2) crates/jcode-tui/src/tui/app/auth.rs:803 — crates/jcode-tui/src/tui/app/auth.rs:803-822 | crates/jcode-tui/src/tui/app/auth.rs:1087-1106 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/jcode-tui/src/tui/app/remote.rs:503 — crates/jcode-tui/src/tui/app/remote.rs:503-522 | crates/jcode-tui/src/tui/app/remote.rs:1827-1846 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:530 — crates/jcode-provider-doctor/src/provider_e2e.rs:530-551 | crates/jcode-provider-doctor/src/provider_e2e.rs:826-845 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/provider_e2e.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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×8
  • Duplicated block (19 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1428 — crates/jcode-app-core/src/server/client_session.rs:1428-1446 | crates/jcode-app-core/src/server/client_session.rs:1619-1637 — both copies are in the same file, so extract the 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) crates/jcode-app-core/src/server/debug_swarm_write.rs:355 — crates/jcode-app-core/src/server/debug_swarm_write.rs:355-373 | crates/jcode-app-core/src/server/debug_swarm_write.rs:463-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/debug_swarm_write.rs:355` 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 (19 lines × 2) crates/jcode-app-core/src/usage_openai.rs:243 — crates/jcode-app-core/src/usage_openai.rs:243-261 | crates/jcode-base/src/usage/openai_helpers.rs:268-286 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (19 lines × 2) crates/jcode-base/src/auth/oauth.rs:1126 — crates/jcode-base/src/auth/oauth.rs:1126-1144 | crates/jcode-base/src/auth/oauth.rs:1277-1295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/auth/oauth.rs:1126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) crates/jcode-render-core/src/preprocess.rs:511 — crates/jcode-render-core/src/preprocess.rs:511-529 | crates/jcode-render-core/src/preprocess.rs:621-639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-render-core/src/preprocess.rs:511` 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, `crates/jcode-render-core/src/preprocess.rs:640` calls `push_str` and `crates/jcode-render-core/src/preprocess.rs:530` 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 (19 lines × 2) crates/jcode-telemetry-core/src/lib.rs:419 — crates/jcode-telemetry-core/src/lib.rs:419-437 | crates/jcode-telemetry-core/src/lib.rs:2077-2095 — both copies are in the same file, so extract the 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) crates/jcode-tui/src/video_export.rs:144 — crates/jcode-tui/src/video_export.rs:144-162 | crates/jcode-tui/src/video_export.rs:222-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/video_export.rs:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:42 — crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:42-60 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:127-145 — both copies are in the same file, so extract the 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 (12 lines × 3) · ×8
  • Duplicated block (12 lines × 3) crates/jcode-app-core/src/server/client_actions.rs:290 — crates/jcode-app-core/src/server/client_actions.rs:290-301 | crates/jcode-app-core/src/server/client_actions.rs:488-499 | crates/jcode-app-core/src/server/client_actions.rs:503-514 — 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 `crates/jcode-app-core/src/server/client_actions.rs:290` 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 × 3) crates/jcode-build-support/src/storage_helpers.rs:121 — crates/jcode-build-support/src/storage_helpers.rs:121-132 | crates/jcode-build-support/src/storage_helpers.rs:137-148 | crates/jcode-build-support/src/storage_helpers.rs:153-164 — 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 `crates/jcode-build-support/src/storage_helpers.rs:121` 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 × 3) crates/jcode-tui-account-picker/src/overlay.rs:463 — crates/jcode-tui-account-picker/src/overlay.rs:463-474 | crates/jcode-tui-usage-overlay/src/lib.rs:445-456 | crates/jcode-tui/src/tui/login_picker.rs:351-362 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 `crates/jcode-tui-account-picker/src/overlay.rs:463` 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 × 3) crates/jcode-tui/src/tui/app/turn.rs:890 — crates/jcode-tui/src/tui/app/turn.rs:890-901 | crates/jcode-tui/src/tui/app/turn.rs:1192-1203 | crates/jcode-tui/src/tui/app/turn.rs:1216-1227 — 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 `crates/jcode-tui/src/tui/app/turn.rs:890` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) crates/jcode-tui/src/tui/app/commands.rs:1112 — crates/jcode-tui/src/tui/app/commands.rs:1112-1123 | crates/jcode-tui/src/tui/app/commands.rs:3742-3754 | crates/jcode-tui/src/tui/app/commands.rs:3788-3799 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) crates/jcode-app-core/src/tool/discover.rs:1017 — crates/jcode-app-core/src/tool/discover.rs:1017-1028 | crates/jcode-app-core/src/tool/discover.rs:1208-1219 | crates/jcode-app-core/src/tool/discover.rs:1289-1300 — 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 `crates/jcode-app-core/src/tool/discover.rs:1017` 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) scripts/measure_animation_cpu_cost.py:102 — scripts/measure_animation_cpu_cost.py:102-113 | scripts/repro_real_spawn_lag.py:190-201 | scripts/sweep_animation_fps.py:93-104 — before extracting anything, compare `scripts/measure_animation_cpu_cost.py` and `scripts/sweep_animation_fps.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/measure_animation_cpu_cost.py:117` calls `round`, `load_average` and `scripts/sweep_animation_fps.py:108` 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 × 3) scripts/check_donut_animates_live.py:104 — scripts/check_donut_animates_live.py:104-115 | scripts/dump_fresh_spawn_screen.py:67-78 | scripts/verify_donut_still_animates.py:108-119 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/dump_fresh_spawn_screen.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×8
  • Duplicated block (10–11 lines × 2) crates/jcode-app-core/src/notifications.rs:807 — crates/jcode-app-core/src/notifications.rs:807-816 | crates/jcode-setup-hints/src/cli_launch_hints.rs:356-366 — before extracting anything, compare `crates/jcode-app-core/src/notifications.rs` and `crates/jcode-setup-hints/src/cli_launch_hints.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/notifications.rs:807` 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) crates/jcode-base/src/embedding_stub.rs:215 — crates/jcode-base/src/embedding_stub.rs:215-224 | crates/jcode-embedding/src/lib.rs:409-419 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 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 `crates/jcode-base/src/embedding_stub.rs:215` 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) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1068 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1068-1078 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1587-1596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1068` 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–11 lines × 2) crates/jcode-tui-markdown/src/markdown_render_support.rs:361 — crates/jcode-tui-markdown/src/markdown_render_support.rs:361-371 | crates/jcode-tui-render/src/memory_tiles.rs:131-140 — 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 `crates/jcode-tui-markdown/src/markdown_render_support.rs:361` 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, `crates/jcode-tui-render/src/memory_tiles.rs:141` calls `is_empty`, `push` and `crates/jcode-tui-markdown/src/markdown_render_support.rs:373` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 2) crates/jcode-tui-render/src/swarm_gallery.rs:397 — crates/jcode-tui-render/src/swarm_gallery.rs:397-407 | crates/jcode-tui-render/src/swarm_gallery.rs:452-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 (10–11 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2534 — crates/jcode-tui/src/tui/session_picker/loading.rs:2534-2544 | crates/jcode-tui/src/tui/session_picker/loading.rs:2618-2627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/session_picker/loading.rs:2534` 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) crates/jcode-tui/src/tui/ui_messages.rs:3745 — crates/jcode-tui/src/tui/ui_messages.rs:3745-3755 | crates/jcode-tui/src/tui/ui_messages.rs:3773-3782 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_messages.rs:3745` 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–11 lines × 2) crates/jcode-tui/src/tui/ui_viewport.rs:978 — crates/jcode-tui/src/tui/ui_viewport.rs:978-988 | crates/jcode-tui/src/tui/ui_viewport.rs:1176-1185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_viewport.rs:978` 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.
D1 · Cyclomatic Complexity · SessionPicker · ×7
  • SessionPicker::render_session_list_impl (cyclomatic 42) crates/jcode-tui/src/tui/session_picker/render.rs:418 — SessionPicker::render_session_list_impl has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SessionPicker::handle_overlay_key_inner (cyclomatic 37) crates/jcode-tui/src/tui/session_picker.rs:1514 — SessionPicker::handle_overlay_key_inner has cyclomatic complexity 37 (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.
  • SessionPicker::rebuild_items_inner (cyclomatic 34) crates/jcode-tui/src/tui/session_picker/filter.rs:449 — SessionPicker::rebuild_items_inner has cyclomatic complexity 34 (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.
  • SessionPicker::render_preview (cyclomatic 24) crates/jcode-tui/src/tui/session_picker.rs:1671 — SessionPicker::render_preview has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • SessionPicker::run_with_session_updates (cyclomatic 23) crates/jcode-tui/src/tui/session_picker.rs:2417 — SessionPicker::run_with_session_updates 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.
  • SessionPicker::handle_search_key (cyclomatic 21) crates/jcode-tui/src/tui/session_picker.rs:1398 — SessionPicker::handle_search_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.
  • SessionPicker::render_session_item_lines_at_frame (cyclomatic 19) crates/jcode-tui/src/tui/session_picker/render.rs:196 — SessionPicker::render_session_item_lines_at_frame 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.
D1 · Cyclomatic Complexity · jcode_provider_core · ×7
  • jcode_provider_core::pricing::openai_api_pricing_with_tier (cyclomatic 34) crates/jcode-provider-core/src/pricing.rs:161 — jcode_provider_core::pricing::openai_api_pricing_with_tier has cyclomatic complexity 34 (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.
  • jcode_provider_core::models::open_weight_family_context_limit (cyclomatic 32) crates/jcode-provider-core/src/models.rs:365 — jcode_provider_core::models::open_weight_family_context_limit 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.
  • jcode_provider_core::model_names::pretty_picker_model_name (cyclomatic 22) crates/jcode-provider-core/src/model_names.rs:401 — jcode_provider_core::model_names::pretty_picker_model_name has cyclomatic complexity 22 (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.
  • jcode_provider_core::openai_schema::schema_supports_strict::check_map (cyclomatic 20) crates/jcode-provider-core/src/openai_schema.rs:43 — jcode_provider_core::openai_schema::schema_supports_strict::check_map 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.
  • jcode_provider_core::model_names::pretty_picker_token (cyclomatic 17) crates/jcode-provider-core/src/model_names.rs:511 — jcode_provider_core::model_names::pretty_picker_token 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.
  • jcode_provider_core::models::context_limit_for_model_with_provider_and_cache (cyclomatic 17) crates/jcode-provider-core/src/models.rs:245 — jcode_provider_core::models::context_limit_for_model_with_provider_and_cache has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_provider_core::reasoning::inferred_reasoning_efforts (cyclomatic 16) crates/jcode-provider-core/src/reasoning.rs:39 — jcode_provider_core::reasoning::inferred_reasoning_efforts 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 · jcode_render_core · ×7
  • jcode_render_core::markdown::parse_markdown_with_options (cognitive 125) crates/jcode-render-core/src/markdown.rs:198 — jcode_render_core::markdown::parse_markdown_with_options has cognitive complexity 125 (threshold 15). Drivers by points: if/else 46 (104 pts), match/switch 4 (11 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 69). 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.
  • jcode_render_core::preprocess::normalize_latex_delimiters_and_environments (cognitive 99) crates/jcode-render-core/src/preprocess.rs:423 — jcode_render_core::preprocess::normalize_latex_delimiters_and_environments has cognitive complexity 99 (threshold 15). Drivers by points: if/else 32 (78 pts), boolean chains 16, match/switch 1 (4 pts), loops 1 (nesting depth added 49). 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.
  • jcode_render_core::preprocess::escape_currency_dollars (cognitive 72) crates/jcode-render-core/src/preprocess.rs:779 — jcode_render_core::preprocess::escape_currency_dollars has cognitive complexity 72 (threshold 15). Drivers by points: if/else 23 (49 pts), loops 6 (13 pts), boolean chains 10 (nesting depth added 33). 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.
  • jcode_render_core::wrap::wrap_line (cognitive 38) crates/jcode-render-core/src/wrap.rs:44 — jcode_render_core::wrap::wrap_line has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 3 (7 pts), boolean chains 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.
  • jcode_render_core::preprocess::normalize_math_fences (cognitive 25) crates/jcode-render-core/src/preprocess.rs:311 — jcode_render_core::preprocess::normalize_math_fences has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (4 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.
  • jcode_render_core::math::split_matrix (cognitive 18) crates/jcode-render-core/src/math.rs:661 — jcode_render_core::math::split_matrix has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_render_core::preprocess::stabilize_display_math (cognitive 18) crates/jcode-render-core/src/preprocess.rs:141 — jcode_render_core::preprocess::stabilize_display_math has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 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.
D2 · Cognitive Complexity · BedrockProvider · ×7
  • BedrockProvider::complete (cognitive 53) crates/jcode-provider-bedrock/src/lib.rs:1179 — BedrockProvider::complete has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (40 pts), match/switch 4 (11 pts), boolean chains 1, loops 1 (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.
  • BedrockProvider::refresh_catalog_with_client (cognitive 43) crates/jcode-provider-bedrock/src/lib.rs:1052 — BedrockProvider::refresh_catalog_with_client has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BedrockProvider::bedrock_input_schema (cognitive 39) crates/jcode-provider-bedrock/src/lib.rs:386 — BedrockProvider::bedrock_input_schema has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 5 (14 pts), boolean chains 1 (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.
  • BedrockProvider::classify_error_message (cognitive 22) crates/jcode-provider-bedrock/src/lib.rs:287 — BedrockProvider::classify_error_message has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • BedrockProvider::to_bedrock_messages (cognitive 21) crates/jcode-provider-bedrock/src/lib.rs:479 — BedrockProvider::to_bedrock_messages has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (8 pts), loops 1 (nesting depth added 11). 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.
  • BedrockProvider::all_display_models (cognitive 21) crates/jcode-provider-bedrock/src/lib.rs:1007 — BedrockProvider::all_display_models has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BedrockProvider::model_info (cognitive 19) crates/jcode-provider-bedrock/src/lib.rs:853 — BedrockProvider::model_info has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, 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.
D2 · Cognitive Complexity · jcode_setup_hints · ×7
  • jcode_setup_hints::windows_setup::windows_native_hotkey_loop (cognitive 36) crates/jcode-setup-hints/src/windows_setup.rs:436 — jcode_setup_hints::windows_setup::windows_native_hotkey_loop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 4, 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.
  • jcode_setup_hints::windows_setup::copilot_keyboard_hook (cognitive 34) crates/jcode-setup-hints/src/windows_setup.rs:384 — jcode_setup_hints::windows_setup::copilot_keyboard_hook has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (29 pts), boolean chains 5 (nesting depth added 21). 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.
  • jcode_setup_hints::windows_setup::run_setup_hotkey_windows (cognitive 31) crates/jcode-setup-hints/src/windows_setup.rs:968 — jcode_setup_hints::windows_setup::run_setup_hotkey_windows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (2 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.
  • jcode_setup_hints::keymap::conflicts::jcode_bindings (cognitive 25) crates/jcode-setup-hints/src/keymap/conflicts.rs:93 — jcode_setup_hints::keymap::conflicts::jcode_bindings has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (6 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.
  • jcode_setup_hints::run_setup_hotkey (cognitive 22) crates/jcode-setup-hints/src/lib.rs:689 — jcode_setup_hints::run_setup_hotkey has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (3 pts), match/switch 1 (2 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.
  • jcode_setup_hints::keymap::terminal::split_trigger_tokens (cognitive 17) crates/jcode-setup-hints/src/keymap/terminal.rs:96 — jcode_setup_hints::keymap::terminal::split_trigger_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_setup_hints::install_xfce_launch_hotkeys (cognitive 16) crates/jcode-setup-hints/src/lib.rs:2000 — jcode_setup_hints::install_xfce_launch_hotkeys has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, boolean chains 2 (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.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×7
  • Edited copy of a member (27 corresponding lines) crates/jcode-app-core/src/server/client_actions.rs:833 — crates/jcode-app-core/src/server/client_actions.rs:833-861 | crates/jcode-tui/src/tui/app/commands.rs:393-419 — 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/cli/login/device_login.rs:101 — src/cli/login/device_login.rs:101-134 | src/cli/login/device_login.rs:141-167 — 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) crates/jcode-provider-openrouter/src/lib.rs:528 — crates/jcode-provider-openrouter/src/lib.rs:528-557 | crates/jcode-provider-openrouter/src/lib.rs:637-663 — 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) crates/jcode-base/src/skill.rs:696 — crates/jcode-base/src/skill.rs:696-722 | crates/jcode-base/src/skill/invocation.rs:14-44 — 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) crates/jcode-tui-core/src/graph_topology.rs:119 — crates/jcode-tui-core/src/graph_topology.rs:119-145 | crates/jcode-tui-core/src/graph_topology.rs:151-178 — 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) crates/jcode-build-support/src/paths.rs:14 — crates/jcode-build-support/src/paths.rs:14-53 | crates/jcode-telemetry-core/src/state_support.rs:281-307 — 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) crates/jcode-harness-api/src/harness_api_tests/capability_coverage.rs:415 — crates/jcode-harness-api/src/harness_api_tests/capability_coverage.rs:415-441 | crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:527-558 — 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, 11+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-app-core/src/tool/agentgrep/context.rs:900 — crates/jcode-app-core/src/tool/agentgrep/context.rs:900-911 | crates/jcode-app-core/src/tool/agentgrep/context.rs:926-936 | crates/jcode-app-core/src/tool/agentgrep/context.rs:938-956 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-app-core/src/tool/computer/ax.rs:239 — crates/jcode-app-core/src/tool/computer/ax.rs:239-249 | crates/jcode-app-core/src/tool/computer/ax.rs:252-263 | crates/jcode-app-core/src/tool/computer/ax.rs:266-279 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-app-core/src/agent/utils.rs:29 — crates/jcode-app-core/src/agent/utils.rs:29-39 | crates/jcode-build-support/src/source_state.rs:157-168 | crates/jcode-build-support/src/source_state.rs:171-182 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-base/src/mcp/manager.rs:122 — crates/jcode-base/src/mcp/manager.rs:122-133 | crates/jcode-base/src/mcp/manager.rs:147-157 | crates/jcode-base/src/mcp/manager.rs:160-170 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-base/src/provider/mod.rs:2461 — crates/jcode-base/src/provider/mod.rs:2461-2471 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1652-1662 | crates/jcode-provider-copilot-runtime/src/lib.rs:1071-1084 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-tui-render/src/swarm_gallery.rs:41 — crates/jcode-tui-render/src/swarm_gallery.rs:41-51 | crates/jcode-tui/src/tui/info_widget_commits.rs:54-65 | crates/jcode-tui/src/tui/info_widget_memory_render.rs:682-693 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) crates/jcode-app-core/src/mobile_push.rs:384 — crates/jcode-app-core/src/mobile_push.rs:384-394 | crates/jcode-app-core/src/tool/webfetch.rs:200-211 | crates/jcode-app-core/src/tool/websearch.rs:677-688 — 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 · Duplicated block (24 lines × 2) · ×7
  • Duplicated block (24 lines × 2) crates/jcode-app-core/src/server/client_state.rs:1307 — crates/jcode-app-core/src/server/client_state.rs:1307-1330 | crates/jcode-app-core/src/server/comm_sync.rs:30-53 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-app-core/src/server/client_state.rs:1306` calls `read` and `crates/jcode-app-core/src/server/comm_sync.rs:29` 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 (24 lines × 2) crates/jcode-app-core/src/tool/computer/input.rs:161 — crates/jcode-app-core/src/tool/computer/input.rs:161-184 | crates/jcode-app-core/src/tool/computer/input.rs:210-233 — both copies are in the same file, so extract the 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 (24 lines × 2) crates/jcode-tui/src/tui/ui.rs:1113 — crates/jcode-tui/src/tui/ui.rs:1113-1136 | crates/jcode-tui/src/tui/ui.rs:1434-1457 — both copies are in the same file, so extract the 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 `key` to `&BodyCacheKey` in one and `&FullPrepCacheKey` 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 (24 lines × 2) crates/jcode-tui/src/tui/ui_pinned.rs:835 — crates/jcode-tui/src/tui/ui_pinned.rs:835-858 | crates/jcode-tui/src/tui/ui_pinned.rs:905-928 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_pinned.rs:835` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) crates/jcode-tui-style/src/color.rs:168 — crates/jcode-tui-style/src/color.rs:168-191 | crates/jcode-tui-workspace/src/color_support.rs:130-153 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 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 (24 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:910 — crates/jcode-provider-doctor/src/provider_e2e.rs:910-933 | crates/jcode-provider-doctor/src/provider_e2e.rs:2221-2244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/provider_e2e.rs:910` 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) scripts/profile_remote_resume_burst.py:93 — scripts/profile_remote_resume_burst.py:93-116 | scripts/profile_single_spawn.py:43-66 — before extracting anything, compare `scripts/profile_remote_resume_burst.py` and `scripts/profile_single_spawn.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `cwd` to `str = "."` in one and `str` 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 (23 lines × 2) · ×7
  • Duplicated block (23 lines × 2) crates/jcode-app-core/src/message_notifications.rs:23 — crates/jcode-app-core/src/message_notifications.rs:23-45 | crates/jcode-base/src/message/notifications.rs:84-106 — before extracting anything, compare `crates/jcode-app-core/src/message_notifications.rs` and `crates/jcode-base/src/message/notifications.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (23 lines × 2) crates/jcode-app-core/src/server/background_tasks.rs:135 — crates/jcode-app-core/src/server/background_tasks.rs:135-157 | crates/jcode-app-core/src/server/background_tasks.rs:222-244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/background_tasks.rs:135` 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) crates/jcode-app-core/src/tool/bg.rs:117 — crates/jcode-app-core/src/tool/bg.rs:117-139 | crates/jcode-tui/src/tui/ui_tools.rs:128-150 — 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 (23 lines × 2) crates/jcode-base/src/session.rs:360 — crates/jcode-base/src/session.rs:360-382 | crates/jcode-base/src/session.rs:401-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. Note what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only.
  • Duplicated block (23 lines × 2) crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1364 — crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1364-1386 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:342-364 — 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 `crates/jcode-tui-mermaid/src/mermaid_viewport.rs:1364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) crates/jcode-tui-anim/src/lib.rs:241 — crates/jcode-tui-anim/src/lib.rs:241-263 | crates/jcode-tui-anim/src/lib.rs:347-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-anim/src/lib.rs:241` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (23 lines × 2) scripts/repro_expand_edit_shortcut.py:198 — scripts/repro_expand_edit_shortcut.py:198-220 | scripts/repro_live_duplicate.py:168-190 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×7
  • Duplicated block (22 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1665 — crates/jcode-app-core/src/server/client_lifecycle.rs:1665-1686 | crates/jcode-app-core/src/server/client_lifecycle.rs:1948-1969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:1665` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (22 lines × 2) crates/jcode-provider-openrouter/src/lib.rs:570 — crates/jcode-provider-openrouter/src/lib.rs:570-591 | crates/jcode-provider-openrouter/src/lib.rs:604-625 — both copies are in the same file, so extract the 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, `crates/jcode-provider-openrouter/src/lib.rs:592` calls `is_empty` and `crates/jcode-provider-openrouter/src/lib.rs:626` 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 (22 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2723 — crates/jcode-tui/src/tui/session_picker/loading.rs:2723-2744 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:255-276 — before extracting anything, compare `crates/jcode-tui/src/tui/session_picker/loading.rs` and `crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.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. 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 (22 lines × 2) crates/jcode-tui/src/tui/ui.rs:1218 — crates/jcode-tui/src/tui/ui.rs:1218-1239 | crates/jcode-tui/src/tui/ui.rs:1243-1264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui.rs:1218` 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 (22 lines × 2) crates/jcode-tui/src/tui/ui_messages.rs:2567 — crates/jcode-tui/src/tui/ui_messages.rs:2567-2588 | crates/jcode-tui/src/tui/ui_messages.rs:2719-2740 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_messages.rs:2567` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (22 lines × 2) src/cli/commands.rs:267 — src/cli/commands.rs:267-288 | src/cli/commands.rs:489-510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/commands.rs:267` 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) crates/jcode-app-core/src/tool/conversation_search.rs:200 — crates/jcode-app-core/src/tool/conversation_search.rs:200-221 | crates/jcode-base/src/memory_agent.rs:54-75 — 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 `crates/jcode-app-core/src/tool/conversation_search.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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×7
  • Duplicated block (11 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:769 — crates/jcode-provider-doctor/src/live_provider_probes.rs:769-779 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1097-1107 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1288-1298 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.rs:769` 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, `crates/jcode-provider-doctor/src/live_provider_probes.rs:768` calls `build_native_claude_provider` and `crates/jcode-provider-doctor/src/live_provider_probes.rs:1287` 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 × 3) crates/jcode-base/src/prompt.rs:926 — crates/jcode-base/src/prompt.rs:926-936 | crates/jcode-base/src/prompt.rs:981-991 | crates/jcode-base/src/prompt.rs:1026-1036 — 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) crates/jcode-app-core/src/server/client_lifecycle.rs:920 — crates/jcode-app-core/src/server/client_lifecycle.rs:920-930 | crates/jcode-app-core/src/server/client_lifecycle.rs:1063-1074 | crates/jcode-app-core/src/server/client_lifecycle.rs:1085-1095 — 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:920` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) crates/jcode-tui/src/tui/app/auth.rs:1930 — crates/jcode-tui/src/tui/app/auth.rs:1930-1941 | crates/jcode-tui/src/tui/app/auth.rs:1974-1984 | crates/jcode-tui/src/tui/app/auth.rs:2054-2065 — 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 `crates/jcode-tui/src/tui/app/auth.rs:1930` 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) crates/jcode-tui/src/tui/ui_onboarding.rs:460 — crates/jcode-tui/src/tui/ui_onboarding.rs:460-470 | crates/jcode-tui/src/tui/ui_onboarding.rs:497-507 | crates/jcode-tui/src/tui/ui_onboarding.rs:527-537 — 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 `crates/jcode-tui/src/tui/ui_onboarding.rs:460` 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) scripts/diagnose_idle_render_cost.py:223 — scripts/diagnose_idle_render_cost.py:223-233 | scripts/repro_input_lag.py:276-286 | scripts/repro_slash_flicker.py:241-251 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_lag.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 179 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 × 3) scripts/diagnose_idle_render_cost.py:332 — scripts/diagnose_idle_render_cost.py:332-342 | scripts/profile_idle_donut.py:65-75 | scripts/repro_slash_flicker.py:361-371 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 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. 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.
D1 · Cyclomatic Complexity · Agent · ×6
  • Agent::run_turn_streaming_mpsc (cyclomatic 178) crates/jcode-app-core/src/agent/turn_streaming_mpsc.rs:14 — Agent::run_turn_streaming_mpsc has cyclomatic complexity 178 (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.
  • Agent::run_turn (cyclomatic 161) crates/jcode-app-core/src/agent/turn_loops.rs:45 — Agent::run_turn has cyclomatic complexity 161 (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.
  • Agent::extract_session_memories (cyclomatic 21) crates/jcode-app-core/src/agent/turn_execution.rs:1564 — Agent::extract_session_memories 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.
  • Agent::export_conversation_markdown (cyclomatic 16) crates/jcode-app-core/src/agent/messages.rs:89 — Agent::export_conversation_markdown 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.
  • Agent::validate_tool_allowed (cyclomatic 16) crates/jcode-app-core/src/agent/turn_execution.rs:1178 — Agent::validate_tool_allowed 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.
  • Agent::repair_missing_tool_outputs (cyclomatic 16) crates/jcode-app-core/src/agent.rs:1069 — Agent::repair_missing_tool_outputs 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 · jcode_schema_dialect · ×6
  • jcode_schema_dialect::dialect::walk (cognitive 50) crates/jcode-schema-dialect/src/dialect.rs:170 — jcode_schema_dialect::dialect::walk has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 5 (15 pts), boolean chains 6, loops 1 (2 pts) (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.
  • jcode_schema_dialect::dialect::flatten_top_level_combiners (cognitive 43) crates/jcode-schema-dialect/src/dialect.rs:331 — jcode_schema_dialect::dialect::flatten_top_level_combiners has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 5 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 25). 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.
  • jcode_schema_dialect::conformance::walk (cognitive 38) crates/jcode-schema-dialect/src/conformance.rs:144 — jcode_schema_dialect::conformance::walk has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (14 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_schema_dialect::dialect::flatten_all_combiners (cognitive 38) crates/jcode-schema-dialect/src/dialect.rs:424 — jcode_schema_dialect::dialect::flatten_all_combiners has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 4 (17 pts), loops 3 (12 pts), if/else 2 (8 pts), boolean chains 1 (nesting depth added 28). 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.
  • jcode_schema_dialect::dialect::merge_all_of_branches (cognitive 25) crates/jcode-schema-dialect/src/dialect.rs:498 — jcode_schema_dialect::dialect::merge_all_of_branches has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (7 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_schema_dialect::conformance::untyped_properties::walk (cognitive 17) crates/jcode-schema-dialect/src/conformance.rs:55 — jcode_schema_dialect::conformance::untyped_properties::walk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 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 · jcode_telemetry_core · ×6
  • jcode_telemetry_core::mark_tool_feature_usage (cognitive 38) crates/jcode-telemetry-core/src/lib.rs:1075 — jcode_telemetry_core::mark_tool_feature_usage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 2, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_telemetry_core::oauth_account::handle_in (cognitive 38) crates/jcode-telemetry-core/src/oauth_account.rs:310 — jcode_telemetry_core::oauth_account::handle_in has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 2 (3 pts), boolean chains 2 (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.
  • jcode_telemetry_core::record_tool_execution (cognitive 28) crates/jcode-telemetry-core/src/lib.rs:2662 — jcode_telemetry_core::record_tool_execution has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_telemetry_core::lifecycle::emit_lifecycle_event (cognitive 22) crates/jcode-telemetry-core/src/lifecycle.rs:3 — jcode_telemetry_core::lifecycle::emit_lifecycle_event has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, boolean chains 9, match/switch 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.
  • jcode_telemetry_core::session_outcome::infer_session_stop_reason (cognitive 22) crates/jcode-telemetry-core/src/session_outcome.rs:41 — jcode_telemetry_core::session_outcome::infer_session_stop_reason has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, boolean chains 8. 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.
  • jcode_telemetry_core::mark_tool_success_side_effects (cognitive 18) crates/jcode-telemetry-core/src/lib.rs:1179 — jcode_telemetry_core::mark_tool_success_side_effects has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (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 · jcode_sdk · ×6
  • jcode_sdk::launch::launch_instance (cognitive 34) crates/jcode-sdk/src/launch.rs:175 — jcode_sdk::launch::launch_instance has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 4 (7 pts), match/switch 3 (4 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.
  • jcode_sdk::launch::inherit_credentials (cognitive 30) crates/jcode-sdk/src/launch.rs:373 — jcode_sdk::launch::inherit_credentials has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (9 pts), boolean chains 3 (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.
  • jcode_sdk::client::spawn_reader (cognitive 21) crates/jcode-sdk/src/client.rs:1727 — jcode_sdk::client::spawn_reader has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (5 pts), 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.
  • jcode_sdk::client::global_session_workers::start_global_child (cognitive 20) crates/jcode-sdk/src/client/global_session_workers.rs:52 — jcode_sdk::client::global_session_workers::start_global_child has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 2 (3 pts), loops 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.
  • jcode_sdk::client::global_session_workers::discover_global_sessions (cognitive 16) crates/jcode-sdk/src/client/global_session_workers.rs:3 — jcode_sdk::client::global_session_workers::discover_global_sessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (4 pts), loops 2 (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.
  • jcode_sdk::structured::first_json_container (cognitive 16) crates/jcode-sdk/src/structured.rs:420 — jcode_sdk::structured::first_json_container has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D35 · Change Coupling · Change-coupling hub · ×6
  • Change-coupling hub: randomized.rs → client_api.rs, client_lifecycle.rs, translate.rs, backend.rs crates/jcode-protocol/src/protocol_tests/randomized.rs — `crates/jcode-protocol/src/protocol_tests/randomized.rs` changes together with 4 other files — `crates/jcode-app-core/src/server/client_api.rs`, `crates/jcode-app-core/src/server/client_lifecycle.rs`, `crates/jcode-harness-api-server/src/translate.rs`, `crates/jcode-tui/src/tui/backend.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: comm_requests.rs → client_lightweight_control.rs, comm_control.rs, comm_session.rs, communicate.rs crates/jcode-app-core/src/protocol_tests/comm_requests.rs — `crates/jcode-app-core/src/protocol_tests/comm_requests.rs` changes together with 4 other files — `crates/jcode-app-core/src/server/client_lightweight_control.rs`, `crates/jcode-app-core/src/server/comm_control.rs`, `crates/jcode-app-core/src/server/comm_session.rs`, `crates/jcode-app-core/src/tool/communicate.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: misc_events.rs → client_api.rs, client_lifecycle.rs, translate.rs, backend.rs crates/jcode-app-core/src/protocol_tests/misc_events.rs — `crates/jcode-app-core/src/protocol_tests/misc_events.rs` changes together with 4 other files — `crates/jcode-app-core/src/server/client_api.rs`, `crates/jcode-app-core/src/server/client_lifecycle.rs`, `crates/jcode-harness-api-server/src/translate.rs`, `crates/jcode-tui/src/tui/backend.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: comm_requests.rs → client_lightweight_control.rs, comm_control.rs, comm_session.rs, communicate.rs crates/jcode-protocol/src/protocol_tests/comm_requests.rs — `crates/jcode-protocol/src/protocol_tests/comm_requests.rs` changes together with 4 other files — `crates/jcode-app-core/src/server/client_lightweight_control.rs`, `crates/jcode-app-core/src/server/comm_control.rs`, `crates/jcode-app-core/src/server/comm_session.rs`, `crates/jcode-app-core/src/tool/communicate.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: lib.rs → display_summary.rs, hooks.rs, keybind.rs crates/jcode-config-types/src/lib.rs — `crates/jcode-config-types/src/lib.rs` changes together with 3 other files — `crates/jcode-base/src/config/display_summary.rs`, `crates/jcode-base/src/hooks.rs`, `crates/jcode-tui/src/tui/keybind.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: ui_overlays.rs → hotkey_feedback.rs, input.rs, key_handling.rs, info_widget_tips.rs crates/jcode-tui/src/tui/ui_overlays.rs — `crates/jcode-tui/src/tui/ui_overlays.rs` changes together with 4 other files — `crates/jcode-tui/src/tui/app/hotkey_feedback.rs`, `crates/jcode-tui/src/tui/app/input.rs`, `crates/jcode-tui/src/tui/app/remote/key_handling.rs`, `crates/jcode-tui/src/tui/info_widget_tips.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×6
  • Edited copy of a member (35 corresponding lines) crates/jcode-tui-core/src/keybind.rs:65 — crates/jcode-tui-core/src/keybind.rs:65-99 | crates/jcode-tui/src/tui/keybind.rs:588-625 — 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) crates/jcode-render-core/src/math.rs:193 — crates/jcode-render-core/src/math.rs:193-257 | crates/jcode-tui-core/src/korean_input.rs:23-60 — 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) crates/jcode-embedding/src/lib.rs:124 — crates/jcode-embedding/src/lib.rs:124-170 | crates/jcode-embedding/src/lib.rs:292-326 — 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/cli/login/scriptable.rs:729 — src/cli/login/scriptable.rs:729-771 | src/cli/login/scriptable.rs:776-810 — 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) crates/jcode-base/src/auth/antigravity.rs:294 — crates/jcode-base/src/auth/antigravity.rs:294-328 | crates/jcode-base/REDACTED:423-457 — 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) crates/jcode-telemetry-core/src/lib.rs:806 — crates/jcode-telemetry-core/src/lib.rs:806-840 | crates/jcode-telemetry-core/src/lib.rs:1855-1889 — 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 · Duplicated block (15 lines × 3) · ×6
  • Duplicated block (15 lines × 3) crates/jcode-app-core/src/tool/gmail.rs:382 — crates/jcode-app-core/src/tool/gmail.rs:382-396 | crates/jcode-app-core/src/tool/gmail.rs:462-476 | crates/jcode-app-core/src/tool/gmail.rs:535-549 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (15 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:796 — crates/jcode-provider-doctor/src/live_provider_probes.rs:796-810 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1124-1138 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1315-1329 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.rs:796` 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 (15 lines × 3) crates/jcode-tui/src/tui/app/auth_account_picker.rs:535 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:535-549 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:589-603 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:931-945 — 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 `crates/jcode-tui/src/tui/app/auth_account_picker.rs:535` 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 × 3) crates/jcode-tui/src/tui/app/model_context.rs:400 — crates/jcode-tui/src/tui/app/model_context.rs:400-414 | crates/jcode-tui/src/tui/app/model_context.rs:672-686 | crates/jcode-tui/src/tui/app/model_context.rs:935-949 — 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 `super) fn offer_fallback_after_error(&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 (15 lines × 3) crates/jcode-provider-doctor/src/provider_e2e.rs:451 — crates/jcode-provider-doctor/src/provider_e2e.rs:451-465 | crates/jcode-provider-doctor/src/provider_e2e.rs:744-758 | crates/jcode-provider-doctor/src/provider_e2e.rs:1735-1749 — 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 `crates/jcode-provider-doctor/src/provider_e2e.rs:451` 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 × 3) scripts/check_panic_budget.py:41 — scripts/check_panic_budget.py:41-55 | scripts/check_swallowed_error_budget.py:48-62 | scripts/check_test_size_budget.py:33-47 — before extracting anything, compare `scripts/check_panic_budget.py` and `scripts/check_swallowed_error_budget.py` as WHOLE FILES: this scan already matched 5 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. 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 (14–15 lines × 2) · ×6
  • Duplicated block (14–15 lines × 2) crates/jcode-app-core/src/agent/turn_execution.rs:1424 — crates/jcode-app-core/src/agent/turn_execution.rs:1424-1437 | crates/jcode-app-core/src/agent/turn_execution.rs:1453-1467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/agent/turn_execution.rs:1453` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) crates/jcode-app-core/src/server/provider_control.rs:203 — crates/jcode-app-core/src/server/provider_control.rs:203-217 | crates/jcode-app-core/src/server/provider_control.rs:316-329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/provider_control.rs:203` 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, `crates/jcode-app-core/src/server/provider_control.rs:315` calls `provider_model` and `crates/jcode-app-core/src/server/provider_control.rs:203` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) crates/jcode-app-core/src/tool/webfetch.rs:308 — crates/jcode-app-core/src/tool/webfetch.rs:308-321 | crates/jcode-app-core/src/tool/webfetch.rs:390-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/webfetch.rs:308` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14–15 lines × 2) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1231 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1231-1245 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1288-1301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1288` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1285` calls `Ok`, `remove` and `crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:1230` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) crates/jcode-tui/src/tui/info_widget_usage.rs:75 — crates/jcode-tui/src/tui/info_widget_usage.rs:75-89 | crates/jcode-tui/src/tui/info_widget_usage.rs:215-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.
  • Duplicated block (14–15 lines × 2) crates/jcode-tui/src/tui/ui_tests/pinned_todo_regressions.rs:11 — crates/jcode-tui/src/tui/ui_tests/pinned_todo_regressions.rs:11-24 | crates/jcode-tui/src/tui/ui_tests/prepare.rs:1204-1218 — 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 `crates/jcode-tui/src/tui/ui_tests/pinned_todo_regressions.rs:11` 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 (13–14 lines × 2) · ×6
  • Duplicated block (13–14 lines × 2) crates/jcode-app-core/src/server/group_transfer.rs:396 — crates/jcode-app-core/src/server/group_transfer.rs:396-408 | crates/jcode-app-core/src/server/group_transfer.rs:609-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/group_transfer.rs:609` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13–14 lines × 2) crates/jcode-app-core/src/tool/ambient.rs:436 — crates/jcode-app-core/src/tool/ambient.rs:436-449 | crates/jcode-tui-permissions/src/lib.rs:681-693 — 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 `crates/jcode-app-core/src/tool/ambient.rs:436` 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 `map` to `&Map<String, Value>` in one and `Option<&Map<String, 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 (13–14 lines × 2) crates/jcode-app-core/src/tool/session_search.rs:1380 — crates/jcode-app-core/src/tool/session_search.rs:1380-1392 | crates/jcode-app-core/src/tool/session_search.rs:1511-1524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/session_search.rs:1380` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) crates/jcode-base/src/embedding_stub.rs:191 — crates/jcode-base/src/embedding_stub.rs:191-203 | crates/jcode-embedding/src/lib.rs:388-401 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 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 `crates/jcode-base/src/embedding_stub.rs:191` 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–14 lines × 2) crates/jcode-tui/src/tui/session_picker.rs:534 — crates/jcode-tui/src/tui/session_picker.rs:534-547 | crates/jcode-tui/src/tui/session_picker.rs:777-789 — both copies are in the same file, so extract the 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–14 lines × 2) crates/jcode-tui/src/tui/ui_prepare.rs:2671 — crates/jcode-tui/src/tui/ui_prepare.rs:2671-2684 | crates/jcode-tui/src/tui/ui_prepare.rs:2802-2814 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_prepare.rs:2671` 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–13 lines × 2) · ×6
  • Duplicated block (12–13 lines × 2) crates/jcode-tui/src/tui/app/commands_desktop.rs:89 — crates/jcode-tui/src/tui/app/commands_desktop.rs:89-101 | src/cli/companion_autostart.rs:64-75 — 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–13 lines × 2) crates/jcode-tui/src/tui/app/runtime_memory.rs:129 — crates/jcode-tui/src/tui/app/runtime_memory.rs:129-141 | crates/jcode-tui/src/tui/app/runtime_memory.rs:166-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 `crates/jcode-tui/src/tui/app/runtime_memory.rs:129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/jcode-tui/src/tui/app/runtime_memory.rs:177` calls `append_runtime_memory_sample`, `mark_attribution_heartbeat_pending` and `crates/jcode-tui/src/tui/app/runtime_memory.rs:141` 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–13 lines × 2) crates/jcode-tui/src/tui/ui_input.rs:949 — crates/jcode-tui/src/tui/ui_input.rs:949-960 | crates/jcode-tui/src/tui/ui_input.rs:1047-1059 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_input.rs:949` 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–13 lines × 2) src/cli/login/scriptable.rs:493 — src/cli/login/scriptable.rs:493-504 | src/cli/login/scriptable.rs:544-556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/login/scriptable.rs:493` 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 (12–13 lines × 2) crates/jcode-tui/src/tui/ui_inline.rs:72 — crates/jcode-tui/src/tui/ui_inline.rs:72-84 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:685-696 — 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 `crates/jcode-tui/src/tui/ui_inline.rs:72` 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 (12–13 lines × 2) scripts/diagnose_idle_render_cost.py:377 — scripts/diagnose_idle_render_cost.py:377-389 | scripts/repro_slash_flicker.py:414-425 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_slash_flicker.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D1 · Cyclomatic Complexity · jcode_render_core · ×5
  • jcode_render_core::markdown::parse_markdown_with_options (cyclomatic 87) crates/jcode-render-core/src/markdown.rs:198 — jcode_render_core::markdown::parse_markdown_with_options 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.
  • jcode_render_core::preprocess::normalize_latex_delimiters_and_environments (cyclomatic 50) crates/jcode-render-core/src/preprocess.rs:423 — jcode_render_core::preprocess::normalize_latex_delimiters_and_environments has cyclomatic complexity 50 (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.
  • jcode_render_core::preprocess::escape_currency_dollars (cyclomatic 36) crates/jcode-render-core/src/preprocess.rs:779 — jcode_render_core::preprocess::escape_currency_dollars 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.
  • jcode_render_core::math::split_matrix (cyclomatic 18) crates/jcode-render-core/src/math.rs:661 — jcode_render_core::math::split_matrix has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: jcode_render_core::math::command_symbol (cyclomatic 141) 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.
  • jcode_render_core::wrap::wrap_line (cyclomatic 16) crates/jcode-render-core/src/wrap.rs:44 — jcode_render_core::wrap::wrap_line 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 · jcode_command_risk · ×5
  • jcode_command_risk::assess_segment (cyclomatic 45) crates/jcode-command-risk/src/lib.rs:238 — jcode_command_risk::assess_segment 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.
  • jcode_command_risk::tokenize::tokenize (cyclomatic 36) crates/jcode-command-risk/src/tokenize.rs:95 — jcode_command_risk::tokenize::tokenize 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.
  • jcode_command_risk::tokenize::heredoc_delimiters (cyclomatic 31) crates/jcode-command-risk/src/tokenize.rs:397 — jcode_command_risk::tokenize::heredoc_delimiters 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.
  • jcode_command_risk::assess_find (cyclomatic 17) crates/jcode-command-risk/src/lib.rs:446 — jcode_command_risk::assess_find 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.
  • jcode_command_risk::paths::classify_target (cyclomatic 16) crates/jcode-command-risk/src/paths.rs:193 — jcode_command_risk::paths::classify_target 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 · jcode_telemetry_core · ×5
  • jcode_telemetry_core::mark_tool_feature_usage (cyclomatic 32) crates/jcode-telemetry-core/src/lib.rs:1075 — jcode_telemetry_core::mark_tool_feature_usage 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.
  • jcode_telemetry_core::session_outcome::infer_session_stop_reason (cyclomatic 23) crates/jcode-telemetry-core/src/session_outcome.rs:41 — jcode_telemetry_core::session_outcome::infer_session_stop_reason 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.
  • jcode_telemetry_core::lifecycle::emit_lifecycle_event (cyclomatic 22) crates/jcode-telemetry-core/src/lifecycle.rs:3 — jcode_telemetry_core::lifecycle::emit_lifecycle_event has cyclomatic complexity 22 (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.
  • jcode_telemetry_core::oauth_account::handle_in (cyclomatic 22) crates/jcode-telemetry-core/src/oauth_account.rs:310 — jcode_telemetry_core::oauth_account::handle_in 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.
  • jcode_telemetry_core::record_tool_execution (cyclomatic 16) crates/jcode-telemetry-core/src/lib.rs:2662 — jcode_telemetry_core::record_tool_execution 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 · jcode_provider_anthropic · ×5
  • jcode_provider_anthropic::format_messages_with_native (cyclomatic 31) crates/jcode-provider-anthropic/src/lib.rs:71 — jcode_provider_anthropic::format_messages_with_native 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.
  • jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools (cyclomatic 24) crates/jcode-provider-anthropic/src/history_repair.rs:443 — jcode_provider_anthropic::history_repair::repair_dangling_anthropic_server_tools 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.
  • jcode_provider_anthropic::format_content_blocks_with_native (cyclomatic 20) crates/jcode-provider-anthropic/src/lib.rs:389 — jcode_provider_anthropic::format_content_blocks_with_native 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.
  • jcode_provider_anthropic::history_repair::hoist_late_tool_results (cyclomatic 16) crates/jcode-provider-anthropic/src/history_repair.rs:12 — jcode_provider_anthropic::history_repair::hoist_late_tool_results 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.
  • jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results (cyclomatic 16) crates/jcode-provider-anthropic/src/history_repair.rs:244 — jcode_provider_anthropic::history_repair::rewrite_orphaned_tool_results has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · BedrockProvider · ×5
  • BedrockProvider::complete (cyclomatic 27) crates/jcode-provider-bedrock/src/lib.rs:1179 — BedrockProvider::complete 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.
  • BedrockProvider::classify_error_message (cyclomatic 22) crates/jcode-provider-bedrock/src/lib.rs:287 — BedrockProvider::classify_error_message has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • BedrockProvider::refresh_catalog_with_client (cyclomatic 22) crates/jcode-provider-bedrock/src/lib.rs:1052 — BedrockProvider::refresh_catalog_with_client 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.
  • BedrockProvider::model_info (cyclomatic 19) crates/jcode-provider-bedrock/src/lib.rs:853 — BedrockProvider::model_info 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.
  • BedrockProvider::bedrock_input_schema (cyclomatic 16) crates/jcode-provider-bedrock/src/lib.rs:386 — BedrockProvider::bedrock_input_schema 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 · BridgeState · ×5
  • BridgeState::legacy_event_to_api_inner (cognitive 187) crates/jcode-harness-api-server/src/translate.rs:1692 — BridgeState::legacy_event_to_api_inner has cognitive complexity 187 (threshold 15). Drivers by points: if/else 70 (141 pts), boolean chains 21, match/switch 10 (19 pts), loops 3 (6 pts) (nesting depth added 83). 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.
  • BridgeState::translate_request (cognitive 171) crates/jcode-harness-api-server/src/translate.rs:369 — BridgeState::translate_request has cognitive complexity 171 (threshold 15). Drivers by points: if/else 60 (118 pts), match/switch 17 (32 pts), boolean chains 16, loops 2 (5 pts) (nesting depth added 76). 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.
  • BridgeState::legacy_event_to_api (cognitive 28) crates/jcode-harness-api-server/src/translate.rs:1581 — BridgeState::legacy_event_to_api has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 4, match/switch 1 (nesting depth added 12). 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.
  • BridgeState::walk_files (cognitive 27) crates/jcode-harness-api-server/src/translate/session_files.rs:130 — BridgeState::walk_files has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (3 pts) (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.
  • BridgeState::search_session_text (cognitive 22) crates/jcode-harness-api-server/src/translate/session_files.rs:203 — BridgeState::search_session_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), boolean chains 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.
D2 · Cognitive Complexity · jcode_provider_openai · ×5
  • jcode_provider_openai::request::build_responses_input_with_logger (cognitive 167) crates/jcode-provider-openai/src/request.rs:195 — jcode_provider_openai::request::build_responses_input_with_logger has cognitive complexity 167 (threshold 15). Drivers by points: if/else 51 (130 pts), loops 11 (18 pts), match/switch 4 (13 pts), boolean chains 6 (nesting depth added 95). 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.
  • jcode_provider_openai::stream::parse_openai_response_event (cognitive 56) crates/jcode-provider-openai/src/stream.rs:326 — jcode_provider_openai::stream::parse_openai_response_event has cognitive complexity 56 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 7, match/switch 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai::citations::render_annotated_text (cognitive 52) crates/jcode-provider-openai/src/citations.rs:8 — jcode_provider_openai::citations::render_annotated_text has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (37 pts), loops 5 (8 pts), boolean chains 5, match/switch 1 (2 pts) (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.
  • jcode_provider_openai::stream::handle_openai_output_item (cognitive 36) crates/jcode-provider-openai/src/stream.rs:640 — jcode_provider_openai::stream::handle_openai_output_item has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 6, loops 2 (6 pts), match/switch 1 (nesting depth added 17). 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.
  • jcode_provider_openai::request::insert_additional_tools (cognitive 20) crates/jcode-provider-openai/src/request.rs:87 — jcode_provider_openai::request::insert_additional_tools has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_openai_runtime · ×5
  • jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked (cognitive 153) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:539 — jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked has cognitive complexity 153 (threshold 15). Drivers by points: if/else 65 (128 pts), boolean chains 12, match/switch 6 (9 pts), loops 2 (4 pts) (nesting depth added 68). 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.
  • jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated (cognitive 131) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1410 — jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated has cognitive complexity 131 (threshold 15). Drivers by points: if/else 31 (118 pts), match/switch 3 (6 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 93). 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.
  • jcode_provider_openai_runtime::openai_stream_http::stream_response (cognitive 59) crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:3 — jcode_provider_openai_runtime::openai_stream_http::stream_response has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (48 pts), match/switch 3 (7 pts), boolean chains 3, loops 1 (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.
  • jcode_provider_openai_runtime::chatgpt_web::poll_for_response (cognitive 26) crates/jcode-provider-openai-runtime/src/chatgpt_web.rs:407 — jcode_provider_openai_runtime::chatgpt_web::poll_for_response has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openai_runtime::openai_stream_runtime::recover_opaque_ws_rejection (cognitive 18) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:113 — jcode_provider_openai_runtime::openai_stream_runtime::recover_opaque_ws_rejection has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (8 pts), loops 1 (nesting depth added 11). 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 · OpenRouterProvider · ×5
  • OpenRouterProvider::complete (cognitive 52) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:38 — OpenRouterProvider::complete has cognitive complexity 52 (threshold 15). Drivers by points: if/else 30 (35 pts), boolean chains 12, loops 2 (5 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.
  • OpenRouterProvider::available_models_display (cognitive 23) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:547 — OpenRouterProvider::available_models_display has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 3, loops 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.
  • OpenRouterProvider::set_model (cognitive 21) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:397 — OpenRouterProvider::set_model has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 3 (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.
  • OpenRouterProvider::apply_resolved_reasoning_effort (cognitive 19) crates/jcode-provider-openrouter-runtime/src/lib.rs:867 — OpenRouterProvider::apply_resolved_reasoning_effort has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • OpenRouterProvider::effective_routing (cognitive 16) crates/jcode-provider-openrouter-runtime/src/lib.rs:2185 — OpenRouterProvider::effective_routing has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · jcode_tui_style · ×5
  • jcode_tui_style::harmony::generate::separate_confusable_pairs (cognitive 51) crates/jcode-tui-style/src/harmony/generate.rs:217 — jcode_tui_style::harmony::generate::separate_confusable_pairs has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 10 (20 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 24). Of this number, 37 points are the body's own statements and 14 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_style::theme_mode::adapt_buffer_impl (cognitive 30) crates/jcode-tui-style/src/theme_mode.rs:269 — jcode_tui_style::theme_mode::adapt_buffer_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 1, loops 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.
  • jcode_tui_style::harmony::generate::generate_from_seed (cognitive 20) crates/jcode-tui-style/src/harmony/generate.rs:31 — jcode_tui_style::harmony::generate::generate_from_seed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18 (19 pts), loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • jcode_tui_style::harmony::chroma_coherence (cognitive 18) crates/jcode-tui-style/src/harmony.rs:539 — jcode_tui_style::harmony::chroma_coherence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, loops 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.
  • jcode_tui_style::color::detect_raw_color_capability (cognitive 16) crates/jcode-tui-style/src/color.rs:94 — jcode_tui_style::color::detect_raw_color_capability has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (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.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/jcode-app-core/src/tool/read.rs:401 — crates/jcode-app-core/src/tool/read.rs:401-442 | crates/jcode-base/src/provider/image_clamp.rs:404-443 | crates/jcode-terminal-image/src/display.rs:229-290 | crates/jcode-tui-mermaid/src/lib.rs:1506-1518 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:269-346 — 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) crates/jcode-tui/src/tui/app/auth_account_picker.rs:466 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:466-746 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:883-1029 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:210-272 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:391-448 | crates/jcode-tui/src/tui/login_picker.rs:754-827 — 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) crates/jcode-tui/src/tui/keybind.rs:64 — crates/jcode-tui/src/tui/keybind.rs:64-83 | crates/jcode-tui/src/tui/keybind.rs:647-660 | crates/jcode-tui/src/tui/keybind.rs:664-677 | crates/jcode-tui/src/tui/keybind.rs:681-694 | crates/jcode-tui/src/tui/keybind.rs:698-711 — 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) crates/jcode-provider-openai-runtime/src/openai_tests/http_idle.rs:2 — crates/jcode-provider-openai-runtime/src/openai_tests/http_idle.rs:2-111 | crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs:10-233 | crates/jcode-provider-openai-runtime/src/openai_tests/overload_retry.rs:2-118 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_prefix.rs:66-171 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_terminal.rs:171-314 — 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) scripts/diagnose_idle_render_cost.py:129 — scripts/diagnose_idle_render_cost.py:129-140 | scripts/repro_expand_edit_shortcut.py:287-300 | scripts/repro_input_flicker.py:140-151 | scripts/repro_input_lag.py:143-154 | scripts/repro_slash_flicker.py:136-147 — 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 (22 corresponding lines) · ×5
  • Edited copy of a member (22 corresponding lines) crates/jcode-base/src/auth/claude.rs:410 — crates/jcode-base/src/auth/claude.rs:410-431 | crates/jcode-base/src/auth/codex.rs:271-293 — 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) crates/jcode-base/src/memory_log.rs:415 — crates/jcode-base/src/memory_log.rs:415-436 | crates/jcode-logging/src/lib.rs:610-637 — 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) crates/jcode-base/src/auth/claude.rs:477 — crates/jcode-base/src/auth/claude.rs:477-498 | crates/jcode-base/src/auth/codex.rs:314-347 — 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) crates/jcode-base/src/browser_chromium_diag.rs:77 — crates/jcode-base/src/browser_chromium_diag.rs:77-99 | crates/jcode-companion/src/lid_override.rs:264-285 — 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) crates/jcode-tui/src/tui/app/helpers.rs:1813 — crates/jcode-tui/src/tui/app/helpers.rs:1813-1836 | crates/jcode-tui/src/tui/app/turn_notify.rs:382-403 — 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 copies of one member (3 members, 9+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 9+ corresponding lines) crates/jcode-setup-hints/src/lib.rs:1817 — crates/jcode-setup-hints/src/lib.rs:1817-1825 | crates/jcode-setup-hints/src/lib.rs:1829-1837 | crates/jcode-setup-hints/src/lib.rs:1986-1994 — 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) crates/jcode-setup-hints/src/windows_setup.rs:22 — crates/jcode-setup-hints/src/windows_setup.rs:22-30 | crates/jcode-setup-hints/src/windows_setup.rs:32-40 | crates/jcode-tui/src/tui/app/productivity.rs:137-146 — 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) crates/jcode-app-core/src/server/client_api.rs:160 — crates/jcode-app-core/src/server/client_api.rs:160-168 | crates/jcode-app-core/src/server/client_api.rs:288-296 | crates/jcode-app-core/src/server/client_api.rs:298-306 — 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) crates/jcode-app-core/src/catchup.rs:569 — crates/jcode-app-core/src/catchup.rs:569-580 | crates/jcode-app-core/src/tool/mcp.rs:47-55 | crates/jcode-tui/src/tui/ui_messages/connection.rs:12-22 — 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) crates/jcode-provider-openai-runtime/src/lib.rs:751 — crates/jcode-provider-openai-runtime/src/lib.rs:751-762 | crates/jcode-provider-openai-runtime/src/openai_tests/models_state.rs:697-705 | crates/jcode-provider-openai-runtime/src/openai_tests/websocket_prewarm.rs:1-9 — 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 · Duplicated block (37 lines × 2) · ×5
  • Duplicated block (37 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:127 — crates/jcode-app-core/src/telemetry_state.rs:127-163 | crates/jcode-telemetry-core/src/state_support.rs:125-161 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (37 lines × 2) crates/jcode-app-core/src/tool/apply_patch.rs:486 — crates/jcode-app-core/src/tool/apply_patch.rs:486-522 | crates/jcode-app-core/src/tool/patch.rs:478-514 — 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 `crates/jcode-app-core/src/tool/apply_patch.rs:486` 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 (37 lines × 2) crates/jcode-provider-anthropic-runtime/src/lib.rs:1283 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1283-1319 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1729-1765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-anthropic-runtime/src/lib.rs:1283` 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 (37 lines × 2) crates/jcode-tui/src/tui/app/turn.rs:523 — crates/jcode-tui/src/tui/app/turn.rs:523-559 | crates/jcode-tui/src/tui/app/turn.rs:1525-1561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/turn.rs:523` 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 (37 lines × 2) crates/jcode-tui/src/tui/session_picker.rs:404 — crates/jcode-tui/src/tui/session_picker.rs:404-440 | crates/jcode-tui/src/tui/session_picker.rs:566-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.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×5
  • Duplicated block (25 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1732 — crates/jcode-app-core/src/server/client_lifecycle.rs:1732-1756 | crates/jcode-app-core/src/server/client_lifecycle.rs:1764-1788 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:1732` 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 (25 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:2997 — crates/jcode-app-core/src/server/client_lifecycle.rs:2997-3021 | crates/jcode-app-core/src/server/client_lightweight_control.rs:778-802 — before extracting anything, compare `crates/jcode-app-core/src/server/client_lifecycle.rs` and `crates/jcode-app-core/src/server/client_lightweight_control.rs` as WHOLE FILES: this scan already matched 3 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:2997` 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 (25 lines × 2) crates/jcode-app-core/src/telemetry_state.rs:40 — crates/jcode-app-core/src/telemetry_state.rs:40-64 | crates/jcode-telemetry-core/src/state_support.rs:46-70 — before extracting anything, compare `crates/jcode-app-core/src/telemetry_state.rs` and `crates/jcode-telemetry-core/src/state_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 157 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 (25 lines × 2) crates/jcode-tui/src/tui/login_picker.rs:723 — crates/jcode-tui/src/tui/login_picker.rs:723-747 | crates/jcode-tui/src/tui/login_picker.rs:798-822 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/login_picker.rs:723` 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 (25 lines × 2) crates/jcode-provider-doctor/src/provider_e2e.rs:1253 — crates/jcode-provider-doctor/src/provider_e2e.rs:1253-1277 | crates/jcode-provider-doctor/src/provider_e2e.rs:1905-1929 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/provider_e2e.rs:1253` 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 (19–20 lines × 2) · ×5
  • Duplicated block (19–20 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1460 — crates/jcode-app-core/src/server/client_session.rs:1460-1479 | crates/jcode-app-core/src/server/client_session.rs:1640-1658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_session.rs:1460` 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–20 lines × 2) crates/jcode-base/src/compaction.rs:1018 — crates/jcode-base/src/compaction.rs:1018-1036 | crates/jcode-base/src/compaction.rs:1042-1061 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/compaction.rs:1018` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) crates/jcode-base/src/import.rs:202 — crates/jcode-base/src/import.rs:202-221 | crates/jcode-base/src/import.rs:273-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 `crates/jcode-base/src/import.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. 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 (19–20 lines × 2) crates/jcode-base/src/import.rs:1239 — crates/jcode-base/src/import.rs:1239-1257 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:177-196 — 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 `crates/jcode-base/src/import.rs:1239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) src/cli/auth_test/run.rs:28 — src/cli/auth_test/run.rs:28-46 | src/cli/auth_test/run.rs:73-92 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/auth_test/run.rs:28` 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 lines × 3) · ×5
  • Duplicated block (16 lines × 3) crates/jcode-app-core/src/tool/agentgrep/context.rs:963 — crates/jcode-app-core/src/tool/agentgrep/context.rs:963-978 | crates/jcode-app-core/src/tool/agentgrep/context.rs:985-1000 | crates/jcode-app-core/src/tool/agentgrep/context.rs:1007-1022 — 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 `crates/jcode-app-core/src/tool/agentgrep/context.rs:963` 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 × 3) crates/jcode-base/src/provider/dispatch.rs:233 — crates/jcode-base/src/provider/dispatch.rs:233-248 | crates/jcode-base/src/provider/dispatch.rs:275-290 | crates/jcode-base/src/provider/dispatch.rs:298-313 — 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 `crates/jcode-base/src/provider/dispatch.rs:233` 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 × 3) crates/jcode-tui/src/tui/app/auth_account_picker.rs:641 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:641-656 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:676-691 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:959-974 — 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 `crates/jcode-tui/src/tui/app/auth_account_picker.rs:641` 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 (16 lines × 3) crates/jcode-tui/src/tui/app/turn.rs:399 — crates/jcode-tui/src/tui/app/turn.rs:399-414 | crates/jcode-tui/src/tui/app/turn.rs:462-477 | crates/jcode-tui/src/tui/app/turn.rs:1257-1272 — 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 `crates/jcode-tui/src/tui/app/turn.rs:399` 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, `crates/jcode-tui/src/tui/app/turn.rs:416` calls `clone` and `crates/jcode-tui/src/tui/app/turn.rs:480` 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 (16 lines × 3) crates/jcode-tui/src/tui/ui_file_diff.rs:26 — crates/jcode-tui/src/tui/ui_file_diff.rs:26-41 | crates/jcode-tui/src/tui/ui_overlays.rs:118-133 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:26-41 — before extracting anything, compare `crates/jcode-tui/src/tui/ui_file_diff.rs` and `crates/jcode-tui/src/tui/ui_pinned_selection.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. 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 `crates/jcode-tui/src/tui/ui_file_diff.rs:26` 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 lines × 4) · ×5
  • Duplicated block (11 lines × 4) crates/jcode-tui/src/tui/app/auth_account_picker.rs:491 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:491-501 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:764-774 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:289-299 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:335-345 — before extracting anything, compare `crates/jcode-tui/src/tui/app/auth_account_picker.rs` and `crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 4) crates/jcode-tui/src/tui/app/auth_account_picker.rs:553 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:553-563 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:899-909 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:225-235 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:396-406 — before extracting anything, compare `crates/jcode-tui/src/tui/app/auth_account_picker.rs` and `crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 4) crates/jcode-tui/src/tui/keybind.rs:650 — crates/jcode-tui/src/tui/keybind.rs:650-660 | crates/jcode-tui/src/tui/keybind.rs:667-677 | crates/jcode-tui/src/tui/keybind.rs:684-694 | crates/jcode-tui/src/tui/keybind.rs:701-711 — 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 `crates/jcode-tui/src/tui/keybind.rs:650` 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 × 4) src/cli/acp.rs:559 — src/cli/acp.rs:559-569 | src/cli/acp.rs:612-622 | src/cli/acp.rs:712-722 | src/cli/acp.rs:732-742 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 4) scripts/diagnose_idle_render_cost.py:114 — scripts/diagnose_idle_render_cost.py:114-124 | scripts/repro_input_flicker.py:125-135 | scripts/repro_input_lag.py:127-137 | scripts/repro_slash_flicker.py:121-131 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `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–11 lines × 2) · ×5
  • Duplicated block (9–11 lines × 2) crates/jcode-app-core/src/ambient/prompt.rs:124 — crates/jcode-app-core/src/ambient/prompt.rs:124-134 | crates/jcode-app-core/src/ambient/runner.rs:342-350 — 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 `crates/jcode-app-core/src/ambient/prompt.rs:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) crates/jcode-base/src/auth/oauth_callback_io.rs:111 — crates/jcode-base/src/auth/oauth_callback_io.rs:111-119 | crates/jcode-base/src/auth/oauth_callback_io.rs:221-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 `crates/jcode-base/src/auth/oauth_callback_io.rs:111` 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 (9–11 lines × 2) crates/jcode-compaction-core/src/lib.rs:617 — crates/jcode-compaction-core/src/lib.rs:617-625 | crates/jcode-compaction-core/src/lib.rs:639-649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-compaction-core/src/lib.rs:617` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) crates/jcode-provider-anthropic-runtime/src/error_classification.rs:41 — crates/jcode-provider-anthropic-runtime/src/error_classification.rs:41-51 | crates/jcode-provider-copilot-runtime/src/routing.rs:37-45 — 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–11 lines × 2) crates/jcode-provider-openai-runtime/src/lib.rs:423 — crates/jcode-provider-openai-runtime/src/lib.rs:423-433 | crates/jcode-tui/src/tui/ui_input.rs:873-881 — 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 `crates/jcode-tui/src/tui/ui_input.rs:873` 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 (6 lines × 4) · ×5
  • Duplicated block (6 lines × 4) crates/jcode-app-core/src/server/comm_session.rs:37 — crates/jcode-app-core/src/server/comm_session.rs:37-42 | crates/jcode-app-core/src/server/swarm_persistence.rs:36-41 | crates/jcode-app-core/src/server/swarm_persistence.rs:49-54 | crates/jcode-base/src/usage/flight.rs:16-21 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/comm_session.rs:37` 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 (6 lines × 4) crates/jcode-import-core/src/lib.rs:647 — crates/jcode-import-core/src/lib.rs:647-652 | crates/jcode-import-core/src/lib.rs:738-743 | crates/jcode-tui/src/tui/session_picker/loading.rs:2285-2290 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:36-41 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 × 4) crates/jcode-tui/src/tui/app/remote/key_handling.rs:739 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:739-744 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:764-770 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:789-794 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:816-822 — 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 `crates/jcode-tui/src/tui/app/remote/key_handling.rs:764` 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 (6 lines × 4) crates/jcode-tui/src/tui/ui.rs:2612 — crates/jcode-tui/src/tui/ui.rs:2612-2617 | crates/jcode-tui/src/tui/ui.rs:2639-2644 | crates/jcode-tui/src/tui/ui_file_diff.rs:17-22 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:17-22 — before extracting anything, compare `crates/jcode-tui/src/tui/ui_file_diff.rs` and `crates/jcode-tui/src/tui/ui_pinned_selection.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. 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 × 4) src/bin/memory_recall_bench.rs:1884 — src/bin/memory_recall_bench.rs:1884-1893 | src/bin/memory_recall_bench.rs:1900-1910 | src/bin/memory_recall_bench.rs:1952-1957 | src/bin/memory_recall_bench.rs:1982-1989 — 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/bin/memory_recall_bench.rs:1884` 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 · jcode_provider_cursor_runtime · ×4
  • jcode_provider_cursor_runtime::wire::decode_exec_server_message (cyclomatic 97) crates/jcode-provider-cursor-runtime/src/wire.rs:691 — jcode_provider_cursor_runtime::wire::decode_exec_server_message has cyclomatic complexity 97 (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.
  • jcode_provider_cursor_runtime::agent_transport::run_agent_turn (cyclomatic 90) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:758 — jcode_provider_cursor_runtime::agent_transport::run_agent_turn has cyclomatic complexity 90 (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.
  • jcode_provider_cursor_runtime::wire::decode_google_protobuf_value (cyclomatic 27) crates/jcode-provider-cursor-runtime/src/wire.rs:207 — jcode_provider_cursor_runtime::wire::decode_google_protobuf_value 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.
  • jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog (cyclomatic 20) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:376 — jcode_provider_cursor_runtime::agent_transport::resolve_model_id_with_catalog 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 · jcode_provider_openai · ×4
  • jcode_provider_openai::request::build_responses_input_with_logger (cyclomatic 69) crates/jcode-provider-openai/src/request.rs:195 — jcode_provider_openai::request::build_responses_input_with_logger has cyclomatic complexity 69 (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.
  • jcode_provider_openai::stream::parse_openai_response_event (cyclomatic 44) crates/jcode-provider-openai/src/stream.rs:326 — jcode_provider_openai::stream::parse_openai_response_event 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.
  • jcode_provider_openai::citations::render_annotated_text (cyclomatic 27) crates/jcode-provider-openai/src/citations.rs:8 — jcode_provider_openai::citations::render_annotated_text 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.
  • jcode_provider_openai::stream::handle_openai_output_item (cyclomatic 24) crates/jcode-provider-openai/src/stream.rs:640 — jcode_provider_openai::stream::handle_openai_output_item 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.
D1 · Cyclomatic Complexity · jcode_tui_render · ×4
  • jcode_tui_render::swarm_gallery::render_swarm_strip_vertical (cyclomatic 56) crates/jcode-tui-render/src/swarm_gallery.rs:957 — jcode_tui_render::swarm_gallery::render_swarm_strip_vertical has cyclomatic complexity 56 (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.
  • jcode_tui_render::swarm_gallery::render_swarm_strip (cyclomatic 46) crates/jcode-tui-render/src/swarm_gallery.rs:624 — jcode_tui_render::swarm_gallery::render_swarm_strip has cyclomatic complexity 46 (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.
  • jcode_tui_render::memory_tiles::render_memory_tiles (cyclomatic 26) crates/jcode-tui-render/src/memory_tiles.rs:413 — jcode_tui_render::memory_tiles::render_memory_tiles 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.
  • jcode_tui_render::swarm_gallery::hovered_detail_body (cyclomatic 19) crates/jcode-tui-render/src/swarm_gallery.rs:1705 — jcode_tui_render::swarm_gallery::hovered_detail_body 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 · jcode_todo_policy · ×4
  • jcode_todo_policy::completion_report::render_completion_report (cyclomatic 28) crates/jcode-todo-policy/src/completion_report.rs:141 — jcode_todo_policy::completion_report::render_completion_report 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.
  • jcode_todo_policy::auto_poke_display_summary (cyclomatic 20) crates/jcode-todo-policy/src/lib.rs:817 — jcode_todo_policy::auto_poke_display_summary 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.
  • jcode_todo_policy::build_gate_digest (cyclomatic 16) crates/jcode-todo-policy/src/lib.rs:405 — jcode_todo_policy::build_gate_digest 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.
  • jcode_todo_policy::stages::validate_lane_dependencies (cyclomatic 16) crates/jcode-todo-policy/src/stages.rs:124 — jcode_todo_policy::stages::validate_lane_dependencies 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 · SelfDevTool · ×4
  • SelfDevTool::execute (cyclomatic 19) crates/jcode-app-core/src/tool/selfdev/mod.rs:589 — SelfDevTool::execute 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.
  • SelfDevTool::do_setup (cyclomatic 17) crates/jcode-app-core/src/tool/selfdev/setup.rs:59 — SelfDevTool::do_setup has cyclomatic complexity 17 (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.
  • SelfDevTool::do_build_reload (cyclomatic 16) crates/jcode-app-core/src/tool/selfdev/build_queue.rs:702 — SelfDevTool::do_build_reload 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.
  • SelfDevTool::do_reload (cyclomatic 16) crates/jcode-app-core/src/tool/selfdev/reload.rs:282 — SelfDevTool::do_reload 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 · jcode_todo_policy · ×4
  • jcode_todo_policy::completion_report::render_completion_report (cognitive 53) crates/jcode-todo-policy/src/completion_report.rs:141 — jcode_todo_policy::completion_report::render_completion_report has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 14 (22 pts) (nesting depth added 25). 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.
  • jcode_todo_policy::stages::validate_lane_dependencies (cognitive 34) crates/jcode-todo-policy/src/stages.rs:124 — jcode_todo_policy::stages::validate_lane_dependencies has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 5 (9 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_todo_policy::auto_poke_display_summary (cognitive 19) crates/jcode-todo-policy/src/lib.rs:817 — jcode_todo_policy::auto_poke_display_summary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 9. 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.
  • jcode_todo_policy::store::running_dependencies (cognitive 19) crates/jcode-todo-policy/src/store.rs:190 — jcode_todo_policy::store::running_dependencies has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · jcode_voice · ×4
  • jcode_voice::command_capture::run_recorder (cognitive 39) crates/jcode-voice/src/command_capture.rs:247 — jcode_voice::command_capture::run_recorder has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 5 (8 pts), match/switch 2 (4 pts), boolean chains 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.
  • jcode_voice::streaming_capture::capture (cognitive 24) crates/jcode-voice/src/streaming_capture.rs:280 — jcode_voice::streaming_capture::capture has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2, loops 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.
  • jcode_voice::validate_wav (cognitive 20) crates/jcode-voice/src/lib.rs:252 — jcode_voice::validate_wav has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_voice::capture::run (cognitive 17) crates/jcode-voice/src/lib.rs:452 — jcode_voice::capture::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 2 (3 pts), loops 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.
D2 · Cognitive Complexity · BackgroundTaskManager · ×4
  • BackgroundTaskManager::cleanup_filtered (cognitive 38) crates/jcode-base/src/background/cleanup.rs:13 — BackgroundTaskManager::cleanup_filtered has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), match/switch 1 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BackgroundTaskManager::wait (cognitive 37) crates/jcode-base/src/background.rs:968 — BackgroundTaskManager::wait has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (29 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BackgroundTaskManager::arm_stall_watchdog (cognitive 20) crates/jcode-base/src/background.rs:1216 — BackgroundTaskManager::arm_stall_watchdog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BackgroundTaskManager::persisted_detached_running_tasks_for_session (cognitive 20) crates/jcode-base/src/background.rs:1624 — BackgroundTaskManager::persisted_detached_running_tasks_for_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (3 pts), boolean chains 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.
D2 · Cognitive Complexity · SelfDevTool · ×4
  • SelfDevTool::do_setup (cognitive 24) crates/jcode-app-core/src/tool/selfdev/setup.rs:59 — SelfDevTool::do_setup has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 6 (9 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SelfDevTool::do_reload (cognitive 20) crates/jcode-app-core/src/tool/selfdev/reload.rs:282 — SelfDevTool::do_reload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • SelfDevTool::execute (cognitive 19) crates/jcode-app-core/src/tool/selfdev/mod.rs:589 — SelfDevTool::execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (4 pts) (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.
  • SelfDevTool::wait_for_turn (cognitive 17) crates/jcode-app-core/src/tool/selfdev/build_queue.rs:29 — SelfDevTool::wait_for_turn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_core · ×4
  • jcode_core::util::split_concatenated_json (cognitive 21) crates/jcode-core/src/util.rs:176 — jcode_core::util::split_concatenated_json has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_core::stdin_detect::linux::direct_children (cognitive 19) crates/jcode-core/src/stdin_detect.rs:197 — jcode_core::stdin_detect::linux::direct_children has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (6 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.
  • jcode_core::stdin_detect::linux::check_process_tree (cognitive 17) crates/jcode-core/src/stdin_detect.rs:130 — jcode_core::stdin_detect::linux::check_process_tree 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.
  • jcode_core::stdin_detect::linux::children_via_proc_scan (cognitive 17) crates/jcode-core/src/stdin_detect.rs:234 — jcode_core::stdin_detect::linux::children_via_proc_scan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×4
  • Edited copy of a member (42 corresponding lines) crates/jcode-app-core/src/tool/session_search.rs:1088 — crates/jcode-app-core/src/tool/session_search.rs:1088-1129 | crates/jcode-app-core/src/tool/session_search.rs:1191-1243 — 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.
  • Edited copy of a member (42 corresponding lines) src/cli/acp.rs:511 — src/cli/acp.rs:511-552 | src/cli/acp.rs:558-609 — 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.
  • Edited copy of a member (42 corresponding lines) crates/jcode-base/src/auth/oauth.rs:1118 — crates/jcode-base/src/auth/oauth.rs:1118-1159 | crates/jcode-base/src/auth/oauth.rs:1262-1306 — 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.
  • Edited copy of a member (42 corresponding lines) crates/jcode-app-core/src/server/comm_sync.rs:207 — crates/jcode-app-core/src/server/comm_sync.rs:207-248 | crates/jcode-app-core/src/server/comm_sync.rs:342-391 — 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 (33 corresponding lines) · ×4
  • Edited copy of a member (33 corresponding lines) crates/jcode-setup-hints/src/lib.rs:1884 — crates/jcode-setup-hints/src/lib.rs:1884-1916 | crates/jcode-setup-hints/src/lib.rs:1922-1954 — 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) crates/jcode-provider-openrouter/src/lib.rs:569 — crates/jcode-provider-openrouter/src/lib.rs:569-601 | crates/jcode-provider-openrouter/src/lib.rs:603-635 — 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) crates/jcode-app-core/src/server/provider_control.rs:729 — crates/jcode-app-core/src/server/provider_control.rs:729-773 | crates/jcode-app-core/src/server/provider_control.rs:780-812 — 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) crates/jcode-base/src/provider/openrouter.rs:105 — crates/jcode-base/src/provider/openrouter.rs:105-137 | crates/jcode-provider-openrouter-runtime/src/lib.rs:110-142 — 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 (30 corresponding lines) · ×4
  • Edited copy of a member (30 corresponding lines) crates/jcode-tui/src/tui/app/state_ui_messages.rs:77 — crates/jcode-tui/src/tui/app/state_ui_messages.rs:77-106 | src/bin/tui_bench.rs:628-657 — 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) crates/jcode-app-core/src/tool/websearch.rs:620 — crates/jcode-app-core/src/tool/websearch.rs:620-651 | crates/jcode-app-core/src/tool/websearch_kagi.rs:82-111 — 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) crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:69 — crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:69-98 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:146-179 — 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) crates/jcode-app-core/src/agent/interrupts.rs:144 — crates/jcode-app-core/src/agent/interrupts.rs:144-179 | crates/jcode-app-core/src/server/state.rs:607-636 — 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 copies of one member (3 members, 15+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 15+ corresponding lines) crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:224 — crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:224-239 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:394-408 | crates/jcode-tui-messages/src/cache.rs:36-53 — 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) crates/jcode-base/src/auth/antigravity.rs:171 — crates/jcode-base/src/auth/antigravity.rs:171-185 | crates/jcode-base/REDACTED:309-323 | crates/jcode-base/src/auth/google.rs:494-508 — 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) crates/jcode-app-core/src/server/provider_control.rs:226 — crates/jcode-app-core/src/server/provider_control.rs:226-240 | crates/jcode-app-core/src/server/provider_control.rs:470-484 | crates/jcode-app-core/src/server/provider_control.rs:492-518 — 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) crates/jcode-app-core/src/server/input_shell_output.rs:3 — crates/jcode-app-core/src/server/input_shell_output.rs:3-17 | crates/jcode-tui/src/tui/app/input/shell_commands.rs:3-17 | crates/jcode-voice/src/dictation.rs:655-669 — 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, 13+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 13+ corresponding lines) crates/jcode-tui/src/tui/app/observe.rs:179 — crates/jcode-tui/src/tui/app/observe.rs:179-191 | crates/jcode-tui/src/tui/app/split_view.rs:45-61 | crates/jcode-tui/src/tui/app/todos_view.rs:376-392 — 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) crates/jcode-app-core/src/server/background_tasks.rs:427 — crates/jcode-app-core/src/server/background_tasks.rs:427-439 | crates/jcode-app-core/src/server/background_tasks.rs:506-521 | crates/jcode-app-core/src/server/background_tasks.rs:555-572 — 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) crates/jcode-base/src/auth/antigravity.rs:539 — crates/jcode-base/src/auth/antigravity.rs:539-551 | crates/jcode-base/REDACTED:582-594 | crates/jcode-base/REDACTED:596-608 — 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) crates/jcode-provider-antigravity-runtime/src/lib.rs:784 — crates/jcode-provider-antigravity-runtime/src/lib.rs:784-798 | crates/jcode-provider-cursor-runtime/src/lib.rs:608-620 | crates/jcode-provider-gemini-runtime/src/lib.rs:958-970 — 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, 7+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/jcode-app-core/src/usage_display.rs:169 — crates/jcode-app-core/src/usage_display.rs:169-175 | crates/jcode-base/src/usage/display.rs:176-184 | crates/jcode-tui-usage-overlay/src/lib.rs:773-781 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/jcode-app-core/src/server/swarm.rs:219 — crates/jcode-app-core/src/server/swarm.rs:219-225 | crates/jcode-app-core/src/server/swarm_persistence.rs:60-68 | crates/jcode-app-core/src/tool/selfdev/mod.rs:718-724 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/jcode-harness-api-server/src/lib.rs:622 — crates/jcode-harness-api-server/src/lib.rs:622-628 | crates/jcode-harness-api/src/client.rs:47-53 | src/cli/acp.rs:360-367 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/jcode-app-core/src/mission.rs:119 — crates/jcode-app-core/src/mission.rs:119-127 | crates/jcode-base/REDACTED:290-296 | crates/jcode-build-support/src/storage_helpers.rs:110-116 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×4
  • Edited copy of a member (3 corresponding lines) crates/jcode-tui/src/tui/ui_memory_estimates.rs:34 — crates/jcode-tui/src/tui/ui_memory_estimates.rs:34-36 | crates/jcode-tui/src/tui/ui_pinned.rs:213-215 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) crates/jcode-app-core/src/notifications.rs:393 — crates/jcode-app-core/src/notifications.rs:393-395 | crates/jcode-base/src/auth/transfer.rs:701-703 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) crates/jcode-tui/src/tui/info_widget_frame.rs:22 — crates/jcode-tui/src/tui/info_widget_frame.rs:22-24 | crates/jcode-tui/src/tui/ui_header.rs:63-65 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) scripts/bench_memory_cli.py:73 — scripts/bench_memory_cli.py:73-75 | scripts/bench_startup_visible_ready.py:89-94 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (28 lines × 2) · ×4
  • Duplicated block (28 lines × 2) crates/jcode-app-core/src/server/input_shell_output.rs:20 — crates/jcode-app-core/src/server/input_shell_output.rs:20-47 | crates/jcode-tui/src/tui/app/input/shell_commands.rs:20-47 — 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 (28 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:935 — crates/jcode-provider-doctor/src/live_provider_probes.rs:935-962 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1566-1593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/live_provider_probes.rs:935` 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 (28 lines × 2) crates/jcode-tui-style/src/color.rs:253 — crates/jcode-tui-style/src/color.rs:253-280 | crates/jcode-tui-workspace/src/color_support.rs:215-242 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 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) scripts/benchmark_swarm.py:292 — scripts/benchmark_swarm.py:292-319 | scripts/benchmark_swarm.py:420-447 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×4
  • Duplicated block (26 lines × 2) crates/jcode-app-core/src/usage_display.rs:36 — crates/jcode-app-core/src/usage_display.rs:36-61 | crates/jcode-base/src/usage/display.rs:39-64 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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 `crates/jcode-app-core/src/usage_display.rs:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) crates/jcode-render-core/src/preprocess.rs:904 — crates/jcode-render-core/src/preprocess.rs:904-929 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:101-126 — before extracting anything, compare `crates/jcode-render-core/src/preprocess.rs` and `crates/jcode-tui-markdown/src/markdown_text_preprocess.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 88 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 `crates/jcode-render-core/src/preprocess.rs:904` 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 (26 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2505 — crates/jcode-tui/src/tui/session_picker/loading.rs:2505-2530 | crates/jcode-tui/src/tui/session_picker/loading.rs:2592-2617 — both copies are in the same file, so extract the 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 (26 lines × 2) crates/jcode-tui-style/src/color.rs:312 — crates/jcode-tui-style/src/color.rs:312-337 | crates/jcode-tui-workspace/src/color_support.rs:274-299 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 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.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×4
  • Duplicated block (15–16 lines × 2) crates/jcode-provider-antigravity-runtime/src/lib.rs:631 — crates/jcode-provider-antigravity-runtime/src/lib.rs:631-645 | crates/jcode-provider-gemini-runtime/src/lib.rs:748-763 — before extracting anything, compare `crates/jcode-provider-antigravity-runtime/src/lib.rs` and `crates/jcode-provider-gemini-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 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 `crates/jcode-provider-antigravity-runtime/src/lib.rs:631` 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–16 lines × 2) crates/jcode-tui/src/tui/app/run_shell.rs:864 — crates/jcode-tui/src/tui/app/run_shell.rs:864-879 | crates/jcode-tui/src/tui/app/run_shell.rs:1254-1268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/run_shell.rs:864` 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, `crates/jcode-tui/src/tui/app/run_shell.rs:861` calls `tick`, `handle_tick` and `crates/jcode-tui/src/tui/app/run_shell.rs:1252` 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–16 lines × 2) crates/jcode-tui/src/tui/ui_overlays.rs:105 — crates/jcode-tui/src/tui/ui_overlays.rs:105-119 | crates/jcode-tui/src/tui/ui_viewport.rs:913-928 — 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 `crates/jcode-tui/src/tui/ui_overlays.rs:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) scripts/repro_expand_edit_shortcut.py:435 — scripts/repro_expand_edit_shortcut.py:435-449 | scripts/repro_live_duplicate.py:445-460 — before extracting anything, compare `scripts/repro_expand_edit_shortcut.py` and `scripts/repro_live_duplicate.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 191 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 `scripts/repro_live_duplicate.py:445` 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 (12 lines × 4) · ×4
  • Duplicated block (12 lines × 4) crates/jcode-app-core/src/tool/read.rs:425 — crates/jcode-app-core/src/tool/read.rs:425-436 | crates/jcode-base/src/provider/image_clamp.rs:426-437 | crates/jcode-terminal-image/src/display.rs:253-264 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:298-309 — before extracting anything, compare `crates/jcode-app-core/src/tool/read.rs` and `crates/jcode-base/src/provider/image_clamp.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/tool/read.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 × 4) crates/jcode-base/src/import.rs:1464 — crates/jcode-base/src/import.rs:1464-1475 | crates/jcode-import-core/src/lib.rs:1045-1056 | crates/jcode-tui/src/tui/session_picker/loading.rs:2784-2795 | crates/jcode-tui/src/tui/session_picker/loading.rs:2832-2843 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.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 `crates/jcode-base/src/import.rs:1464` 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 × 4) crates/jcode-app-core/src/mission.rs:179 — crates/jcode-app-core/src/mission.rs:179-190 | crates/jcode-app-core/src/server/durable_state.rs:14-25 | crates/jcode-app-core/src/server/reload_recovery.rs:54-65 | crates/jcode-app-core/src/tool/selfdev/reload.rs:5-16 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
  • Duplicated block (12 lines × 4) scripts/pin_no_area_state.py:66 — scripts/pin_no_area_state.py:66-77 | scripts/profile_idle_donut.py:84-95 | scripts/which_overlay_blocks_donut.py:70-81 | scripts/why_no_animation_area.py:61-72 — before extracting anything, compare `scripts/pin_no_area_state.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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) · ×4
  • Duplicated block (10–12 lines × 2) crates/jcode-app-core/src/tool/discover.rs:1120 — crates/jcode-app-core/src/tool/discover.rs:1120-1129 | crates/jcode-app-core/src/tool/discover.rs:1406-1417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/tool/discover.rs:1120` 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 (10–12 lines × 2) crates/jcode-base/src/hooks.rs:311 — crates/jcode-base/src/hooks.rs:311-320 | crates/jcode-base/src/hooks.rs:567-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/hooks.rs:311` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) crates/jcode-harness-api-server/src/translate.rs:521 — crates/jcode-harness-api-server/src/translate.rs:521-532 | crates/jcode-harness-api-server/src/translate.rs:540-549 — both copies are in the same file, so extract the 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 (10–12 lines × 2) crates/jcode-tui/src/tui/ui_viewport.rs:815 — crates/jcode-tui/src/tui/ui_viewport.rs:815-826 | crates/jcode-tui/src/tui/ui_viewport.rs:888-897 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_viewport.rs:815` 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) · ×4
  • Duplicated block (10 lines × 4) crates/jcode-app-core/src/tool/session_search.rs:867 — crates/jcode-app-core/src/tool/session_search.rs:867-876 | crates/jcode-app-core/src/tool/session_search.rs:939-948 | crates/jcode-app-core/src/tool/session_search.rs:1146-1155 | crates/jcode-app-core/src/tool/session_search.rs:1252-1261 — 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 `crates/jcode-app-core/src/tool/session_search.rs:867` 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 × 4) crates/jcode-provider-cursor-runtime/src/wire.rs:751 — crates/jcode-provider-cursor-runtime/src/wire.rs:751-760 | crates/jcode-provider-cursor-runtime/src/wire.rs:793-802 | crates/jcode-provider-cursor-runtime/src/wire.rs:805-814 | crates/jcode-provider-cursor-runtime/src/wire.rs:817-826 — 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 `crates/jcode-provider-cursor-runtime/src/wire.rs:751` 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 × 4) crates/jcode-tui-render/src/lib.rs:88 — crates/jcode-tui-render/src/lib.rs:88-97 | crates/jcode-tui-render/src/lib.rs:138-147 | crates/jcode-tui-render/src/swarm_tiles.rs:318-327 | crates/jcode-tui/src/tui/info_widget_usage.rs:458-467 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (10 lines × 4) src/bin/memory_recall_bench.rs:1231 — src/bin/memory_recall_bench.rs:1231-1240 | src/bin/memory_recall_bench.rs:1469-1478 | src/bin/memory_recall_bench.rs:1601-1610 | src/bin/memory_recall_bench.rs:1867-1876 — 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 × 4) · ×4
  • Duplicated block (7 lines × 4) crates/jcode-tui/src/tui/app/auth_account_picker.rs:651 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:651-657 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:686-692 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:840-846 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:969-975 — 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 `crates/jcode-tui/src/tui/app/auth_account_picker.rs:651` 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) crates/jcode-base/src/auth/azure.rs:15 — crates/jcode-base/src/auth/azure.rs:15-21 | crates/jcode-base/src/provider/openrouter.rs:191-197 | crates/jcode-provider-openrouter-runtime/src/lib.rs:215-221 | crates/jcode-tui-mermaid/src/mermaid_runtime.rs:202-208 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 × 4) crates/jcode-tui/src/tui/app/dictation.rs:168 — crates/jcode-tui/src/tui/app/dictation.rs:168-174 | crates/jcode-tui/src/tui/app/input.rs:1846-1852 | crates/jcode-tui/src/tui/app/input.rs:1855-1861 | crates/jcode-tui/src/tui/app/input.rs:1868-1874 — 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 `crates/jcode-tui/src/tui/app/input.rs:1868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) crates/jcode-tui/src/tui/ui_overlays.rs:347 — crates/jcode-tui/src/tui/ui_overlays.rs:347-353 | crates/jcode-tui/src/tui/ui_overlays.rs:437-443 | crates/jcode-tui/src/tui/ui_overlays.rs:478-484 | crates/jcode-tui/src/tui/ui_overlays.rs:619-625 — 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 `crates/jcode-tui/src/tui/ui_overlays.rs:347` 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×4
  • Low cohesion: MemoryManager (LCOM4 6) crates/jcode-base/src/memory.rs:184 — MemoryManager's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: MemoryEntry (LCOM4 6) crates/jcode-memory-types/src/lib.rs:233 — MemoryEntry's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CloudClient (LCOM4 5) crates/jcode-sdk/src/cloud.rs:220 — CloudClient's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: App (LCOM4 5) crates/jcode-tui/src/tui/app.rs:935 — App's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×4
  • Duplicated block (13 lines × 2 locations) telemetry-worker/src/worker.js:586 — telemetry-worker/src/worker.js:586 · telemetry-worker/src/worker.js:621 — both copies are in the same file, so extract the 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 locations) telemetry-worker/src/worker.js:1350 — telemetry-worker/src/worker.js:1350 · telemetry-worker/src/worker.js:1366 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) telemetry-worker/src/worker.js:1500 — telemetry-worker/src/worker.js:1500 · telemetry-worker/src/worker.js:1611 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
  • Duplicated block (13 lines × 2 locations) telemetry-worker/src/worker.js:1537 — telemetry-worker/src/worker.js:1537 · telemetry-worker/src/worker.js:1798 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
D1 · Cyclomatic Complexity · BridgeState · ×3
  • BridgeState::legacy_event_to_api_inner (cyclomatic 141) crates/jcode-harness-api-server/src/translate.rs:1692 — BridgeState::legacy_event_to_api_inner has cyclomatic complexity 141 (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.
  • BridgeState::translate_request (cyclomatic 134) crates/jcode-harness-api-server/src/translate.rs:369 — BridgeState::translate_request has cyclomatic complexity 134 (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.
  • BridgeState::legacy_event_to_api (cyclomatic 21) crates/jcode-harness-api-server/src/translate.rs:1581 — BridgeState::legacy_event_to_api 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.
D1 · Cyclomatic Complexity · jcode_provider_openai_runtime · ×3
  • jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked (cyclomatic 83) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:539 — jcode_provider_openai_runtime::openai_stream_runtime::continue_persistent_ws_locked has cyclomatic complexity 83 (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.
  • jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated (cyclomatic 42) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1410 — jcode_provider_openai_runtime::openai_stream_runtime::stream_response_websocket_authenticated has cyclomatic complexity 42 (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.
  • jcode_provider_openai_runtime::openai_stream_http::stream_response (cyclomatic 31) crates/jcode-provider-openai-runtime/src/openai_stream_http.rs:3 — jcode_provider_openai_runtime::openai_stream_http::stream_response 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.
D1 · Cyclomatic Complexity · Server · ×3
  • Server::spawn_background_tasks (cyclomatic 44) crates/jcode-app-core/src/server.rs:1199 — Server::spawn_background_tasks 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.
  • Server::monitor_bus (cyclomatic 34) crates/jcode-app-core/src/server.rs:1981 — Server::monitor_bus has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Server::recover_headless_sessions_on_startup (cyclomatic 29) crates/jcode-app-core/src/server.rs:750 — Server::recover_headless_sessions_on_startup 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.
D1 · Cyclomatic Complexity · jcode_provider_anthropic_runtime · ×3
  • jcode_provider_anthropic_runtime::process_sse_event (cyclomatic 36) crates/jcode-provider-anthropic-runtime/src/lib.rs:2553 — jcode_provider_anthropic_runtime::process_sse_event 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.
  • jcode_provider_anthropic_runtime::run_stream_with_retries (cyclomatic 34) crates/jcode-provider-anthropic-runtime/src/lib.rs:1836 — jcode_provider_anthropic_runtime::run_stream_with_retries has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • jcode_provider_anthropic_runtime::stream_response (cyclomatic 25) crates/jcode-provider-anthropic-runtime/src/lib.rs:2266 — jcode_provider_anthropic_runtime::stream_response 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 · AuthStatus · ×3
  • AuthStatus::method_detail_for_provider (cyclomatic 33) crates/jcode-base/src/auth/status_detail.rs:4 — AuthStatus::method_detail_for_provider has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AuthStatus::state_for_provider (cyclomatic 18) crates/jcode-base/src/auth/mod.rs:518 — AuthStatus::state_for_provider 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.
  • AuthStatus::assessment_for_provider (cyclomatic 18) crates/jcode-base/src/auth/mod.rs:590 — AuthStatus::assessment_for_provider 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 · jcode_schema_dialect · ×3
  • jcode_schema_dialect::dialect::walk (cyclomatic 26) crates/jcode-schema-dialect/src/dialect.rs:170 — jcode_schema_dialect::dialect::walk 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.
  • jcode_schema_dialect::conformance::walk (cyclomatic 21) crates/jcode-schema-dialect/src/conformance.rs:144 — jcode_schema_dialect::conformance::walk has cyclomatic complexity 21 (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.
  • jcode_schema_dialect::dialect::flatten_top_level_combiners (cyclomatic 19) crates/jcode-schema-dialect/src/dialect.rs:331 — jcode_schema_dialect::dialect::flatten_top_level_combiners 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 · jcode_voice · ×3
  • jcode_voice::streaming_capture::capture (cyclomatic 26) crates/jcode-voice/src/streaming_capture.rs:280 — jcode_voice::streaming_capture::capture 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.
  • jcode_voice::capture::run (cyclomatic 25) crates/jcode-voice/src/lib.rs:452 — jcode_voice::capture::run 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.
  • jcode_voice::command_capture::run_recorder (cyclomatic 22) crates/jcode-voice/src/command_capture.rs:247 — jcode_voice::command_capture::run_recorder 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.
D1 · Cyclomatic Complexity · jcode_setup_hints · ×3
  • jcode_setup_hints::windows_setup::windows_native_hotkey_loop (cyclomatic 22) crates/jcode-setup-hints/src/windows_setup.rs:436 — jcode_setup_hints::windows_setup::windows_native_hotkey_loop 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.
  • jcode_setup_hints::keymap::chord::pretty_key (cyclomatic 19) crates/jcode-setup-hints/src/keymap/chord.rs:221 — jcode_setup_hints::keymap::chord::pretty_key has cyclomatic complexity 19 (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: KeyChord::normalize_key (cyclomatic 29) 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.
  • jcode_setup_hints::windows_setup::run_setup_hotkey_windows (cyclomatic 16) crates/jcode-setup-hints/src/windows_setup.rs:968 — jcode_setup_hints::windows_setup::run_setup_hotkey_windows 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 · jcode_import_core · ×3
  • jcode_import_core::ordered_claude_code_message_entries (cyclomatic 17) crates/jcode-import-core/src/lib.rs:288 — jcode_import_core::ordered_claude_code_message_entries has cyclomatic complexity 17 (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.
  • jcode_import_core::extract_opencode_part_text (cyclomatic 17) crates/jcode-import-core/src/lib.rs:511 — jcode_import_core::extract_opencode_part_text 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.
  • jcode_import_core::load_codex_external_session (cyclomatic 16) crates/jcode-import-core/src/lib.rs:643 — jcode_import_core::load_codex_external_session 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 · Server · ×3
  • Server::spawn_background_tasks (cognitive 114) crates/jcode-app-core/src/server.rs:1199 — Server::spawn_background_tasks has cognitive complexity 114 (threshold 15). Drivers by points: if/else 34 (94 pts), loops 7 (11 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 68). 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.
  • Server::monitor_bus (cognitive 75) crates/jcode-app-core/src/server.rs:1981 — Server::monitor_bus has cognitive complexity 75 (threshold 15). Drivers by points: if/else 21 (63 pts), loops 3 (10 pts), match/switch 1 (2 pts) (nesting depth added 50). 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.
  • Server::recover_headless_sessions_on_startup (cognitive 52) crates/jcode-app-core/src/server.rs:750 — Server::recover_headless_sessions_on_startup has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (37 pts), match/switch 5 (10 pts), boolean chains 3, loops 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 · jcode_harness_api · ×3
  • jcode_harness_api::edit_stats::count_legacy_messages (cognitive 90) crates/jcode-harness-api/src/edit_stats.rs:128 — jcode_harness_api::edit_stats::count_legacy_messages has cognitive complexity 90 (threshold 15). Drivers by points: if/else 13 (63 pts), loops 4 (13 pts), match/switch 3 (12 pts), boolean chains 2 (nesting depth added 68). 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.
  • jcode_harness_api::swarm_metadata::enrich_sessions_from_swarm_state (cognitive 25) crates/jcode-harness-api/src/swarm_metadata.rs:57 — jcode_harness_api::swarm_metadata::enrich_sessions_from_swarm_state has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_harness_api::edit_stats::enrich_sessions_from_edit_stats (cognitive 16) crates/jcode-harness-api/src/edit_stats.rs:283 — jcode_harness_api::edit_stats::enrich_sessions_from_edit_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_anthropic_runtime · ×3
  • jcode_provider_anthropic_runtime::run_stream_with_retries (cognitive 74) crates/jcode-provider-anthropic-runtime/src/lib.rs:1836 — jcode_provider_anthropic_runtime::run_stream_with_retries has cognitive complexity 74 (threshold 15). Drivers by points: if/else 21 (55 pts), boolean chains 12, match/switch 2 (6 pts), loops 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_anthropic_runtime::process_sse_event (cognitive 62) crates/jcode-provider-anthropic-runtime/src/lib.rs:2553 — jcode_provider_anthropic_runtime::process_sse_event has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (50 pts), match/switch 4 (11 pts), boolean chains 1 (nesting depth added 39). 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.
  • jcode_provider_anthropic_runtime::stream_response (cognitive 40) crates/jcode-provider-anthropic-runtime/src/lib.rs:2266 — jcode_provider_anthropic_runtime::stream_response has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 3 (6 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_tui_anim · ×3
  • jcode_tui_anim::shape_char_3x3 (cognitive 73) crates/jcode-tui-anim/src/lib.rs:384 — jcode_tui_anim::shape_char_3x3 has cognitive complexity 73 (threshold 15). Drivers by points: if/else 27 (29 pts), match/switch 24 (27 pts), boolean chains 17 (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.
  • jcode_tui_anim::sample_gyroscope (cognitive 24) crates/jcode-tui-anim/src/lib.rs:186 — jcode_tui_anim::sample_gyroscope has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_tui_anim::sample_orbit_rings) 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.
  • jcode_tui_anim::sample_orbit_rings (cognitive 24) crates/jcode-tui-anim/src/lib.rs:276 — jcode_tui_anim::sample_orbit_rings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jcode_tui_anim::sample_gyroscope) 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 · jcode_plan · ×3
  • jcode_plan::mermaid::swarm_plan_mermaid (cognitive 64) crates/jcode-plan/src/mermaid.rs:40 — jcode_plan::mermaid::swarm_plan_mermaid has cognitive complexity 64 (threshold 15). Drivers by points: if/else 25 (48 pts), loops 7 (12 pts), boolean chains 2, match/switch 1 (2 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.
  • jcode_plan::cycle_item_ids (cognitive 22) crates/jcode-plan/src/lib.rs:410 — jcode_plan::cycle_item_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 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.
  • jcode_plan::assignment_affinities_for_task (cognitive 21) crates/jcode-plan/src/lib.rs:713 — jcode_plan::assignment_affinities_for_task has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 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.
D2 · Cognitive Complexity · AuthStatus · ×3
  • AuthStatus::method_detail_for_provider (cognitive 60) crates/jcode-base/src/auth/status_detail.rs:4 — AuthStatus::method_detail_for_provider has cognitive complexity 60 (threshold 15). Drivers by points: if/else 32 (51 pts), match/switch 4 (9 pts) (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.
  • AuthStatus::state_for_provider (cognitive 22) crates/jcode-base/src/auth/mod.rs:518 — AuthStatus::state_for_provider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (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.
  • AuthStatus::assessment_for_provider (cognitive 22) crates/jcode-base/src/auth/mod.rs:590 — AuthStatus::assessment_for_provider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (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.
D2 · Cognitive Complexity · jcode_fuzzy · ×3
  • jcode_fuzzy::run_dp (cognitive 49) crates/jcode-fuzzy/src/lib.rs:223 — jcode_fuzzy::run_dp has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 10, loops 5 (7 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_fuzzy::prefilter (cognitive 35) crates/jcode-fuzzy/src/lib.rs:143 — jcode_fuzzy::prefilter has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_fuzzy::fuzzy_match_impl (cognitive 17) crates/jcode-fuzzy/src/lib.rs:388 — jcode_fuzzy::fuzzy_match_impl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 2, match/switch 1 (2 pts) (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.
D2 · Cognitive Complexity · jcode_provider_openrouter_runtime · ×3
  • jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response (cognitive 35) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:192 — jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (27 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_provider_openrouter_runtime::opencode_go_responses::build_input (cognitive 26) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:94 — jcode_provider_openrouter_runtime::opencode_go_responses::build_input has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 3 (10 pts), if/else 3 (9 pts), loops 3 (7 pts) (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.
  • jcode_provider_openrouter_runtime::openrouter_sse_stream::run_stream_with_retries (cognitive 18) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:59 — jcode_provider_openrouter_runtime::openrouter_sse_stream::run_stream_with_retries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeflateStream · ×3
  • DeflateStream::accept_write (cognitive 31) crates/jcode-provider-core/src/ws_deflate.rs:413 — DeflateStream::accept_write has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, match/switch 1 (2 pts), loops 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.
  • DeflateStream::process_read (cognitive 17) crates/jcode-provider-core/src/ws_deflate.rs:352 — DeflateStream::process_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, match/switch 1 (2 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.
  • DeflateStream::poll_drain (cognitive 16) crates/jcode-provider-core/src/ws_deflate.rs:508 — DeflateStream::poll_drain has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 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.
D2 · Cognitive Complexity · jcode_productivity_core · ×3
  • jcode_productivity_core::scan::summarize (cognitive 28) crates/jcode-productivity-core/src/scan.rs:247 — jcode_productivity_core::scan::summarize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_productivity_core::aggregate::build_report (cognitive 22) crates/jcode-productivity-core/src/aggregate.rs:20 — jcode_productivity_core::aggregate::build_report has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 5 (9 pts), boolean chains 4 (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.
  • jcode_productivity_core::scan::scan_all (cognitive 19) crates/jcode-productivity-core/src/scan.rs:59 — jcode_productivity_core::scan::scan_all has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 3 (7 pts), loops 2 (3 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 · MemoryManager · ×3
  • MemoryManager::backfill_embeddings (cognitive 26) crates/jcode-base/src/memory.rs:811 — MemoryManager::backfill_embeddings has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MemoryManager::load_project_graph (cognitive 25) crates/jcode-base/src/memory.rs:1226 — MemoryManager::load_project_graph has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MemoryManager::load_global_graph (cognitive 21) crates/jcode-base/src/memory.rs:1291 — MemoryManager::load_global_graph has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 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 · jcode_tui_workspace · ×3
  • jcode_tui_workspace::workspace_map_widget::tile_color (cognitive 25) crates/jcode-tui-workspace/src/workspace_map_widget.rs:141 — jcode_tui_workspace::workspace_map_widget::tile_color has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). 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.
  • jcode_tui_workspace::color_support::detect_raw_color_capability (cognitive 16) crates/jcode-tui-workspace/src/color_support.rs:63 — jcode_tui_workspace::color_support::detect_raw_color_capability has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (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.
  • jcode_tui_workspace::workspace_map_widget::compute_workspace_tile_placements (cognitive 16) crates/jcode-tui-workspace/src/workspace_map_widget.rs:35 — jcode_tui_workspace::workspace_map_widget::compute_workspace_tile_placements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/jcode-tui/src/tui/ui_messages.rs:589 — crates/jcode-tui/src/tui/ui_messages.rs:589-753 | crates/jcode-tui/src/tui/ui_messages.rs:2542-2630 | crates/jcode-tui/src/tui/ui_messages.rs:2686-2758 | crates/jcode-tui/src/tui/ui_messages.rs:2768-3017 | crates/jcode-tui/src/tui/ui_messages.rs:3160-3214 | crates/jcode-tui/src/tui/ui_messages/connection.rs:56-141 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:94 — scripts/diagnose_idle_render_cost.py:94-110 | scripts/repro_expand_edit_shortcut.py:100-116 | scripts/repro_input_flicker.py:105-121 | scripts/repro_input_lag.py:107-123 | scripts/repro_live_duplicate.py:68-85 | scripts/repro_slash_flicker.py:101-117 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:151 — scripts/diagnose_idle_render_cost.py:151-178 | scripts/repro_expand_edit_shortcut.py:194-222 | scripts/repro_input_flicker.py:212-245 | scripts/repro_input_lag.py:170-201 | scripts/repro_live_duplicate.py:164-192 | scripts/repro_slash_flicker.py:172-204 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×3
  • Edited copy of a member (41 corresponding lines) crates/jcode-app-core/src/server/runtime.rs:339 — crates/jcode-app-core/src/server/runtime.rs:339-391 | crates/jcode-app-core/src/server/runtime.rs:398-438 — 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) crates/jcode-app-core/src/tool/agentgrep/context.rs:166 — crates/jcode-app-core/src/tool/agentgrep/context.rs:166-208 | crates/jcode-app-core/src/tool/agentgrep/context.rs:617-657 — 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/cli/auth_test/run.rs:8 — src/cli/auth_test/run.rs:8-52 | src/cli/auth_test/run.rs:61-101 — 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 (48 corresponding lines) · ×3
  • Edited copy of a member (48 corresponding lines) REDACTED:304 — REDACTED:304-355 | REDACTED:447-494 — 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) crates/jcode-base/src/usage.rs:680 — crates/jcode-base/src/usage.rs:680-731 | crates/jcode-base/src/usage/provider_fetch.rs:94-141 — 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) crates/jcode-tui/src/tui/app/model_context.rs:1099 — crates/jcode-tui/src/tui/app/model_context.rs:1099-1159 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:152-199 — 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 (47 corresponding lines) · ×3
  • Edited copy of a member (47 corresponding lines) crates/jcode-app-core/src/restart_snapshot.rs:78 — crates/jcode-app-core/src/restart_snapshot.rs:78-134 | crates/jcode-app-core/src/restart_snapshot.rs:136-182 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) crates/jcode-provider-openrouter-runtime/src/lib.rs:2635 — crates/jcode-provider-openrouter-runtime/src/lib.rs:2635-2704 | crates/jcode-provider-openrouter-runtime/src/lib.rs:2707-2753 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) crates/jcode-app-core/src/server/provider_control/deferred_operations.rs:158 — crates/jcode-app-core/src/server/provider_control/deferred_operations.rs:158-204 | crates/jcode-app-core/src/server/provider_control/deferred_operations.rs:210-256 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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) · ×3
  • Edited copy of a member (38 corresponding lines) crates/jcode-base/src/session.rs:354 — crates/jcode-base/src/session.rs:354-392 | crates/jcode-base/src/session.rs:394-431 — 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.
  • Edited copy of a member (38 corresponding lines) crates/jcode-tui/src/tui/app/remote/reconnect.rs:117 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:117-157 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:163-200 — 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.
  • Edited copy of a member (38 corresponding lines) crates/jcode-base/src/memory_prompt.rs:14 — crates/jcode-base/src/memory_prompt.rs:14-51 | crates/jcode-base/src/memory_prompt.rs:53-91 — 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 (55 corresponding lines) · ×3
  • Edited copy of a member (55 corresponding lines) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:581 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:581-635 | crates/jcode-provider-cursor-runtime/src/wire.rs:101-165 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (55 corresponding lines) crates/jcode-base/src/memory_prompt.rs:167 — crates/jcode-base/src/memory_prompt.rs:167-233 | src/bin/memory_recall_bench.rs:294-348 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (55 corresponding lines) crates/jcode-overnight-core/src/prompts.rs:92 — crates/jcode-overnight-core/src/prompts.rs:92-149 | crates/jcode-overnight-core/src/prompts.rs:151-205 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×3
  • Edited copy of a member (39 corresponding lines) crates/jcode-base/src/usage/api_keys.rs:132 — crates/jcode-base/src/usage/api_keys.rs:132-171 | crates/jcode-base/src/usage/api_keys.rs:173-211 — 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) crates/jcode-base/src/sidecar.rs:920 — crates/jcode-base/src/sidecar.rs:920-958 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1943-1981 — 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/cli/provider_init.rs:930 — src/cli/provider_init.rs:930-968 | src/cli/provider_init.rs:1093-1133 — 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 (36 corresponding lines) · ×3
  • Edited copy of a member (36 corresponding lines) crates/jcode-base/src/usage/api_keys.rs:694 — crates/jcode-base/src/usage/api_keys.rs:694-730 | crates/jcode-base/src/usage/api_keys.rs:733-768 — 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) crates/jcode-tui/src/tui/session_picker/loading.rs:2200 — crates/jcode-tui/src/tui/session_picker/loading.rs:2200-2242 | crates/jcode-tui/src/tui/session_picker/loading.rs:2776-2811 — 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) crates/jcode-base/src/browser.rs:824 — crates/jcode-base/src/browser.rs:824-859 | crates/jcode-update-core/src/lib.rs:141-177 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×3
  • Edited copy of a member (34 corresponding lines) crates/jcode-app-core/src/message_notifications.rs:22 — crates/jcode-app-core/src/message_notifications.rs:22-55 | crates/jcode-base/src/message/notifications.rs:83-117 — 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) crates/jcode-base/src/runtime_memory_log.rs:516 — crates/jcode-base/src/runtime_memory_log.rs:516-550 | crates/jcode-base/src/runtime_memory_log.rs:562-595 — 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) scripts/bench_headless_memory.py:223 — scripts/bench_headless_memory.py:223-259 | scripts/bench_headless_memory.py:452-485 — 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) · ×3
  • Edited copy of a member (32 corresponding lines) crates/jcode-tui-messages/src/message.rs:415 — crates/jcode-tui-messages/src/message.rs:415-446 | crates/jcode-tui/src/tui/app/remote/server_events/history_fingerprint.rs:56-88 — 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) crates/jcode-tui/src/tui/ui.rs:2127 — crates/jcode-tui/src/tui/ui.rs:2127-2168 | crates/jcode-tui/src/tui/ui.rs:2176-2207 — 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) crates/jcode-app-core/src/server/client_state.rs:1304 — crates/jcode-app-core/src/server/client_state.rs:1304-1341 | crates/jcode-app-core/src/server/comm_sync.rs:29-60 — 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, 14+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 14+ corresponding lines) crates/jcode-base/src/gmail.rs:564 — crates/jcode-base/src/gmail.rs:564-581 | crates/jcode-base/src/gmail.rs:625-638 | crates/jcode-base/src/gmail.rs:678-693 — 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) crates/jcode-build-support/src/storage_helpers.rs:119 — crates/jcode-build-support/src/storage_helpers.rs:119-132 | crates/jcode-build-support/src/storage_helpers.rs:135-148 | crates/jcode-build-support/src/storage_helpers.rs:151-164 — 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) scripts/check_code_size_budget.py:81 — scripts/check_code_size_budget.py:81-95 | scripts/check_panic_budget.py:80-93 | scripts/check_test_size_budget.py:70-83 — 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, 16+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 16+ corresponding lines) crates/jcode-app-core/src/tool/agentgrep/context.rs:830 — crates/jcode-app-core/src/tool/agentgrep/context.rs:830-848 | crates/jcode-app-core/src/tool/agentgrep/context.rs:850-865 | crates/jcode-app-core/src/tool/agentgrep/context.rs:867-883 — 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) crates/jcode-tui/src/tui/app/observe.rs:213 — crates/jcode-tui/src/tui/app/observe.rs:213-228 | crates/jcode-tui/src/tui/app/split_view.rs:121-136 | crates/jcode-tui/src/tui/app/todos_view.rs:456-471 — 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) crates/jcode-app-core/src/agent/turn_execution.rs:1397 — crates/jcode-app-core/src/agent/turn_execution.rs:1397-1412 | crates/jcode-app-core/src/agent/turn_execution.rs:1422-1439 | crates/jcode-app-core/src/agent/turn_execution.rs:1448-1469 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/jcode-base/src/auth/external.rs:177 — crates/jcode-base/src/auth/external.rs:177-184 | crates/jcode-base/src/auth/external.rs:186-196 | crates/jcode-base/src/auth/external.rs:306-314 — 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) crates/jcode-app-core/src/tool/selfdev/mod.rs:709 — crates/jcode-app-core/src/tool/selfdev/mod.rs:709-716 | crates/jcode-base/src/auth/copilot.rs:221-229 | crates/jcode-base/src/session.rs:294-301 — 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) crates/jcode-base/src/session/render.rs:264 — crates/jcode-base/src/session/render.rs:264-271 | crates/jcode-message-types/src/lib.rs:677-684 | crates/jcode-tui/src/tui/ui_tools/batch.rs:171-178 — 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 · Duplicated block (45 lines × 2) · ×3
  • Duplicated block (45 lines × 2) crates/jcode-import-core/src/lib.rs:404 — crates/jcode-import-core/src/lib.rs:404-448 | crates/jcode-tui/src/tui/session_picker/loading.rs:752-796 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (45 lines × 2) src/cli/commands.rs:2880 — src/cli/commands.rs:2880-2924 | src/cli/commands.rs:2998-3042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/commands.rs:2880` 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 (45 lines × 2) scripts/jcode_harbor_agent.py:254 — scripts/jcode_harbor_agent.py:254-298 | scripts/jcode_harbor_claude_agent.py:283-327 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 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 (33 lines × 2) · ×3
  • Duplicated block (33 lines × 2) crates/jcode-base/src/provider/openrouter.rs:252 — crates/jcode-base/src/provider/openrouter.rs:252-284 | crates/jcode-provider-openrouter-runtime/src/lib.rs:332-364 — before extracting anything, compare `crates/jcode-base/src/provider/openrouter.rs` and `crates/jcode-provider-openrouter-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 132 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (33 lines × 2) crates/jcode-telemetry-core/src/lib.rs:386 — crates/jcode-telemetry-core/src/lib.rs:386-418 | crates/jcode-telemetry-core/src/lib.rs:2023-2055 — both copies are in the same file, so extract the 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 (33 lines × 2) crates/jcode-tui/src/tui/app/remote/reconnect.rs:118 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:118-150 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:164-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/remote/reconnect.rs:118` 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 (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) crates/jcode-app-core/src/agent/status.rs:88 — crates/jcode-app-core/src/agent/status.rs:88-117 | crates/jcode-app-core/src/agent/turn_execution.rs:1593-1622 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 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 `crates/jcode-app-core/src/agent/status.rs:88` 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, `crates/jcode-app-core/src/agent/turn_execution.rs:1590` calls `trim_start`, `starts_with` and `crates/jcode-app-core/src/agent/status.rs:87` 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 (30 lines × 2) crates/jcode-render-core/src/preprocess.rs:795 — crates/jcode-render-core/src/preprocess.rs:795-824 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:16-45 — before extracting anything, compare `crates/jcode-render-core/src/preprocess.rs` and `crates/jcode-tui-markdown/src/markdown_text_preprocess.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 88 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 `crates/jcode-render-core/src/preprocess.rs:795` 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 (30 lines × 2) crates/jcode-tui/src/tui/app/debug.rs:32 — crates/jcode-tui/src/tui/app/debug.rs:32-61 | src/bin/tui_bench.rs:162-191 — 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 `crates/jcode-tui/src/tui/app/debug.rs:32` 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 (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:3235 — crates/jcode-app-core/src/server/client_lifecycle.rs:3235-3261 | crates/jcode-app-core/src/server/client_lightweight_control.rs:1007-1033 — before extracting anything, compare `crates/jcode-app-core/src/server/client_lifecycle.rs` and `crates/jcode-app-core/src/server/client_lightweight_control.rs` as WHOLE FILES: this scan already matched 3 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:3235` 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 (27 lines × 2) crates/jcode-base/src/background.rs:469 — crates/jcode-base/src/background.rs:469-495 | crates/jcode-base/src/background.rs:687-713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/background.rs:469` 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, `crates/jcode-base/src/background.rs:496` calls `clone` and `crates/jcode-base/src/background.rs:714` 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 (27 lines × 2) crates/jcode-app-core/src/server/client_actions.rs:891 — crates/jcode-app-core/src/server/client_actions.rs:891-917 | crates/jcode-app-core/src/server/client_actions.rs:1001-1027 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_actions.rs:891` 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 (22–23 lines × 2) · ×3
  • Duplicated block (22–23 lines × 2) crates/jcode-base/src/prompt.rs:409 — crates/jcode-base/src/prompt.rs:409-431 | crates/jcode-base/src/prompt.rs:548-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.
  • Duplicated block (22–23 lines × 2) crates/jcode-base/src/prompt.rs:998 — crates/jcode-base/src/prompt.rs:998-1019 | crates/jcode-base/src/prompt.rs:1043-1065 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/prompt.rs:998` 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 (22–23 lines × 2) scripts/phone-server/testflight-setup.py:83 — scripts/phone-server/testflight-setup.py:83-104 | scripts/phone-server/testflight-setup.py:108-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/phone-server/testflight-setup.py:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (14–16 lines × 2) · ×3
  • Duplicated block (14–16 lines × 2) crates/jcode-app-core/src/tool/skill.rs:344 — crates/jcode-app-core/src/tool/skill.rs:344-359 | crates/jcode-tui/src/tui/app/state_ui.rs:1871-1884 — 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 `crates/jcode-app-core/src/tool/skill.rs:344` 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, `crates/jcode-tui/src/tui/app/state_ui.rs:1886` calls `push_str` and `crates/jcode-app-core/src/tool/skill.rs:359` 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–16 lines × 2) crates/jcode-tui/src/tui/app/model_context.rs:1123 — crates/jcode-tui/src/tui/app/model_context.rs:1123-1138 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:168-181 — 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 `crates/jcode-tui/src/tui/app/model_context.rs:1123` 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–16 lines × 2) src/cli/acp.rs:514 — src/cli/acp.rs:514-527 | src/cli/acp.rs:569-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/cli/acp.rs:514` 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 (13 lines × 3) · ×3
  • Duplicated block (13 lines × 3) crates/jcode-tui/src/tui/app/remote/server_events.rs:3053 — crates/jcode-tui/src/tui/app/remote/server_events.rs:3053-3065 | crates/jcode-tui/src/tui/app/remote/server_events.rs:3169-3181 | crates/jcode-tui/src/tui/app/remote/server_events.rs:3216-3228 — 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 `crates/jcode-tui/src/tui/app/remote/server_events.rs:3053` 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) crates/jcode-tui/src/tui/app/auth_account_picker.rs:615 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:615-627 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:639-651 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:957-969 — 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 `crates/jcode-tui/src/tui/app/auth_account_picker.rs:615` 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) scripts/profile_idle_donut.py:144 — scripts/profile_idle_donut.py:144-156 | scripts/which_overlay_blocks_donut.py:104-116 | scripts/why_no_animation_area.py:119-131 — before extracting anything, compare `scripts/profile_idle_donut.py` and `scripts/which_overlay_blocks_donut.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 lines × 5) · ×3
  • Duplicated block (9 lines × 5) crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1222 — crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1222-1230 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1233-1241 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1254-1262 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1265-1273 | crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1276-1284 — 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 `crates/jcode-provider-cursor-runtime/src/agent_transport.rs:1222` 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 × 5) crates/jcode-tui/src/tui/app/auth_account_picker.rs:554 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:554-562 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:900-908 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:226-234 | crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs:397-405 | crates/jcode-tui/src/tui/login_picker.rs:785-795 — before extracting anything, compare `crates/jcode-tui/src/tui/app/auth_account_picker.rs` and `crates/jcode-tui/src/tui/app/auth_account_picker_saved_accounts.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/auth_account_picker.rs:554` 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 (9 lines × 5) scripts/count_idle_draws.py:89 — scripts/count_idle_draws.py:89-97 | scripts/pin_no_area_state.py:74-82 | scripts/probe_idle_state.py:135-143 | scripts/profile_idle_donut.py:92-100 | scripts/which_overlay_blocks_donut.py:78-86 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 × 4) · ×3
  • Duplicated block (9 lines × 4) crates/jcode-tui/src/tui/app/remote/key_handling.rs:931 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:931-939 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:988-996 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1023-1031 | crates/jcode-tui/src/tui/app/remote/key_handling.rs:1058-1066 — 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 `crates/jcode-tui/src/tui/app/remote/key_handling.rs:931` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) crates/jcode-tui/src/tui/app/state_ui.rs:531 — crates/jcode-tui/src/tui/app/state_ui.rs:531-539 | crates/jcode-tui/src/tui/app/state_ui.rs:541-549 | crates/jcode-tui/src/tui/app/state_ui.rs:551-559 | crates/jcode-tui/src/tui/app/state_ui.rs:583-591 — 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 `crates/jcode-tui/src/tui/app/state_ui.rs:531` 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 (9 lines × 4) crates/jcode-app-core/src/server/debug_server_state.rs:732 — crates/jcode-app-core/src/server/debug_server_state.rs:732-740 | crates/jcode-app-core/src/server/debug_server_state.rs:742-750 | crates/jcode-app-core/src/server/debug_server_state.rs:752-760 | crates/jcode-app-core/src/server/debug_server_state.rs:762-770 — 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 `crates/jcode-app-core/src/server/debug_server_state.rs:732` 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, `crates/jcode-app-core/src/server/debug_server_state.rs:741` calls `and_then`, `get` and `crates/jcode-app-core/src/server/debug_server_state.rs:731` 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 (7–9 lines × 2) · ×3
  • Duplicated block (7–9 lines × 2) crates/jcode-app-core/src/server/runtime_ssh_host.rs:321 — crates/jcode-app-core/src/server/runtime_ssh_host.rs:321-327 | crates/jcode-app-core/src/server/runtime_ssh_host.rs:361-369 — both copies are in the same file, so extract the 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 (7–9 lines × 2) crates/jcode-base/src/provider/mod.rs:1837 — crates/jcode-base/src/provider/mod.rs:1837-1845 | crates/jcode-base/src/provider/mod.rs:2057-2063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider/mod.rs:1837` 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 (7–9 lines × 2) scripts/profile_idle_donut.py:116 — scripts/profile_idle_donut.py:116-124 | scripts/profile_real_spawn.py:61-67 — 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 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 × 6) · ×3
  • Duplicated block (7 lines × 6) crates/jcode-provider-cursor-runtime/src/wire.rs:715 — crates/jcode-provider-cursor-runtime/src/wire.rs:715-721 | crates/jcode-provider-cursor-runtime/src/wire.rs:856-862 | crates/jcode-provider-cursor-runtime/src/wire.rs:878-884 | crates/jcode-provider-cursor-runtime/src/wire.rs:897-903 | crates/jcode-provider-cursor-runtime/src/wire.rs:923-929 | crates/jcode-provider-cursor-runtime/src/wire.rs:941-947 — 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 `crates/jcode-provider-cursor-runtime/src/wire.rs:715` 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 × 6) crates/jcode-tui-account-picker/src/overlay.rs:508 — crates/jcode-tui-account-picker/src/overlay.rs:508-514 | crates/jcode-tui-account-picker/src/overlay.rs:584-590 | crates/jcode-tui-usage-overlay/src/lib.rs:513-519 | crates/jcode-tui-usage-overlay/src/lib.rs:598-604 | crates/jcode-tui/src/tui/login_picker.rs:414-420 | crates/jcode-tui/src/tui/login_picker.rs:477-483 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 × 6) crates/jcode-tui/src/tui/ui_messages.rs:630 — crates/jcode-tui/src/tui/ui_messages.rs:630-636 | crates/jcode-tui/src/tui/ui_messages.rs:2545-2551 | crates/jcode-tui/src/tui/ui_messages.rs:2689-2695 | crates/jcode-tui/src/tui/ui_messages.rs:2952-2958 | crates/jcode-tui/src/tui/ui_messages.rs:3169-3175 | crates/jcode-tui/src/tui/ui_messages/connection.rs:59-65 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×3
  • Duplicated block (6 lines × 5) src/bin/memory_recall_bench.rs:1229 — src/bin/memory_recall_bench.rs:1229-1234 | src/bin/memory_recall_bench.rs:1467-1472 | src/bin/memory_recall_bench.rs:1599-1604 | src/bin/memory_recall_bench.rs:1842-1847 | src/bin/memory_recall_bench.rs:1865-1870 — 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/bin/memory_recall_bench.rs:1229` 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 × 5) crates/jcode-app-core/src/agents_status.rs:75 — crates/jcode-app-core/src/agents_status.rs:75-80 | crates/jcode-tui/src/tui/app/hotkey_feedback.rs:666-671 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:159-164 | crates/jcode-tui/src/tui/app/subscribe_nudge.rs:88-93 | src/cli/cloud_move.rs:383-388 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times.
  • Duplicated block (6 lines × 5) crates/jcode-tui-mermaid/src/lib.rs:758 — crates/jcode-tui-mermaid/src/lib.rs:758-763 | crates/jcode-tui-mermaid/src/lib.rs:1042-1047 | crates/jcode-tui-mermaid/src/lib.rs:1140-1145 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:71-76 | crates/jcode-tui-mermaid/src/mermaid_cache_render.rs:380-385 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `key` to `FittedSourceKey` in one and `(u64, RenderProfile)` 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.
R4 · Test Coverage · No test reaches this file · ×3
  • No test reaches this file telemetry-worker/scripts/sync-model-prices.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file telemetry-worker/scripts/move-bulk-events.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file telemetry-worker/scripts/run-dashboard.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D1 · Cyclomatic Complexity · OpenRouterProvider · ×2
  • OpenRouterProvider::complete (cyclomatic 41) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:38 — OpenRouterProvider::complete has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • OpenRouterProvider::available_models_display (cyclomatic 17) crates/jcode-provider-openrouter-runtime/src/openrouter_provider_impl.rs:547 — OpenRouterProvider::available_models_display 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.
D1 · Cyclomatic Complexity · Registry · ×2
  • Registry::execute (cyclomatic 32) crates/jcode-app-core/src/tool/mod.rs:1053 — Registry::execute 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.
  • Registry::register_mcp_tools_for_dir (cyclomatic 20) crates/jcode-app-core/src/tool/mod.rs:1647 — Registry::register_mcp_tools_for_dir 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 · jcode_protocol · ×2
  • jcode_protocol::comm_format::format_comm_members (cyclomatic 29) crates/jcode-protocol/src/comm_format.rs:134 — jcode_protocol::comm_format::format_comm_members 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.
  • jcode_protocol::comm_format::format_comm_status_snapshot (cyclomatic 16) crates/jcode-protocol/src/comm_format.rs:364 — jcode_protocol::comm_format::format_comm_status_snapshot 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 · CopilotApiProvider · ×2
  • CopilotApiProvider::process_sse_stream (cyclomatic 29) crates/jcode-provider-copilot-runtime/src/lib.rs:688 — CopilotApiProvider::process_sse_stream 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.
  • CopilotApiProvider::stream_request (cyclomatic 20) crates/jcode-provider-copilot-runtime/src/lib.rs:417 — CopilotApiProvider::stream_request 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 · jcode_fuzzy · ×2
  • jcode_fuzzy::run_dp (cyclomatic 28) crates/jcode-fuzzy/src/lib.rs:223 — jcode_fuzzy::run_dp 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.
  • jcode_fuzzy::prefilter (cyclomatic 17) crates/jcode-fuzzy/src/lib.rs:143 — jcode_fuzzy::prefilter 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.
D1 · Cyclomatic Complexity · jcode_tui_core · ×2
  • jcode_tui_core::keybind::parse_keybinding (cyclomatic 28) crates/jcode-tui-core/src/keybind.rs:224 — jcode_tui_core::keybind::parse_keybinding has cyclomatic complexity 28 (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.
  • jcode_tui_core::keybind::format_binding (cyclomatic 26) crates/jcode-tui-core/src/keybind.rs:533 — jcode_tui_core::keybind::format_binding has cyclomatic complexity 26 (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: jcode_tui_core::keybind::macos_option_char_to_ascii_key (cyclomatic 28) 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.
D1 · Cyclomatic Complexity · AcpRuntime · ×2
  • AcpRuntime::run_prompt (cyclomatic 25) src/cli/acp.rs:1107 — AcpRuntime::run_prompt 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.
  • AcpRuntime::handle_message (cyclomatic 17) src/cli/acp.rs:441 — AcpRuntime::handle_message has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · jcode_terminal_launch · ×2
  • jcode_terminal_launch::detected_resume_terminal_with_client_env (cyclomatic 23) crates/jcode-terminal-launch/src/lib.rs:241 — jcode_terminal_launch::detected_resume_terminal_with_client_env has cyclomatic complexity 23 (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.
  • jcode_terminal_launch::build_spawn_command (cyclomatic 22) crates/jcode-terminal-launch/src/lib.rs:724 — jcode_terminal_launch::build_spawn_command has cyclomatic complexity 22 (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.
D1 · Cyclomatic Complexity · Session · ×2
  • Session::redacted_for_export (cyclomatic 22) crates/jcode-base/src/session.rs:1229 — Session::redacted_for_export has cyclomatic complexity 22 (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.
  • Session::save_inner (cyclomatic 17) crates/jcode-base/src/session/persistence.rs:612 — Session::save_inner 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.
D1 · Cyclomatic Complexity · jcode_sdk · ×2
  • jcode_sdk::launch::launch_instance (cyclomatic 22) crates/jcode-sdk/src/launch.rs:175 — jcode_sdk::launch::launch_instance 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.
  • jcode_sdk::launch::inherit_credentials (cyclomatic 18) crates/jcode-sdk/src/launch.rs:373 — jcode_sdk::launch::inherit_credentials 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 · BackgroundTaskManager · ×2
  • BackgroundTaskManager::wait (cyclomatic 20) crates/jcode-base/src/background.rs:968 — BackgroundTaskManager::wait 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.
  • BackgroundTaskManager::cleanup_filtered (cyclomatic 19) crates/jcode-base/src/background/cleanup.rs:13 — BackgroundTaskManager::cleanup_filtered 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 · jcode_productivity_core · ×2
  • jcode_productivity_core::aggregate::build_report (cyclomatic 17) crates/jcode-productivity-core/src/aggregate.rs:20 — jcode_productivity_core::aggregate::build_report has cyclomatic complexity 17 (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.
  • jcode_productivity_core::scan::summarize (cyclomatic 17) crates/jcode-productivity-core/src/scan.rs:247 — jcode_productivity_core::scan::summarize 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.
D2 · Cognitive Complexity · OpenRouterStream · ×2
  • OpenRouterStream::parse_next_event (cognitive 126) crates/jcode-provider-openrouter/src/stream.rs:273 — OpenRouterStream::parse_next_event has cognitive complexity 126 (threshold 15). Drivers by points: if/else 28 (90 pts), loops 6 (18 pts), match/switch 3 (11 pts), boolean chains 7 (nesting depth added 82). 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.
  • OpenRouterStream::poll_next (cognitive 22) crates/jcode-provider-openrouter/src/stream.rs:541 — OpenRouterStream::poll_next has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 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 · CopilotApiProvider · ×2
  • CopilotApiProvider::process_sse_stream (cognitive 110) crates/jcode-provider-copilot-runtime/src/lib.rs:688 — CopilotApiProvider::process_sse_stream has cognitive complexity 110 (threshold 15). Drivers by points: if/else 13 (73 pts), match/switch 4 (19 pts), loops 4 (15 pts), boolean chains 3 (nesting depth added 86). 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.
  • CopilotApiProvider::stream_request (cognitive 40) crates/jcode-provider-copilot-runtime/src/lib.rs:417 — CopilotApiProvider::stream_request has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (29 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (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.
D2 · Cognitive Complexity · jcode_tui_tool_display · ×2
  • jcode_tui_tool_display::parse_tool_failure (cognitive 53) crates/jcode-tui-tool-display/src/lib.rs:214 — jcode_tui_tool_display::parse_tool_failure has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 20, 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.
  • jcode_tui_tool_display::without_ansi (cognitive 21) crates/jcode-tui-tool-display/src/lib.rs:182 — jcode_tui_tool_display::without_ansi has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 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 · ResponsesStream · ×2
  • ResponsesStream::parse_event (cognitive 51) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:208 — ResponsesStream::parse_event has cognitive complexity 51 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 5, 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.
  • ResponsesStream::poll_next (cognitive 26) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:464 — ResponsesStream::poll_next has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (23 pts), match/switch 1 (2 pts), loops 1 (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.
D2 · Cognitive Complexity · Registry · ×2
  • Registry::register_mcp_tools_for_dir (cognitive 48) crates/jcode-app-core/src/tool/mod.rs:1647 — Registry::register_mcp_tools_for_dir has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 27). 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.
  • Registry::execute (cognitive 45) crates/jcode-app-core/src/tool/mod.rs:1053 — Registry::execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 10, loops 2 (4 pts), match/switch 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 · GeminiProvider · ×2
  • GeminiProvider::complete (cognitive 47) crates/jcode-provider-gemini-runtime/src/lib.rs:605 — GeminiProvider::complete has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 5 (9 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • GeminiProvider::setup_runtime_state (cognitive 16) crates/jcode-provider-gemini-runtime/src/lib.rs:161 — GeminiProvider::setup_runtime_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 1 (2 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, 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 · jcode_compaction_core · ×2
  • jcode_compaction_core::build_compaction_conversation_text (cognitive 37) crates/jcode-compaction-core/src/lib.rs:162 — jcode_compaction_core::build_compaction_conversation_text has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 2 (5 pts), loops 2 (3 pts) (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.
  • jcode_compaction_core::decay_old_tool_images_in_contents (cognitive 17) crates/jcode-compaction-core/src/lib.rs:845 — jcode_compaction_core::decay_old_tool_images_in_contents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryGraph · ×2
  • MemoryGraph::cascade_retrieve (cognitive 37) crates/jcode-memory-types/src/graph.rs:546 — MemoryGraph::cascade_retrieve has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MemoryGraph::remove_memory (cognitive 16) crates/jcode-memory-types/src/graph.rs:324 — MemoryGraph::remove_memory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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.
D2 · Cognitive Complexity · IncrementalMarkdownRenderer · ×2
  • IncrementalMarkdownRenderer::find_last_complete_block_checkpoint (cognitive 36) crates/jcode-tui-markdown/src/markdown_incremental.rs:300 — IncrementalMarkdownRenderer::find_last_complete_block_checkpoint has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • IncrementalMarkdownRenderer::render_split (cognitive 20) crates/jcode-tui-markdown/src/markdown_incremental.rs:153 — IncrementalMarkdownRenderer::render_split has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, match/switch 3 (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, 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 · jcode_companion · ×2
  • jcode_companion::voice::run (cognitive 35) crates/jcode-companion/src/voice.rs:94 — jcode_companion::voice::run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 2 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_companion::voice::wait_final (cognitive 18) crates/jcode-companion/src/voice.rs:345 — jcode_companion::voice::wait_final has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 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.
D2 · Cognitive Complexity · PermissionsApp · ×2
  • PermissionsApp::run (cognitive 34) crates/jcode-tui-permissions/src/lib.rs:509 — PermissionsApp::run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 2 (7 pts), boolean chains 3, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PermissionsApp::render_list (cognitive 17) crates/jcode-tui-permissions/src/lib.rs:149 — PermissionsApp::render_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), loops 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 · Session · ×2
  • Session::redacted_for_export (cognitive 32) crates/jcode-base/src/session.rs:1229 — Session::redacted_for_export has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 6 (13 pts), match/switch 2 (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.
  • Session::save_inner (cognitive 24) crates/jcode-base/src/session/persistence.rs:612 — Session::save_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_tui_core · ×2
  • jcode_tui_core::graph_topology::collect_edges (cognitive 29) crates/jcode-tui-core/src/graph_topology.rs:180 — jcode_tui_core::graph_topology::collect_edges has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 3 (6 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_tui_core::anchor_stability::align_frames (cognitive 23) crates/jcode-tui-core/src/anchor_stability.rs:408 — jcode_tui_core::anchor_stability::align_frames has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnthropicProvider · ×2
  • AnthropicProvider::get_oauth_access_token (cognitive 24) crates/jcode-provider-anthropic-runtime/src/lib.rs:1010 — AnthropicProvider::get_oauth_access_token has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnthropicProvider::refresh_catalogs (cognitive 18) crates/jcode-provider-anthropic-runtime/src/catalog.rs:40 — AnthropicProvider::refresh_catalogs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · Target · ×2
  • Target::preflight_uncached (cognitive 22) src/cli/cloud_move/transport.rs:206 — Target::preflight_uncached has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Target::prepare_development_binary (cognitive 17) src/cli/cloud_move/transport.rs:314 — Target::prepare_development_binary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_terminal_launch · ×2
  • jcode_terminal_launch::parse_hook_command (cognitive 20) crates/jcode-terminal-launch/src/lib.rs:531 — jcode_terminal_launch::parse_hook_command has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • jcode_terminal_launch::detected_resume_terminal_with_client_env (cognitive 18) crates/jcode-terminal-launch/src/lib.rs:241 — jcode_terminal_launch::detected_resume_terminal_with_client_env has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 6, match/switch 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.
D2 · Cognitive Complexity · AccountPicker · ×2
  • AccountPicker::provider_overview_line (cognitive 20) crates/jcode-tui-account-picker/src/overlay.rs:250 — AccountPicker::provider_overview_line has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 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.
  • AccountPicker::render_detail_pane (cognitive 19) crates/jcode-tui-account-picker/src/overlay.rs:579 — AccountPicker::render_detail_pane has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (6 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 · InfoWidgetData · ×2
  • InfoWidgetData::effective_priority (cognitive 18) crates/jcode-tui/src/tui/info_widget.rs:887 — InfoWidgetData::effective_priority has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 5). 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.
  • InfoWidgetData::has_data_for (cognitive 17) crates/jcode-tui/src/tui/info_widget.rs:783 — InfoWidgetData::has_data_for has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Near-duplicate member pair (42 shared lines) · ×2
  • Near-duplicate member pair (42 shared lines) crates/jcode-tui/src/tui/app/commands_improve.rs:456 — crates/jcode-tui/src/tui/app/commands_improve.rs:456-523 | crates/jcode-tui/src/tui/app/commands_improve.rs:525-592 — These two members are variants of one another: 42 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.
  • Near-duplicate member pair (42 shared lines) scripts/measure_animation_cpu_cost.py:65 — scripts/measure_animation_cpu_cost.py:65-135 | scripts/sweep_animation_fps.py:51-124 — These two members are variants of one another: 42 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 · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (7 members, 50+ identical tokens) crates/jcode-provider-doctor/src/live_provider_probes.rs:766 — crates/jcode-provider-doctor/src/live_provider_probes.rs:766-814 | crates/jcode-provider-doctor/src/live_provider_probes.rs:823-912 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1094-1142 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1151-1232 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1286-1333 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1344-1424 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1447-1528 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) crates/jcode-tui/src/tui/ui.rs:2607 — crates/jcode-tui/src/tui/ui.rs:2607-2626 | crates/jcode-tui/src/tui/ui.rs:2634-2662 | crates/jcode-tui/src/tui/ui_file_diff.rs:9-41 | crates/jcode-tui/src/tui/ui_input.rs:2165-2397 | crates/jcode-tui/src/tui/ui_overlays.rs:20-136 | crates/jcode-tui/src/tui/ui_pinned_selection.rs:9-41 | crates/jcode-tui/src/tui/ui_viewport.rs:328-1363 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Edited copy of a member (82 corresponding lines) · ×2
  • Edited copy of a member (82 corresponding lines) crates/jcode-tui-anim/src/lib.rs:193 — crates/jcode-tui-anim/src/lib.rs:193-274 | crates/jcode-tui-anim/src/lib.rs:283-382 — These two members are one piece of code written twice and then edited apart: 82 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (82 corresponding lines) crates/jcode-tui/src/tui/session_picker/loading.rs:2284 — crates/jcode-tui/src/tui/session_picker/loading.rs:2284-2365 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:35-117 — These two members are one piece of code written twice and then edited apart: 82 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (70 corresponding lines) · ×2
  • Edited copy of a member (70 corresponding lines) crates/jcode-tui/src/tui/session_picker.rs:389 — crates/jcode-tui/src/tui/session_picker.rs:389-458 | crates/jcode-tui/src/tui/session_picker.rs:527-620 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (70 corresponding lines) crates/jcode-base/src/import.rs:201 — crates/jcode-base/src/import.rs:201-270 | crates/jcode-base/src/import.rs:272-346 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (53 corresponding lines) · ×2
  • Edited copy of a member (53 corresponding lines) crates/jcode-base/src/memory.rs:1226 — crates/jcode-base/src/memory.rs:1226-1288 | crates/jcode-base/src/memory.rs:1291-1343 — 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) crates/jcode-base/src/session.rs:784 — crates/jcode-base/src/session.rs:784-836 | crates/jcode-base/src/session.rs:838-896 — 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 copies of one member (3 members, 38+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 38+ corresponding lines) crates/jcode-tui/src/tui/app/commands.rs:305 — crates/jcode-tui/src/tui/app/commands.rs:305-360 | crates/jcode-tui/src/tui/app/commands_improve.rs:401-438 | crates/jcode-tui/src/tui/app/commands_overnight.rs:72-116 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 38+ corresponding lines) src/cli/login/scriptable.rs:569 — src/cli/login/scriptable.rs:569-606 | src/cli/login/scriptable.rs:612-662 | src/cli/login/scriptable.rs:668-724 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×2
  • Edited copy of a member (40 corresponding lines) crates/jcode-provider-core/src/transport.rs:33 — crates/jcode-provider-core/src/transport.rs:33-88 | scripts/repro/tls-bad-record-mac/src/main.rs:24-63 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (40 corresponding lines) crates/jcode-app-core/src/tool/websearch.rs:212 — crates/jcode-app-core/src/tool/websearch.rs:212-258 | crates/jcode-app-core/src/tool/websearch.rs:330-369 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×2
  • Edited copy of a member (49 corresponding lines) crates/jcode-tui/src/tui/app/commands_improve.rs:11 — crates/jcode-tui/src/tui/app/commands_improve.rs:11-59 | crates/jcode-tui/src/tui/app/commands_improve.rs:65-113 — 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.
  • Edited copy of a member (49 corresponding lines) crates/jcode-tui-markdown/src/markdown_wrap.rs:260 — crates/jcode-tui-markdown/src/markdown_wrap.rs:260-308 | crates/jcode-tui-markdown/src/markdown_wrap.rs:381-431 — 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 (45 corresponding lines) · ×2
  • Edited copy of a member (45 corresponding lines) crates/jcode-base/src/usage/accessors.rs:434 — crates/jcode-base/src/usage/accessors.rs:434-478 | crates/jcode-base/src/usage/accessors.rs:480-534 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) crates/jcode-base/src/auth/antigravity.rs:367 — crates/jcode-base/src/auth/antigravity.rs:367-412 | crates/jcode-base/REDACTED:512-556 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×2
  • Edited copy of a member (46 corresponding lines) crates/jcode-app-core/src/server/client_actions.rs:199 — crates/jcode-app-core/src/server/client_actions.rs:199-246 | crates/jcode-tui/src/tui/app/input/shell_commands.rs:49-94 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) crates/jcode-tui/src/tui/ui.rs:1307 — crates/jcode-tui/src/tui/ui.rs:1307-1360 | crates/jcode-tui/src/tui/ui.rs:1476-1521 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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, 43+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 43+ corresponding lines) crates/jcode-base/src/prompt.rs:921 — crates/jcode-base/src/prompt.rs:921-967 | crates/jcode-base/src/prompt.rs:977-1019 | crates/jcode-base/src/prompt.rs:1022-1065 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 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, 43+ corresponding lines) crates/jcode-app-core/src/tool/apply_patch.rs:477 — crates/jcode-app-core/src/tool/apply_patch.rs:477-522 | crates/jcode-app-core/src/tool/edit.rs:306-348 | crates/jcode-app-core/src/tool/patch.rs:469-514 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 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, 17+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 17+ corresponding lines) crates/jcode-app-core/src/tool/agentgrep/context.rs:958 — crates/jcode-app-core/src/tool/agentgrep/context.rs:958-978 | crates/jcode-app-core/src/tool/agentgrep/context.rs:980-1000 | crates/jcode-app-core/src/tool/agentgrep/context.rs:1002-1022 | crates/jcode-app-core/src/tool/agentgrep/context.rs:1024-1040 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 17+ corresponding lines) crates/jcode-provider-openai-runtime/src/lib.rs:1117 — crates/jcode-provider-openai-runtime/src/lib.rs:1117-1138 | crates/jcode-provider-openrouter-runtime/src/lib.rs:1082-1099 | crates/jcode-provider-openrouter-runtime/src/lib.rs:1101-1118 | crates/jcode-provider-openrouter-runtime/src/lib.rs:1120-1136 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) crates/jcode-base/src/session.rs:1402 — crates/jcode-base/src/session.rs:1402-1411 | crates/jcode-base/src/session.rs:1474-1486 | crates/jcode-base/src/session/persistence.rs:268-277 — 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) crates/jcode-app-core/src/server/runtime_ssh_loops.rs:51 — crates/jcode-app-core/src/server/runtime_ssh_loops.rs:51-60 | crates/jcode-base/src/session_telemetry.rs:28-41 | src/cli/cloud_move.rs:1027-1040 — 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 (6 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 13+ corresponding lines) crates/jcode-app-core/src/server/client_api.rs:45 — crates/jcode-app-core/src/server/client_api.rs:45-60 | crates/jcode-app-core/src/server/client_api.rs:215-230 | crates/jcode-app-core/src/server/client_api.rs:232-244 | crates/jcode-app-core/src/server/client_api.rs:264-277 | crates/jcode-app-core/src/server/client_api.rs:325-338 | crates/jcode-app-core/src/server/client_api.rs:340-352 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 13+ corresponding lines) crates/jcode-tui/src/tui/ui_pinned.rs:411 — crates/jcode-tui/src/tui/ui_pinned.rs:411-423 | crates/jcode-tui/src/tui/ui_pinned.rs:427-439 | crates/jcode-tui/src/tui/ui_pinned.rs:441-453 | crates/jcode-tui/src/tui/ui_pinned.rs:455-467 | crates/jcode-tui/src/tui/ui_pinned.rs:469-481 | crates/jcode-tui/src/tui/ui_pinned.rs:483-495 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 4+ corresponding lines) crates/jcode-base/src/provider/catalog_memo.rs:60 — crates/jcode-base/src/provider/catalog_memo.rs:60-63 | crates/jcode-tui-markdown/src/markdown_incremental.rs:419-422 | crates/jcode-tui/src/tui/app/commands_cloud.rs:288-291 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) crates/jcode-app-core/src/server/client_comm_channels.rs:16 — crates/jcode-app-core/src/server/client_comm_channels.rs:16-19 | crates/jcode-app-core/src/server/client_comm_context.rs:15-18 | crates/jcode-app-core/src/server/client_comm_message.rs:19-22 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 5+ corresponding lines) crates/jcode-base/src/copilot_usage.rs:12 — crates/jcode-base/src/copilot_usage.rs:12-16 | crates/jcode-base/src/model_pricing.rs:64-69 | crates/jcode-base/src/provider_activity.rs:84-88 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) crates/jcode-harness-api/src/harness_api_tests/capability_coverage.rs:323 — crates/jcode-harness-api/src/harness_api_tests/capability_coverage.rs:323-327 | crates/jcode-harness-api/src/harness_api_tests/schema_snapshot.rs:391-395 | crates/jcode-sdk/src/sdk_tests/parity.rs:228-232 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 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) crates/jcode-base/src/mcp/remote.rs:321 — crates/jcode-base/src/mcp/remote.rs:321-327 | crates/jcode-base/src/provider/mod.rs:1817-1822 | crates/jcode-base/src/provider/registry.rs:55-61 — 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) scripts/fake_openai_server.py:35 — scripts/fake_openai_server.py:35-40 | scripts/openrelay_discovery_test_server.py:143-148 | scripts/phone-server/jcode-pair-service.py:18-24 — 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 · Duplicated block (34 lines × 2) · ×2
  • Duplicated block (34 lines × 2) crates/jcode-app-core/src/usage_openai.rs:139 — crates/jcode-app-core/src/usage_openai.rs:139-172 | crates/jcode-base/src/usage/openai_helpers.rs:164-197 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 (34 lines × 2) scripts/jcode_harbor_agent.py:150 — scripts/jcode_harbor_agent.py:150-183 | scripts/jcode_harbor_claude_agent.py:151-184 — before extracting anything, compare `scripts/jcode_harbor_agent.py` and `scripts/jcode_harbor_claude_agent.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×2
  • Duplicated block (32 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:2843 — crates/jcode-app-core/src/server/client_lifecycle.rs:2843-2874 | crates/jcode-app-core/src/server/client_lightweight_control.rs:638-669 — before extracting anything, compare `crates/jcode-app-core/src/server/client_lifecycle.rs` and `crates/jcode-app-core/src/server/client_lightweight_control.rs` as WHOLE FILES: this scan already matched 3 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:2843` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (32 lines × 2) crates/jcode-render-core/src/preprocess.rs:870 — crates/jcode-render-core/src/preprocess.rs:870-901 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:67-98 — before extracting anything, compare `crates/jcode-render-core/src/preprocess.rs` and `crates/jcode-tui-markdown/src/markdown_text_preprocess.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 88 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 `crates/jcode-render-core/src/preprocess.rs:870` 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–30 lines × 2) · ×2
  • Duplicated block (29–30 lines × 2) crates/jcode-app-core/src/tool/mcp.rs:442 — crates/jcode-app-core/src/tool/mcp.rs:442-470 | crates/jcode-base/src/mcp/tool.rs:85-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 `crates/jcode-app-core/src/tool/mcp.rs:442` 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–30 lines × 2) crates/jcode-tui/src/tui/app/inline_interactive.rs:2917 — crates/jcode-tui/src/tui/app/inline_interactive.rs:2917-2945 | crates/jcode-tui/src/tui/app/inline_interactive.rs:3034-3063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/inline_interactive.rs:2917` 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 (20 lines × 3) · ×2
  • Duplicated block (20 lines × 3) crates/jcode-import-core/src/lib.rs:1045 — crates/jcode-import-core/src/lib.rs:1045-1064 | crates/jcode-tui/src/tui/session_picker/loading.rs:2784-2803 | crates/jcode-tui/src/tui/session_picker/loading.rs:2832-2851 — before extracting anything, compare `crates/jcode-import-core/src/lib.rs` and `crates/jcode-tui/src/tui/session_picker/loading.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 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 (20 lines × 3) crates/jcode-provider-doctor/src/provider_e2e.rs:530 — crates/jcode-provider-doctor/src/provider_e2e.rs:530-551 | crates/jcode-provider-doctor/src/provider_e2e.rs:826-845 | crates/jcode-provider-doctor/src/provider_e2e.rs:1186-1205 — 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 `crates/jcode-provider-doctor/src/provider_e2e.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.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) crates/jcode-render-core/src/preprocess.rs:71 — crates/jcode-render-core/src/preprocess.rs:71-88 | crates/jcode-render-core/src/preprocess.rs:143-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-render-core/src/preprocess.rs:71` 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 (18–19 lines × 2) crates/jcode-tui/src/tui/ui.rs:3171 — crates/jcode-tui/src/tui/ui.rs:3171-3189 | crates/jcode-tui/src/tui/ui.rs:3249-3266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui.rs:3171` 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 (18 lines × 3) · ×2
  • Duplicated block (18 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:338 — crates/jcode-tui-account-picker/src/overlay.rs:338-355 | crates/jcode-tui-usage-overlay/src/lib.rs:356-373 | crates/jcode-tui/src/tui/login_picker.rs:227-244 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 (18 lines × 3) crates/jcode-tui-account-picker/src/overlay_render.rs:278 — crates/jcode-tui-account-picker/src/overlay_render.rs:278-295 | crates/jcode-tui-usage-overlay/src/lib.rs:865-882 | crates/jcode-tui/src/tui/login_picker.rs:863-880 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (14–17 lines × 2) · ×2
  • Duplicated block (14–17 lines × 2) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1220 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1220-1236 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1245-1258 — both copies are in the same file, so extract the 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–17 lines × 2) crates/jcode-tui/src/tui/ui_prepare.rs:587 — crates/jcode-tui/src/tui/ui_prepare.rs:587-600 | crates/jcode-tui/src/tui/ui_prepare.rs:1079-1095 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_prepare.rs:587` 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) · ×2
  • Duplicated block (15–17 lines × 2) src/cli/acp.rs:631 — src/cli/acp.rs:631-647 | src/cli/acp.rs:761-775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/acp.rs:631` 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 (15–17 lines × 2) src/cli/acp.rs:1522 — src/cli/acp.rs:1522-1536 | src/cli/acp.rs:1544-1560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/acp.rs:1522` 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 (13–16 lines × 2) · ×2
  • Duplicated block (13–16 lines × 2) crates/jcode-base/src/auth/oauth_callback_io.rs:147 — crates/jcode-base/src/auth/oauth_callback_io.rs:147-159 | crates/jcode-base/src/auth/oauth_callback_io.rs:263-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/auth/oauth_callback_io.rs:147` 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 (13–16 lines × 2) crates/jcode-tui-core/src/keybind.rs:66 — crates/jcode-tui-core/src/keybind.rs:66-78 | crates/jcode-tui/src/tui/keybind.rs:589-604 — 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 `crates/jcode-tui-core/src/keybind.rs:66` 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 (13–15 lines × 2) · ×2
  • Duplicated block (13–15 lines × 2) crates/jcode-base/src/auth/oauth_callback_io.rs:133 — crates/jcode-base/src/auth/oauth_callback_io.rs:133-145 | crates/jcode-base/src/auth/oauth_callback_io.rs:247-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/auth/oauth_callback_io.rs:133` 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 (13–15 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:250 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:250-264 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:489-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_widget.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.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×2
  • Duplicated block (13–14 lines × 3) crates/jcode-app-core/src/agent/status.rs:94 — crates/jcode-app-core/src/agent/status.rs:94-107 | crates/jcode-app-core/src/agent/turn_execution.rs:1599-1612 | crates/jcode-base/src/memory_agent.rs:55-67 — before extracting anything, compare `crates/jcode-app-core/src/agent/status.rs` and `crates/jcode-app-core/src/agent/turn_execution.rs` as WHOLE FILES: this scan already matched 4 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 `crates/jcode-base/src/memory_agent.rs:55` 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 (13–14 lines × 3) crates/jcode-tui/src/tui/mod.rs:1671 — crates/jcode-tui/src/tui/mod.rs:1671-1684 | crates/jcode-tui/src/tui/mod.rs:1686-1699 | crates/jcode-tui/src/tui/mod.rs:1972-1984 — 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.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) crates/jcode-app-core/src/server/provider_control.rs:206 — crates/jcode-app-core/src/server/provider_control.rs:206-219 | crates/jcode-app-core/src/server/provider_control.rs:318-331 | crates/jcode-app-core/src/server/provider_control.rs:450-463 — 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 `crates/jcode-app-core/src/server/provider_control.rs:206` 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, `crates/jcode-app-core/src/server/provider_control.rs:315` calls `provider_model` and `crates/jcode-app-core/src/server/provider_control.rs:203` 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 × 3) crates/jcode-tui-account-picker/src/overlay_render.rs:263 — crates/jcode-tui-account-picker/src/overlay_render.rs:263-276 | crates/jcode-tui-usage-overlay/src/lib.rs:850-863 | crates/jcode-tui/src/tui/login_picker.rs:848-861 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay_render.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) crates/jcode-base/src/provider_catalog.rs:981 — crates/jcode-base/src/provider_catalog.rs:981-994 | crates/jcode-base/src/provider_catalog.rs:1120-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/provider_catalog.rs:981` 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–14 lines × 2) scripts/diagnose_idle_render_cost.py:365 — scripts/diagnose_idle_render_cost.py:365-378 | scripts/probe_idle_state.py:127-138 — 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 `scripts/diagnose_idle_render_cost.py:365` 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–13 lines × 2) · ×2
  • Duplicated block (10–13 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1160 — crates/jcode-app-core/src/server/client_lifecycle.rs:1160-1172 | crates/jcode-app-core/src/server/client_lifecycle.rs:2452-2461 — both copies are in the same file, so extract the 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, `crates/jcode-app-core/src/server/client_lifecycle.rs:1173` calls `clone` and `crates/jcode-app-core/src/server/client_lifecycle.rs:2462` 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–13 lines × 2) src/bin/memory_recall_bench.rs:1742 — src/bin/memory_recall_bench.rs:1742-1751 | src/bin/memory_recall_bench.rs:1941-1953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) crates/jcode-base/src/auth/oauth_callback_io.rs:121 — crates/jcode-base/src/auth/oauth_callback_io.rs:121-131 | crates/jcode-base/src/auth/oauth_callback_io.rs:233-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-base/src/auth/oauth_callback_io.rs:121` 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–13 lines × 2) crates/jcode-base/src/memory.rs:796 — crates/jcode-base/src/memory.rs:796-808 | src/bin/memory_recall_bench.rs:197-207 — 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 `crates/jcode-base/src/memory.rs:796` 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 `scored` to `Vec<(MemoryEntry, f32)>` in one and `Vec<(String, f32)>` 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 (8–9 lines × 3) · ×2
  • Duplicated block (8–9 lines × 3) crates/jcode-tui/src/tui/app/inline_interactive.rs:4061 — crates/jcode-tui/src/tui/app/inline_interactive.rs:4061-4068 | crates/jcode-tui/src/tui/app/model_context.rs:43-51 | crates/jcode-tui/src/tui/app/model_context.rs:1015-1023 — 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 `crates/jcode-tui/src/tui/app/inline_interactive.rs:4061` 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 `self` to `super) fn finalize_model_switch(&mut` in one and `super) fn apply_pending_fallback_offer(&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 (8–9 lines × 3) crates/jcode-tui/src/tui/app/remote/server_events.rs:255 — crates/jcode-tui/src/tui/app/remote/server_events.rs:255-262 | crates/jcode-tui/src/tui/app/remote/server_events.rs:444-452 | crates/jcode-tui/src/tui/app/remote/server_events.rs:471-479 — 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.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×2
  • Duplicated block (14–15 lines × 3) crates/jcode-tui/src/tui/app/turn.rs:182 — crates/jcode-tui/src/tui/app/turn.rs:182-195 | crates/jcode-tui/src/tui/app/turn.rs:377-391 | crates/jcode-tui/src/tui/app/turn.rs:1483-1496 — 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 `crates/jcode-tui/src/tui/app/turn.rs:182` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 3) scripts/profile_remote_resume_burst.py:322 — scripts/profile_remote_resume_burst.py:322-335 | scripts/repro_expand_edit_shortcut.py:443-457 | scripts/repro_live_duplicate.py:454-468 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) crates/jcode-tui-account-picker/src/overlay.rs:462 — crates/jcode-tui-account-picker/src/overlay.rs:462-468 | crates/jcode-tui-account-picker/src/overlay.rs:587-593 | crates/jcode-tui-usage-overlay/src/lib.rs:444-450 | crates/jcode-tui/src/tui/login_picker.rs:350-356 | crates/jcode-tui/src/tui/login_picker.rs:480-486 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 `crates/jcode-tui-account-picker/src/overlay.rs:462` 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 × 5) crates/jcode-app-core/src/perf.rs:366 — crates/jcode-app-core/src/perf.rs:366-372 | crates/jcode-setup-hints/src/lib.rs:2391-2397 | crates/jcode-tui-style/src/color.rs:60-66 | crates/jcode-tui-workspace/src/color_support.rs:31-37 | crates/jcode-tui/src/tui/ui_onboarding.rs:52-58 — before extracting anything, compare `crates/jcode-setup-hints/src/lib.rs` and `crates/jcode-tui-style/src/color.rs` as WHOLE FILES: this scan already matched 3 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 4) · ×2
  • Duplicated block (6–7 lines × 4) crates/jcode-base/src/auth/google.rs:389 — crates/jcode-base/src/auth/google.rs:389-395 | crates/jcode-base/src/auth/oauth.rs:223-228 | crates/jcode-base/src/auth/oauth.rs:254-260 | crates/jcode-base/src/auth/oauth.rs:741-746 — 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 `crates/jcode-base/src/auth/google.rs:389` 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–7 lines × 4) scripts/diagnose_idle_render_cost.py:314 — scripts/diagnose_idle_render_cost.py:314-320 | scripts/repro_input_flicker.py:465-470 | scripts/repro_input_lag.py:437-442 | scripts/repro_slash_flicker.py:341-347 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 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 (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) crates/jcode-app-core/src/agent/cache_request.rs:4 — crates/jcode-app-core/src/agent/cache_request.rs:4-8 | crates/jcode-compaction-core/src/lib.rs:516-520 | crates/jcode-tui-markdown/src/markdown_math_copy.rs:48-52 | crates/jcode-tui/src/tui/app/cache_fingerprints.rs:3-7 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
  • Duplicated block (5 lines × 4) crates/jcode-base/src/embedding_stub.rs:37 — crates/jcode-base/src/embedding_stub.rs:37-41 | crates/jcode-embedding/src/lib.rs:37-41 | crates/jcode-memory-types/src/graph.rs:40-44 | crates/jcode-memory-types/src/lib.rs:862-866 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 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 (19 lines × 4) · ×2
  • Duplicated block (19 lines × 4) crates/jcode-app-core/src/server/client_actions.rs:888 — crates/jcode-app-core/src/server/client_actions.rs:888-906 | crates/jcode-app-core/src/server/client_actions.rs:942-960 | crates/jcode-app-core/src/server/client_actions.rs:975-993 | crates/jcode-app-core/src/server/client_actions.rs:998-1016 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (19 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:486 — crates/jcode-provider-doctor/src/provider_e2e.rs:486-504 | crates/jcode-provider-doctor/src/provider_e2e.rs:778-796 | crates/jcode-provider-doctor/src/provider_e2e.rs:1138-1156 | crates/jcode-provider-doctor/src/provider_e2e.rs:1769-1787 — 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 `crates/jcode-provider-doctor/src/provider_e2e.rs:486` 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 (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) crates/jcode-tui/src/tui/ui_overlays.rs:347 — crates/jcode-tui/src/tui/ui_overlays.rs:347-353 | crates/jcode-tui/src/tui/ui_overlays.rs:437-443 | crates/jcode-tui/src/tui/ui_overlays.rs:456-460 | crates/jcode-tui/src/tui/ui_overlays.rs:478-484 | crates/jcode-tui/src/tui/ui_overlays.rs:619-625 — 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 `crates/jcode-tui/src/tui/ui_overlays.rs:347` 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, `crates/jcode-tui/src/tui/ui_overlays.rs:454` calls `push`, `help_entry`, `from` and `crates/jcode-tui/src/tui/ui_overlays.rs:347` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 5) crates/jcode-provider-openai-runtime/src/openai_tests/http_idle.rs:4 — crates/jcode-provider-openai-runtime/src/openai_tests/http_idle.rs:4-8 | crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs:12-16 | crates/jcode-provider-openai-runtime/src/openai_tests/overload_retry.rs:4-8 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_prefix.rs:67-71 | crates/jcode-provider-openai-runtime/src/openai_tests/persistent_terminal.rs:172-176 — before extracting anything, compare `crates/jcode-provider-openai-runtime/src/openai_tests/opaque_recovery.rs` and `crates/jcode-provider-openai-runtime/src/openai_tests/persistent_terminal.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.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:876 — crates/jcode-provider-doctor/src/provider_e2e.rs:876-889 | crates/jcode-provider-doctor/src/provider_e2e.rs:1219-1232 | crates/jcode-provider-doctor/src/provider_e2e.rs:1871-1884 | crates/jcode-provider-doctor/src/provider_e2e.rs:2187-2200 — 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 `crates/jcode-provider-doctor/src/provider_e2e.rs:876` 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 × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:893 — crates/jcode-provider-doctor/src/provider_e2e.rs:893-906 | crates/jcode-provider-doctor/src/provider_e2e.rs:1236-1249 | crates/jcode-provider-doctor/src/provider_e2e.rs:1888-1901 | crates/jcode-provider-doctor/src/provider_e2e.rs:2204-2217 — 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 `crates/jcode-provider-doctor/src/provider_e2e.rs:893` 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 lines × 4) · ×2
  • Duplicated block (13 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:454 — crates/jcode-provider-doctor/src/provider_e2e.rs:454-466 | crates/jcode-provider-doctor/src/provider_e2e.rs:747-759 | crates/jcode-provider-doctor/src/provider_e2e.rs:1104-1116 | crates/jcode-provider-doctor/src/provider_e2e.rs:1738-1750 — 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 `crates/jcode-provider-doctor/src/provider_e2e.rs:454` 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 × 4) scripts/diagnose_idle_render_cost.py:324 — scripts/diagnose_idle_render_cost.py:324-336 | scripts/repro_input_flicker.py:484-496 | scripts/repro_input_lag.py:463-475 | scripts/repro_slash_flicker.py:353-365 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×2
  • Duplicated block (7–8 lines × 3) crates/jcode-base/src/auth/oauth_tests/mod.rs:57 — crates/jcode-base/src/auth/oauth_tests/mod.rs:57-63 | crates/jcode-base/src/auth/oauth_tests/openai_device_code.rs:12-19 | crates/jcode-base/src/auth/oauth_tests/openai_refresh_deadline.rs:13-20 — 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 `crates/jcode-base/src/auth/oauth_tests/mod.rs:57` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 3) scripts/diagnose_idle_render_cost.py:376 — scripts/diagnose_idle_render_cost.py:376-382 | scripts/repro_input_lag.py:539-546 | scripts/repro_slash_flicker.py:413-419 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_lag.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 179 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `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 (7 lines × 7) · ×2
  • Duplicated block (7 lines × 7) scripts/count_idle_draws.py:79 — scripts/count_idle_draws.py:79-85 | scripts/diagnose_idle_render_cost.py:363-369 | scripts/pin_no_area_state.py:65-71 | scripts/probe_idle_state.py:125-131 | scripts/profile_idle_donut.py:83-89 | scripts/which_overlay_blocks_donut.py:69-75 | scripts/why_no_animation_area.py:60-66 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 7) scripts/count_idle_draws.py:87 — scripts/count_idle_draws.py:87-93 | scripts/diagnose_idle_render_cost.py:373-379 | scripts/pin_no_area_state.py:72-78 | scripts/probe_idle_state.py:133-139 | scripts/profile_idle_donut.py:90-96 | scripts/which_overlay_blocks_donut.py:76-82 | scripts/why_no_animation_area.py:67-73 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×2
  • Sync-over-async blocking crates/jcode-app-core/src/server.rs:2379 — `run` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking crates/jcode-codemode/src/engine.rs:97 — `run` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
SC1 · Supply-chain hygiene · JavaScript dependencies are not locked · ×2
  • JavaScript dependencies are not locked sdk/typescript/examples/demo-app/package.json:9 — sdk/typescript/examples/demo-app/package.json declares dependencies that no committed lockfile resolves — there is no REDACTED / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
  • JavaScript dependencies are not locked telemetry-worker/package.json:56 — telemetry-worker/package.json declares dependencies that no committed lockfile resolves — there is no REDACTED / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
C1 · Data Protection · No data-protection/encryption · ×1
  • No data-protection/encryption telemetry-worker/schema.sql:7 — No encryption usage (RustCrypto's aes-gcm/chacha20poly1305 encrypting, ring or aws-lc-rs aead sealing, orion, libsodium's secretbox, openssl symm, age, SQLCipher keyed by PRAGMA key, pgcrypto, MongoDB client-side field-level encryption, the OS keyring) was found, and this repository persists personal data in the model cited here — sensitive data at rest may be unprotected. If TDE/KMS/vault is delegated to infrastructure, ignore.
D1 · Cyclomatic Complexity · Config · ×1
  • Config::apply_env_overrides (cyclomatic 312) crates/jcode-base/src/config/env_overrides.rs:9 — Config::apply_env_overrides has cyclomatic complexity 312 (threshold 15). Of this number, 309 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · insertEvent (cyclomatic 135) · ×1
  • insertEvent (cyclomatic 135) telemetry-worker/src/worker.js:1183 — insertEvent has cyclomatic complexity 135 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CommunicateTool · ×1
  • CommunicateTool::execute (cyclomatic 112) crates/jcode-app-core/src/tool/communicate.rs:810 — CommunicateTool::execute has cyclomatic complexity 112 (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.
D1 · Cyclomatic Complexity · jcode_provider_openrouter · ×1
  • jcode_provider_openrouter::request::build_chat_messages (cyclomatic 95) crates/jcode-provider-openrouter/src/request.rs:49 — jcode_provider_openrouter::request::build_chat_messages has cyclomatic complexity 95 (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 · jcode_tui_anim · ×1
  • jcode_tui_anim::shape_char_3x3 (cyclomatic 91) crates/jcode-tui-anim/src/lib.rs:384 — jcode_tui_anim::shape_char_3x3 has cyclomatic complexity 91 (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.
D1 · Cyclomatic Complexity · fetch (cyclomatic 64) · ×1
  • fetch (cyclomatic 64) telemetry-worker/src/worker.js:510 — fetch has cyclomatic complexity 64 (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 · GmailTool · ×1
  • GmailTool::execute (cyclomatic 54) crates/jcode-app-core/src/tool/gmail.rs:155 — GmailTool::execute has cyclomatic complexity 54 (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 · OpenAIProvider · ×1
  • OpenAIProvider::complete (cyclomatic 51) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:129 — OpenAIProvider::complete 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.
D1 · Cyclomatic Complexity · insertTurnDetails (cyclomatic 49) · ×1
  • insertTurnDetails (cyclomatic 49) telemetry-worker/src/worker.js:1579 — insertTurnDetails has cyclomatic complexity 49 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · OpenRouterStream · ×1
  • OpenRouterStream::parse_next_event (cyclomatic 43) crates/jcode-provider-openrouter/src/stream.rs:273 — OpenRouterStream::parse_next_event 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.
D1 · Cyclomatic Complexity · JcodeClient.globalEvents (cyclomatic 42) · ×1
  • JcodeClient.globalEvents (cyclomatic 42) sdk/typescript/src/client.ts:1148 — JcodeClient.globalEvents has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 8 of the 42 points are its own statements and the rest belongs to 7 function items inside it that branch (startChild, scan, finish, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · concurrency.classifyConcurrency (cyclomatic 40) · ×1
  • concurrency.classifyConcurrency (cyclomatic 40) telemetry-worker/src/concurrency.js:20 — concurrency.classifyConcurrency has cyclomatic complexity 40 (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 · worker.isMeaningfulLifecycleEvent (cyclomatic 40) · ×1
  • worker.isMeaningfulLifecycleEvent (cyclomatic 40) telemetry-worker/src/worker.js:1751 — worker.isMeaningfulLifecycleEvent has cyclomatic complexity 40 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ResponsesStream · ×1
  • ResponsesStream::parse_event (cyclomatic 38) crates/jcode-provider-openrouter-runtime/src/opencode_go_responses.rs:208 — ResponsesStream::parse_event has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_tui_tool_display · ×1
  • jcode_tui_tool_display::parse_tool_failure (cyclomatic 38) crates/jcode-tui-tool-display/src/lib.rs:214 — jcode_tui_tool_display::parse_tool_failure has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · oauth-account.oauthAccount (cyclomatic 38) · ×1
  • oauth-account.oauthAccount (cyclomatic 38) telemetry-worker/src/oauth-account.js:14 — oauth-account.oauthAccount has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · normalizeUsageReportEvent (cyclomatic 38) · ×1
  • normalizeUsageReportEvent (cyclomatic 38) telemetry-worker/src/worker.js:2359 — normalizeUsageReportEvent has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ApplyPatchTool · ×1
  • ApplyPatchTool::execute (cyclomatic 37) crates/jcode-app-core/src/tool/apply_patch.rs:94 — ApplyPatchTool::execute 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.
D1 · Cyclomatic Complexity · BgTool · ×1
  • BgTool::execute (cyclomatic 35) crates/jcode-app-core/src/tool/bg.rs:559 — BgTool::execute has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProviderCard · ×1
  • ProviderCard::body_lines (cyclomatic 35) crates/jcode-tui/src/tui/ui_messages/usage.rs:304 — ProviderCard::body_lines has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Listener · ×1
  • Listener::poll (cyclomatic 35) crates/jcode-voice/src/global/hotkey.rs:694 — Listener::poll has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cloud_directories_probe.collect (cyclomatic 35) · ×1
  • cloud_directories_probe.collect (cyclomatic 35) crates/jcode-tui/src/tui/cloud_directories_probe.py:201 — cloud_directories_probe.collect has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · insertSessionDetails (cyclomatic 35) · ×1
  • insertSessionDetails (cyclomatic 35) telemetry-worker/src/worker.js:1793 — insertSessionDetails has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · jcode_plan · ×1
  • jcode_plan::mermaid::swarm_plan_mermaid (cyclomatic 33) crates/jcode-plan/src/mermaid.rs:40 — jcode_plan::mermaid::swarm_plan_mermaid has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · worker.normalizeWebEvent (cyclomatic 33) · ×1
  • worker.normalizeWebEvent (cyclomatic 33) telemetry-worker/src/worker.js:2102 — worker.normalizeWebEvent has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pruneOldEvents (cyclomatic 32) · ×1
  • pruneOldEvents (cyclomatic 32) telemetry-worker/src/worker.js:1044 — pruneOldEvents has cyclomatic complexity 32 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · MemoryTool · ×1
  • MemoryTool::execute (cyclomatic 31) crates/jcode-app-core/src/tool/memory.rs:129 — MemoryTool::execute 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.
D1 · Cyclomatic Complexity · FollowUpPolicy · ×1
  • FollowUpPolicy::decide_after_turn (cyclomatic 31) crates/jcode-todo-policy/src/followup.rs:267 — FollowUpPolicy::decide_after_turn has cyclomatic complexity 31 (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 · InfoWidgetData · ×1
  • InfoWidgetData::has_data_for (cyclomatic 31) crates/jcode-tui/src/tui/info_widget.rs:783 — InfoWidgetData::has_data_for 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.
D1 · Cyclomatic Complexity · ColorReports · ×1
  • ColorReports::push (cyclomatic 30) crates/jcode-tui/src/tui/terminal_events.rs:94 — ColorReports::push 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.
D1 · Cyclomatic Complexity · launch.launchInstance (cyclomatic 30) · ×1
  • launch.launchInstance (cyclomatic 30) sdk/typescript/src/launch.ts:522 — launch.launchInstance has cyclomatic complexity 30 (threshold 15). Of this number, 15 points are the body's own statements and 15 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_provider_copilot · ×1
  • jcode_provider_copilot::build_messages (cyclomatic 29) crates/jcode-provider-copilot/src/lib.rs:67 — jcode_provider_copilot::build_messages 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.
D1 · Cyclomatic Complexity · jcode_provider_doctor · ×1
  • jcode_provider_doctor::live_provider_probes::consume_native_stream (cyclomatic 29) crates/jcode-provider-doctor/src/live_provider_probes.rs:595 — jcode_provider_doctor::live_provider_probes::consume_native_stream 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.
D1 · Cyclomatic Complexity · insertTodoSessionDetails (cyclomatic 28) · ×1
  • insertTodoSessionDetails (cyclomatic 28) telemetry-worker/src/worker.js:2015 — insertTodoSessionDetails has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · jcode_harness_api · ×1
  • jcode_harness_api::edit_stats::count_legacy_messages (cyclomatic 27) crates/jcode-harness-api/src/edit_stats.rs:128 — jcode_harness_api::edit_stats::count_legacy_messages 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.
D1 · Cyclomatic Complexity · Parser · ×1
  • Parser::parse_command (cyclomatic 27) crates/jcode-render-core/src/math.rs:349 — Parser::parse_command has cyclomatic complexity 27 (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: jcode_render_core::math::command_symbol (cyclomatic 141) 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.
D1 · Cyclomatic Complexity · score_shard.score (cyclomatic 27) · ×1
  • score_shard.score (cyclomatic 27) score_shard.py:4 — score_shard.score 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.
D1 · Cyclomatic Complexity · jcode_harness_api_server · ×1
  • jcode_harness_api_server::run_bridge_stream (cyclomatic 26) crates/jcode-harness-api-server/src/lib.rs:316 — jcode_harness_api_server::run_bridge_stream 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 · jcode_tui_style · ×1
  • jcode_tui_style::harmony::generate::separate_confusable_pairs (cyclomatic 26) crates/jcode-tui-style/src/harmony/generate.rs:217 — jcode_tui_style::harmony::generate::separate_confusable_pairs has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jcode_tui_visual_debug · ×1
  • jcode_tui_visual_debug::write_frame (cyclomatic 26) crates/jcode-tui-visual-debug/src/lib.rs:576 — jcode_tui_visual_debug::write_frame has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AmbientRunnerHandle · ×1
  • AmbientRunnerHandle::run_loop (cyclomatic 25) crates/jcode-app-core/src/ambient/runner.rs:555 — AmbientRunnerHandle::run_loop 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 · GeminiProvider · ×1
  • GeminiProvider::complete (cyclomatic 25) crates/jcode-provider-gemini-runtime/src/lib.rs:605 — GeminiProvider::complete 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 · Projection · ×1
  • Projection::observe (cyclomatic 24) crates/jcode-app-core/src/server/live_status.rs:57 — Projection::observe has cyclomatic complexity 24 (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.
D1 · Cyclomatic Complexity · InitiativeTool · ×1
  • InitiativeTool::execute (cyclomatic 24) crates/jcode-app-core/src/tool/goal.rs:144 — InitiativeTool::execute 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.
D1 · Cyclomatic Complexity · PermissionsApp · ×1
  • PermissionsApp::run (cyclomatic 24) crates/jcode-tui-permissions/src/lib.rs:509 — PermissionsApp::run 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.
D1 · Cyclomatic Complexity · AntigravityProvider · ×1
  • AntigravityProvider::complete (cyclomatic 23) crates/jcode-provider-antigravity-runtime/src/lib.rs:450 — AntigravityProvider::complete 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.
D1 · Cyclomatic Complexity · jcode_provider_openrouter_runtime · ×1
  • jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response (cyclomatic 23) crates/jcode-provider-openrouter-runtime/src/openrouter_sse_stream.rs:192 — jcode_provider_openrouter_runtime::openrouter_sse_stream::stream_response 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.
D1 · Cyclomatic Complexity · ConversationSearchTool · ×1
  • ConversationSearchTool::execute (cyclomatic 22) crates/jcode-app-core/src/tool/conversation_search.rs:83 — ConversationSearchTool::execute 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.
D1 · Cyclomatic Complexity · Walk · ×1
  • Walk::node (cyclomatic 22) crates/jcode-applet-types/src/validate.rs:213 — Walk::node 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.
D1 · Cyclomatic Complexity · SshConnectOptions · ×1
  • SshConnectOptions::validate (cyclomatic 22) crates/jcode-sdk/src/ssh.rs:82 — SshConnectOptions::validate has cyclomatic complexity 22 (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.
D1 · Cyclomatic Complexity · remote.project (cyclomatic 22) · ×1
  • remote.project (cyclomatic 22) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:170 — remote.project 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.
D1 · Cyclomatic Complexity · AppletTool · ×1
  • AppletTool::execute (cyclomatic 21) crates/jcode-app-core/src/tool/applet.rs:233 — AppletTool::execute 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.
D1 · Cyclomatic Complexity · jcode_terminal_image · ×1
  • jcode_terminal_image::display::get_image_dimensions (cyclomatic 21) crates/jcode-terminal-image/src/display.rs:229 — jcode_terminal_image::display::get_image_dimensions 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.
D1 · Cyclomatic Complexity · remote.main (cyclomatic 21) · ×1
  • remote.main (cyclomatic 21) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:206 — remote.main 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.
D1 · Cyclomatic Complexity · launch.inheritCredentials (cyclomatic 21) · ×1
  • launch.inheritCredentials (cyclomatic 21) sdk/typescript/src/launch.ts:242 — launch.inheritCredentials 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.
D1 · Cyclomatic Complexity · writeFirehose (cyclomatic 21) · ×1
  • writeFirehose (cyclomatic 21) telemetry-worker/src/worker.js:374 — writeFirehose has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · insertWebDetails (cyclomatic 21) · ×1
  • insertWebDetails (cyclomatic 21) telemetry-worker/src/worker.js:2051 — insertWebDetails has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · CalendarTool · ×1
  • CalendarTool::execute (cyclomatic 20) crates/jcode-app-core/src/tool/calendar.rs:317 — CalendarTool::execute has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · RouteSelection · ×1
  • RouteSelection::routed_model_spec (cyclomatic 20) crates/jcode-provider-core/src/lib.rs:1083 — RouteSelection::routed_model_spec has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · NativeSshTransport · ×1
  • NativeSshTransport::connect (cyclomatic 20) crates/jcode-sdk/src/native_ssh.rs:176 — NativeSshTransport::connect 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 · TranscriptSearch · ×1
  • TranscriptSearch::poll (cyclomatic 20) crates/jcode-tui/src/tui/session_picker/transcript_search.rs:613 — TranscriptSearch::poll 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 · resolvePriceRows (cyclomatic 20) · ×1
  • resolvePriceRows (cyclomatic 20) telemetry-worker/src/model-pricing.js:160 — resolvePriceRows 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 · BashTool · ×1
  • BashTool::execute_background (cyclomatic 19) REDACTED:1234 — BashTool::execute_background has cyclomatic complexity 19 (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.
D1 · Cyclomatic Complexity · McpClient · ×1
  • McpClient::connect_in_dir (cyclomatic 19) crates/jcode-base/src/mcp/client.rs:195 — McpClient::connect_in_dir 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 · worker.normalizeDiscoveryEvent (cyclomatic 19) · ×1
  • worker.normalizeDiscoveryEvent (cyclomatic 19) telemetry-worker/src/worker.js:2243 — worker.normalizeDiscoveryEvent 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.
D1 · Cyclomatic Complexity · DiscoverToolsTool · ×1
  • DiscoverToolsTool::execute (cyclomatic 18) crates/jcode-app-core/src/tool/discover.rs:527 — DiscoverToolsTool::execute has cyclomatic complexity 18 (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.
D1 · Cyclomatic Complexity · DeflateStream · ×1
  • DeflateStream::accept_write (cyclomatic 18) crates/jcode-provider-core/src/ws_deflate.rs:413 — DeflateStream::accept_write 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 · EndpointInfo · ×1
  • EndpointInfo::detail_string (cyclomatic 18) crates/jcode-provider-openrouter/src/lib.rs:134 — EndpointInfo::detail_string 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.
D1 · Cyclomatic Complexity · FlowInner · ×1
  • FlowInner::execute (cyclomatic 18) crates/jcode-sdk/src/auth.rs:518 — FlowInner::execute 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 · IncrementalMarkdownRenderer · ×1
  • IncrementalMarkdownRenderer::render_split (cyclomatic 18) crates/jcode-tui-markdown/src/markdown_incremental.rs:153 — IncrementalMarkdownRenderer::render_split 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.
D1 · Cyclomatic Complexity · remote.recent_messages (cyclomatic 18) · ×1
  • remote.recent_messages (cyclomatic 18) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:130 — remote.recent_messages 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 · JcodeClient.run (cyclomatic 18) · ×1
  • JcodeClient.run (cyclomatic 18) sdk/typescript/src/client.ts:1357 — JcodeClient.run has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · scheduled (cyclomatic 18) · ×1
  • scheduled (cyclomatic 18) telemetry-worker/src/worker.js:698 — scheduled has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 700). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest. This is NOT this file's highest cyclomatic complexity: isMeaningfulLifecycleEvent (cyclomatic 40) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · jcode_compaction_core · ×1
  • jcode_compaction_core::build_compaction_conversation_text (cyclomatic 17) crates/jcode-compaction-core/src/lib.rs:162 — jcode_compaction_core::build_compaction_conversation_text 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.
D1 · Cyclomatic Complexity · jcode_memory_types · ×1
  • jcode_memory_types::format_entries_for_prompt_with_header (cyclomatic 17) crates/jcode-memory-types/src/lib.rs:664 — jcode_memory_types::format_entries_for_prompt_with_header has cyclomatic complexity 17 (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.
D1 · Cyclomatic Complexity · jcode_storage · ×1
  • jcode_storage::run_windows_hardening_worker (cyclomatic 17) crates/jcode-storage/src/lib.rs:358 — jcode_storage::run_windows_hardening_worker 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.
D1 · Cyclomatic Complexity · AnchorStabilityRecorder · ×1
  • AnchorStabilityRecorder::observe (cyclomatic 17) crates/jcode-tui-core/src/anchor_stability.rs:212 — AnchorStabilityRecorder::observe has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Decoder · ×1
  • Decoder::event (cyclomatic 17) crates/jcode-voice/src/global/hotkey.rs:348 — Decoder::event has cyclomatic complexity 17 (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.
D1 · Cyclomatic Complexity · remote.value_end (cyclomatic 17) · ×1
  • remote.value_end (cyclomatic 17) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:60 — remote.value_end 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.
D1 · Cyclomatic Complexity · worker.validateTranscript (cyclomatic 17) · ×1
  • worker.validateTranscript (cyclomatic 17) telemetry-worker/src/worker.js:867 — worker.validateTranscript has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Companion · ×1
  • Companion::handle (cyclomatic 16) crates/jcode-companion/src/server.rs:133 — Companion::handle 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.
D1 · Cyclomatic Complexity · jcode_companion · ×1
  • jcode_companion::voice::run (cyclomatic 16) crates/jcode-companion/src/voice.rs:94 — jcode_companion::voice::run 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 · jcode_core · ×1
  • jcode_core::util::split_concatenated_json (cyclomatic 16) crates/jcode-core/src/util.rs:176 — jcode_core::util::split_concatenated_json 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 · AnthropicProvider · ×1
  • AnthropicProvider::get_oauth_access_token (cyclomatic 16) crates/jcode-provider-anthropic-runtime/src/lib.rs:1010 — AnthropicProvider::get_oauth_access_token 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 · Snapshot · ×1
  • Snapshot::row (cyclomatic 16) crates/jcode-tui/src/tui/justrust_status.rs:158 — Snapshot::row 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 · jcode_update_core · ×1
  • jcode_update_core::known_update_error_summary (cyclomatic 16) crates/jcode-update-core/src/lib.rs:286 — jcode_update_core::known_update_error_summary 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 · TranscriptState · ×1
  • TranscriptState::apply (cyclomatic 16) crates/jcode-voice/src/nari.rs:626 — TranscriptState::apply 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 · Target · ×1
  • Target::preflight_uncached (cyclomatic 16) src/cli/cloud_move/transport.rs:206 — Target::preflight_uncached 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 · worker.normalizeInstallFunnelEvent (cyclomatic 16) · ×1
  • worker.normalizeInstallFunnelEvent (cyclomatic 16) telemetry-worker/src/worker.js:2187 — worker.normalizeInstallFunnelEvent 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.
D10 · Test Quality · Fixed-sleep synchronisation · ×1
  • Fixed-sleep synchronisation: concurrent configuration is rejected without changing the callback table sdk/typescript/test/tools.test.ts:159 — This test starts work it did not wait for (`first`, still running when the sleep starts) and then orders itself against it with `delay(5)` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
D2 · Cognitive Complexity · Config · ×1
  • Config::apply_env_overrides (cognitive 418) crates/jcode-base/src/config/env_overrides.rs:9 — Config::apply_env_overrides has cognitive complexity 418 (threshold 15). Drivers by points: if/else 284 (380 pts), boolean chains 27, match/switch 4 (8 pts), loops 2 (3 pts) (nesting depth added 101). Of this number, 413 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_openrouter · ×1
  • jcode_provider_openrouter::request::build_chat_messages (cognitive 239) crates/jcode-provider-openrouter/src/request.rs:49 — jcode_provider_openrouter::request::build_chat_messages has cognitive complexity 239 (threshold 15). Drivers by points: if/else 67 (173 pts), loops 19 (43 pts), match/switch 4 (13 pts), boolean chains 10 (nesting depth added 139). 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 · insertEvent (cognitive 145) · ×1
  • insertEvent (cognitive 145) telemetry-worker/src/worker.js:1183 — insertEvent has cognitive complexity 145 (threshold 15). Drivers by points: boolean chains 88, if/else 27 (36 pts), other 16, error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CommunicateTool · ×1
  • CommunicateTool::execute (cognitive 125) crates/jcode-app-core/src/tool/communicate.rs:810 — CommunicateTool::execute has cognitive complexity 125 (threshold 15). Drivers by points: match/switch 34 (59 pts), if/else 25 (55 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 59). 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 · ApplyPatchTool · ×1
  • ApplyPatchTool::execute (cognitive 103) crates/jcode-app-core/src/tool/apply_patch.rs:94 — ApplyPatchTool::execute has cognitive complexity 103 (threshold 15). Drivers by points: if/else 31 (81 pts), loops 6 (10 pts), match/switch 4 (7 pts), boolean chains 5 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIProvider · ×1
  • OpenAIProvider::complete (cognitive 98) crates/jcode-provider-openai-runtime/src/openai_provider_impl.rs:129 — OpenAIProvider::complete has cognitive complexity 98 (threshold 15). Drivers by points: if/else 41 (83 pts), match/switch 6 (12 pts), boolean chains 2, loops 1 (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.
D2 · Cognitive Complexity · GmailTool · ×1
  • GmailTool::execute (cognitive 91) crates/jcode-app-core/src/tool/gmail.rs:155 — GmailTool::execute has cognitive complexity 91 (threshold 15). Drivers by points: if/else 32 (60 pts), loops 8 (16 pts), match/switch 6 (14 pts), boolean chains 1 (nesting depth added 44). 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 · ProviderCard · ×1
  • ProviderCard::body_lines (cognitive 86) crates/jcode-tui/src/tui/ui_messages/usage.rs:304 — ProviderCard::body_lines has cognitive complexity 86 (threshold 15). Drivers by points: if/else 20 (48 pts), loops 8 (24 pts), match/switch 7 (11 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · jcode_provider_copilot · ×1
  • jcode_provider_copilot::build_messages (cognitive 85) crates/jcode-provider-copilot/src/lib.rs:67 — jcode_provider_copilot::build_messages has cognitive complexity 85 (threshold 15). Drivers by points: if/else 18 (55 pts), loops 7 (19 pts), match/switch 3 (10 pts), boolean chains 1 (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.
D2 · Cognitive Complexity · fetch (cognitive 73) · ×1
  • fetch (cognitive 73) telemetry-worker/src/worker.js:510 — fetch has cognitive complexity 73 (threshold 15). Drivers by points: if/else 30 (39 pts), boolean chains 18, ternaries 7 (12 pts), error handling 3 (4 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.
D2 · Cognitive Complexity · jcode_harness_api_server · ×1
  • jcode_harness_api_server::run_bridge_stream (cognitive 69) crates/jcode-harness-api-server/src/lib.rs:316 — jcode_harness_api_server::run_bridge_stream has cognitive complexity 69 (threshold 15). Drivers by points: if/else 15 (40 pts), match/switch 7 (20 pts), loops 3 (7 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · MemoryTool · ×1
  • MemoryTool::execute (cognitive 64) crates/jcode-app-core/src/tool/memory.rs:129 — MemoryTool::execute has cognitive complexity 64 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 5 (15 pts), match/switch 4 (9 pts) (nesting depth added 33). 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 · jcode_protocol · ×1
  • jcode_protocol::comm_format::format_comm_members (cognitive 64) crates/jcode-protocol/src/comm_format.rs:134 — jcode_protocol::comm_format::format_comm_members has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 8 (25 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 35). 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 · pruneOldEvents (cognitive 60) · ×1
  • pruneOldEvents (cognitive 60) telemetry-worker/src/worker.js:1044 — pruneOldEvents has cognitive complexity 60 (threshold 15). Drivers by points: error handling 6 (21 pts), if/else 7 (21 pts), boolean chains 8, loops 4 (6 pts), other 4 (nesting depth added 31). 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 · BgTool · ×1
  • BgTool::execute (cognitive 59) crates/jcode-app-core/src/tool/bg.rs:559 — BgTool::execute has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (34 pts), match/switch 7 (15 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 33). 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 · Listener · ×1
  • Listener::poll (cognitive 52) crates/jcode-voice/src/global/hotkey.rs:694 — Listener::poll has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 5 (16 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConversationSearchTool · ×1
  • ConversationSearchTool::execute (cognitive 51) crates/jcode-app-core/src/tool/conversation_search.rs:83 — ConversationSearchTool::execute has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 3 (13 pts), loops 3 (10 pts) (nesting depth added 31). 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 · cloud_directories_probe.collect (cognitive 51) · ×1
  • cloud_directories_probe.collect (cognitive 51) crates/jcode-tui/src/tui/cloud_directories_probe.py:201 — cloud_directories_probe.collect has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 9, loops 6 (7 pts), error handling 2 (4 pts), ternaries 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JcodeClient.globalEvents (cognitive 50) · ×1
  • JcodeClient.globalEvents (cognitive 50) sdk/typescript/src/client.ts:1148 — JcodeClient.globalEvents has cognitive complexity 50 (threshold 15). Drivers by points: if/else 29 (33 pts), boolean chains 7, ternaries 2 (6 pts), error handling 2, loops 2 (nesting depth added 8). Most of this is not in the body itself: 8 of the 50 points are its own statements and the rest belongs to 7 function items inside it that branch (startChild, scan, finish, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · AmbientRunnerHandle · ×1
  • AmbientRunnerHandle::run_loop (cognitive 46) crates/jcode-app-core/src/ambient/runner.rs:555 — AmbientRunnerHandle::run_loop has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 8 (21 pts), boolean chains 3, loops 1 (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 · InitiativeTool · ×1
  • InitiativeTool::execute (cognitive 46) crates/jcode-app-core/src/tool/goal.rs:144 — InitiativeTool::execute has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (41 pts), match/switch 2 (4 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.
D2 · Cognitive Complexity · insertTurnDetails (cognitive 46) · ×1
  • insertTurnDetails (cognitive 46) telemetry-worker/src/worker.js:1579 — insertTurnDetails has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 34, other 10, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · remote.recent_messages (cognitive 45) · ×1
  • remote.recent_messages (cognitive 45) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:130 — remote.recent_messages has cognitive complexity 45 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 5 (14 pts), ternaries 1 (7 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · launch.launchInstance (cognitive 43) · ×1
  • launch.launchInstance (cognitive 43) sdk/typescript/src/launch.ts:522 — launch.launchInstance has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 5 (10 pts), ternaries 4 (6 pts), loops 3 (4 pts) (nesting depth added 17). Of this number, 17 points are the body's own statements and 26 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramChannel · ×1
  • TelegramChannel::reply_loop (cognitive 42) crates/jcode-app-core/src/channel.rs:198 — TelegramChannel::reply_loop has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (28 pts), match/switch 3 (10 pts), loops 2 (4 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.
D2 · Cognitive Complexity · TranscriptSearch · ×1
  • TranscriptSearch::poll (cognitive 42) crates/jcode-tui/src/tui/session_picker/transcript_search.rs:613 — TranscriptSearch::poll has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 5 (10 pts), match/switch 3 (7 pts) (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 · ChannelIndex · ×1
  • ChannelIndex::remove_session (cognitive 41) crates/jcode-swarm-core/src/lib.rs:277 — ChannelIndex::remove_session has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 4 (10 pts) (nesting depth added 28). 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 · remote.main (cognitive 41) · ×1
  • remote.main (cognitive 41) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:206 — remote.main has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 4 (10 pts), boolean chains 5, loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityProvider · ×1
  • AntigravityProvider::complete (cognitive 40) crates/jcode-provider-antigravity-runtime/src/lib.rs:450 — AntigravityProvider::complete has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 5 (10 pts), loops 2 (3 pts), boolean chains 1 (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.
D2 · Cognitive Complexity · remote.project (cognitive 40) · ×1
  • remote.project (cognitive 40) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:170 — remote.project has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (9 pts), boolean chains 6, ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiscordChannel · ×1
  • DiscordChannel::reply_loop (cognitive 39) crates/jcode-app-core/src/channel.rs:397 — DiscordChannel::reply_loop has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (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 · ColorReports · ×1
  • ColorReports::push (cognitive 38) crates/jcode-tui/src/tui/terminal_events.rs:94 — ColorReports::push has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 15 (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 · concurrency.classifyConcurrency (cognitive 38) · ×1
  • concurrency.classifyConcurrency (cognitive 38) telemetry-worker/src/concurrency.js:20 — concurrency.classifyConcurrency has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (26 pts), boolean chains 9, loops 3 (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.
D2 · Cognitive Complexity · worker.normalizeWebEvent (cognitive 38) · ×1
  • worker.normalizeWebEvent (cognitive 38) telemetry-worker/src/worker.js:2102 — worker.normalizeWebEvent has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 13, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeSshTransport · ×1
  • NativeSshTransport::connect (cognitive 37) crates/jcode-sdk/src/native_ssh.rs:176 — NativeSshTransport::connect has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 7 (15 pts), loops 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.
D2 · Cognitive Complexity · AcpRuntime · ×1
  • AcpRuntime::run_prompt (cognitive 37) src/cli/acp.rs:1107 — AcpRuntime::run_prompt has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 5 (9 pts), loops 2 (4 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.
D2 · Cognitive Complexity · normalizeUsageReportEvent (cognitive 37) · ×1
  • normalizeUsageReportEvent (cognitive 37) telemetry-worker/src/worker.js:2359 — normalizeUsageReportEvent has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 13, loops 2, other 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpClient · ×1
  • McpClient::connect_in_dir (cognitive 35) crates/jcode-base/src/mcp/client.rs:195 — McpClient::connect_in_dir has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 2 (4 pts), loops 3 (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.
D2 · Cognitive Complexity · FollowUpPolicy · ×1
  • FollowUpPolicy::decide_after_turn (cognitive 34) crates/jcode-todo-policy/src/followup.rs:267 — FollowUpPolicy::decide_after_turn has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 14 (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.
D2 · Cognitive Complexity · score_shard.score (cognitive 34) · ×1
  • score_shard.score (cognitive 34) score_shard.py:4 — score_shard.score has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 9, ternaries 2 (6 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 · oauthAccount (cognitive 33) · ×1
  • oauthAccount (cognitive 33) telemetry-worker/src/oauth-account.js:14 — oauthAccount has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 11, error handling 2, loops 2, ternaries 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 · JadeRelayChannel · ×1
  • JadeRelayChannel::reply_loop (cognitive 32) crates/jcode-app-core/src/channel.rs:667 — JadeRelayChannel::reply_loop has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_doctor · ×1
  • jcode_provider_doctor::live_provider_probes::consume_native_stream (cognitive 32) crates/jcode-provider-doctor/src/live_provider_probes.rs:595 — jcode_provider_doctor::live_provider_probes::consume_native_stream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (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.
D2 · Cognitive Complexity · jcode_storage · ×1
  • jcode_storage::run_windows_hardening_worker (cognitive 32) crates/jcode-storage/src/lib.rs:358 — jcode_storage::run_windows_hardening_worker has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 7 (13 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.
D2 · Cognitive Complexity · jcode_terminal_image · ×1
  • jcode_terminal_image::display::get_image_dimensions (cognitive 32) crates/jcode-terminal-image/src/display.rs:229 — jcode_terminal_image::display::get_image_dimensions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 9, loops 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.
D2 · Cognitive Complexity · insertSessionDetails (cognitive 32) · ×1
  • insertSessionDetails (cognitive 32) telemetry-worker/src/worker.js:1793 — insertSessionDetails has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 25, other 5, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · jcode_tui_visual_debug · ×1
  • jcode_tui_visual_debug::write_frame (cognitive 31) crates/jcode-tui-visual-debug/src/lib.rs:576 — jcode_tui_visual_debug::write_frame has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19, loops 6 (12 pts) (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.
D2 · Cognitive Complexity · launch.inheritCredentials (cognitive 30) · ×1
  • launch.inheritCredentials (cognitive 30) sdk/typescript/src/launch.ts:242 — launch.inheritCredentials has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (6 pts), boolean chains 4, error handling 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 · resolvePriceRows (cognitive 30) · ×1
  • resolvePriceRows (cognitive 30) telemetry-worker/src/model-pricing.js:160 — resolvePriceRows has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (12 pts), other 8, ternaries 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BashTool · ×1
  • BashTool::execute_background (cognitive 29) REDACTED:1234 — BashTool::execute_background has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 8 (15 pts), if/else 9 (11 pts), boolean chains 2, loops 1 (nesting depth added 9). 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 · FlowInner · ×1
  • FlowInner::execute (cognitive 29) crates/jcode-sdk/src/auth.rs:518 — FlowInner::execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scheduled (cognitive 28) · ×1
  • scheduled (cognitive 28) telemetry-worker/src/worker.js:698 — scheduled has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 4 (8 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 11). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 700). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MessagePayload · ×1
  • MessagePayload::extract_text (cognitive 26) crates/jcode-base/src/gmail.rs:1063 — MessagePayload::extract_text has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 1 (2 pts) (nesting depth added 17). 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 · SshConnectOptions · ×1
  • SshConnectOptions::validate (cognitive 26) crates/jcode-sdk/src/ssh.rs:82 — SshConnectOptions::validate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, match/switch 2 (5 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.
D2 · Cognitive Complexity · structured.firstJsonContainer (cognitive 26) · ×1
  • structured.firstJsonContainer (cognitive 26) sdk/typescript/src/structured.ts:181 — structured.firstJsonContainer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 1 (3 pts), boolean chains 2, loops 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.
D2 · Cognitive Complexity · DiscoverToolsTool · ×1
  • DiscoverToolsTool::execute (cognitive 25) crates/jcode-app-core/src/tool/discover.rs:527 — DiscoverToolsTool::execute has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 9 (13 pts), if/else 8 (12 pts) (nesting depth added 8). 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 · Walk · ×1
  • Walk::node (cognitive 25) crates/jcode-applet-types/src/validate.rs:213 — Walk::node has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (7 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · NariSession · ×1
  • NariSession::run_inner (cognitive 25) crates/jcode-voice/src/nari.rs:460 — NariSession::run_inner has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 2, match/switch 1 (2 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.
D2 · Cognitive Complexity · insertTodoSessionDetails (cognitive 25) · ×1
  • insertTodoSessionDetails (cognitive 25) telemetry-worker/src/worker.js:2015 — insertTodoSessionDetails has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, other 10, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · jcode_provider_gemini · ×1
  • jcode_provider_gemini::build_contents_with_signature_policy (cognitive 24) crates/jcode-provider-gemini/src/lib.rs:287 — jcode_provider_gemini::build_contents_with_signature_policy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 2 (3 pts), loops 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.
D2 · Cognitive Complexity · RelayClient · ×1
  • RelayClient::run_from_after (cognitive 23) crates/jcode-app-core/src/server/jade_relay.rs:243 — RelayClient::run_from_after has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (6 pts), loops 2 (4 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.
D2 · Cognitive Complexity · AppletTool · ×1
  • AppletTool::execute (cognitive 23) crates/jcode-app-core/src/tool/applet.rs:233 — AppletTool::execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 7 (10 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.
D2 · Cognitive Complexity · CalendarTool · ×1
  • CalendarTool::execute (cognitive 23) crates/jcode-app-core/src/tool/calendar.rs:317 — CalendarTool::execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (8 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TodoTool · ×1
  • TodoTool::execute (cognitive 23) crates/jcode-app-core/src/tool/todo.rs:1607 — TodoTool::execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpConfig · ×1
  • McpConfig::load_for_dir (cognitive 23) crates/jcode-base/src/mcp/protocol.rs:716 — McpConfig::load_for_dir has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranscriptState · ×1
  • TranscriptState::apply (cognitive 23) crates/jcode-voice/src/nari.rs:626 — TranscriptState::apply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · worker.isMeaningfulLifecycleEvent (cognitive 23) · ×1
  • worker.isMeaningfulLifecycleEvent (cognitive 23) telemetry-worker/src/worker.js:1751 — worker.isMeaningfulLifecycleEvent has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 20, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ReadTool · ×1
  • ReadTool::execute (cognitive 22) crates/jcode-app-core/src/tool/read.rs:150 — ReadTool::execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (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.
D2 · Cognitive Complexity · jcode_provider_antigravity · ×1
  • jcode_provider_antigravity::flatten_schema_combiners (cognitive 22) crates/jcode-provider-antigravity/src/lib.rs:627 — jcode_provider_antigravity::flatten_schema_combiners has cognitive complexity 22 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (8 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Registration · ×1
  • Registration::capture (cognitive 22) crates/jcode-voice/src/global/hotkey.rs:215 — Registration::capture has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (4 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.
D2 · Cognitive Complexity · cloud_directories_probe.session_fields (cognitive 22) · ×1
  • cloud_directories_probe.session_fields (cognitive 22) crates/jcode-tui/src/tui/cloud_directories_probe.py:157 — cloud_directories_probe.session_fields has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (4 pts), loops 2 (4 pts), ternaries 1 (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 · McpManager · ×1
  • McpManager::connect_all (cognitive 21) crates/jcode-base/src/mcp/manager.rs:183 — McpManager::connect_all has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SseParser · ×1
  • SseParser::push (cognitive 21) crates/jcode-base/src/mcp/remote.rs:977 — SseParser::push has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_notify_email · ×1
  • jcode_notify_email::poll_imap_once (cognitive 21) crates/jcode-notify-email/src/lib.rs:65 — jcode_notify_email::poll_imap_once has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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.
D2 · Cognitive Complexity · SharedSshTransport · ×1
  • SharedSshTransport::connect_with (cognitive 21) crates/jcode-sdk/src/ssh.rs:420 — SharedSshTransport::connect_with has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamBuffer · ×1
  • StreamBuffer::drain_ops (cognitive 21) crates/jcode-tui-core/src/stream_buffer.rs:303 — StreamBuffer::drain_ops has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (5 pts), loops 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 · remote.value_end (cognitive 21) · ×1
  • remote.value_end (cognitive 21) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:60 — remote.value_end has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 pts), boolean chains 3, loops 2 (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 · buildPriceIndex (cognitive 21) · ×1
  • buildPriceIndex (cognitive 21) telemetry-worker/src/model-pricing.js:122 — buildPriceIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), loops 3 (4 pts), other 2, boolean chains 1 (nesting depth added 10). Of this number, 13 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalizeDiscoveryEvent (cognitive 21) · ×1
  • normalizeDiscoveryEvent (cognitive 21) telemetry-worker/src/worker.js:2243 — normalizeDiscoveryEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 3, loops 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.
D2 · Cognitive Complexity · RelayLauncherClient · ×1
  • RelayLauncherClient::run (cognitive 20) crates/jcode-app-core/src/server/jade_relay.rs:605 — RelayLauncherClient::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 pts), match/switch 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 · McpCallTool · ×1
  • McpCallTool::execute (cognitive 20) crates/jcode-app-core/src/tool/mcp.rs:366 — McpCallTool::execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 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.
D2 · Cognitive Complexity · GlobalEventStream · ×1
  • GlobalEventStream::next (cognitive 20) crates/jcode-sdk/src/client.rs:230 — GlobalEventStream::next has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 1 (2 pts), loops 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.
D2 · Cognitive Complexity · AnchorStabilityRecorder · ×1
  • AnchorStabilityRecorder::observe (cognitive 20) crates/jcode-tui-core/src/anchor_stability.rs:212 — AnchorStabilityRecorder::observe has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · writeFirehose (cognitive 20) · ×1
  • writeFirehose (cognitive 20) telemetry-worker/src/worker.js:374 — writeFirehose has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 2, error handling 1, other 1. Of this number, 14 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · jcode_memory_types · ×1
  • jcode_memory_types::format_entries_for_prompt_with_header (cognitive 19) crates/jcode-memory-types/src/lib.rs:664 — jcode_memory_types::format_entries_for_prompt_with_header has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 5, match/switch 2 (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.
D2 · Cognitive Complexity · jcode_message_types · ×1
  • jcode_message_types::ends_with_fresh_user_turn (cognitive 19) crates/jcode-message-types/src/lib.rs:484 — jcode_message_types::ends_with_fresh_user_turn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EndpointInfo · ×1
  • EndpointInfo::detail_string (cognitive 19) crates/jcode-provider-openrouter/src/lib.rs:134 — EndpointInfo::detail_string has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · SyncPipeOperation · ×1
  • SyncPipeOperation::complete (cognitive 19) crates/jcode-transport/src/windows.rs:474 — SyncPipeOperation::complete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (4 pts), loops 1 (2 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.
D2 · Cognitive Complexity · Scan · ×1
  • Scan::normalized_text (cognitive 19) crates/jcode-tui/src/tui/session_picker/transcript_search.rs:1133 — Scan::normalized_text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jcode_provider_env · ×1
  • jcode_provider_env::load_api_key_from_env_or_config (cognitive 19) crates/jcode-provider-env/src/lib.rs:85 — jcode_provider_env::load_api_key_from_env_or_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JcodeClient.ingest (cognitive 19) · ×1
  • JcodeClient.ingest (cognitive 19) sdk/typescript/src/client.ts:343 — JcodeClient.ingest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · move-bulk-events.q (cognitive 19) · ×1
  • move-bulk-events.q (cognitive 19) telemetry-worker/scripts/move-bulk-events.mjs:32 — move-bulk-events.q has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Projection · ×1
  • Projection::observe (cognitive 18) crates/jcode-app-core/src/server/live_status.rs:57 — Projection::observe has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (4 pts), boolean chains 1 (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.
D2 · Cognitive Complexity · BuildRequest · ×1
  • BuildRequest::reconcile_pending_state (cognitive 18) crates/jcode-app-core/src/tool/selfdev/mod.rs:373 — BuildRequest::reconcile_pending_state 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.
D2 · Cognitive Complexity · WebFetchTool · ×1
  • WebFetchTool::execute (cognitive 18) crates/jcode-app-core/src/tool/webfetch.rs:70 — WebFetchTool::execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1, 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.
D2 · Cognitive Complexity · Embedder · ×1
  • Embedder::embed (cognitive 18) crates/jcode-embedding/src/lib.rs:172 — Embedder::embed has cognitive complexity 18 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · UsageOverlay · ×1
  • UsageOverlay::render_item_list (cognitive 18) crates/jcode-tui-usage-overlay/src/lib.rs:507 — UsageOverlay::render_item_list has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 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 · jcode_terminal_prompt · ×1
  • jcode_terminal_prompt::secret::read_secret_line (cognitive 18) crates/jcode-terminal-prompt/src/secret.rs:27 — jcode_terminal_prompt::secret::read_secret_line has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · insertWebDetails (cognitive 18) · ×1
  • insertWebDetails (cognitive 18) telemetry-worker/src/worker.js:2051 — insertWebDetails has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 2, other 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WriteTool · ×1
  • WriteTool::execute (cognitive 17) crates/jcode-app-core/src/tool/write.rs:57 — WriteTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 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.
D2 · Cognitive Complexity · McpTool · ×1
  • McpTool::execute (cognitive 17) crates/jcode-base/src/mcp/tool.rs:53 — McpTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 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.
D2 · Cognitive Complexity · ServerRegistry · ×1
  • ServerRegistry::cleanup_stale (cognitive 17) crates/jcode-base/src/registry.rs:125 — ServerRegistry::cleanup_stale has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3, 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.
D2 · Cognitive Complexity · jcode_session_types · ×1
  • jcode_session_types::format_session_search_results (cognitive 17) crates/jcode-session-types/src/lib.rs:754 — jcode_session_types::format_session_search_results has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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 · AnchoredInlineImages · ×1
  • AnchoredInlineImages::unplaced_items (cognitive 17) crates/jcode-tui/src/tui/ui_inline_image.rs:728 — AnchoredInlineImages::unplaced_items has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3, match/switch 1 (2 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.
D2 · Cognitive Complexity · jcode_usage_types · ×1
  • jcode_usage_types::sanitize_telemetry_label (cognitive 17) crates/jcode-usage-types/src/lib.rs:834 — jcode_usage_types::sanitize_telemetry_label has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 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 · Chunker · ×1
  • Chunker::push (cognitive 17) crates/jcode-voice/src/streaming_capture.rs:174 — Chunker::push has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 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 · remote.fields (cognitive 17) · ×1
  • remote.fields (cognitive 17) crates/jcode-tui/src/tui/session_picker/cloud_preview/remote.py:89 — remote.fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompactionManager · ×1
  • CompactionManager::ensure_context_fits (cognitive 16) crates/jcode-base/src/compaction.rs:981 — CompactionManager::ensure_context_fits has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 2 (5 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 · jcode_build_support · ×1
  • jcode_build_support::version_gc::prune_old_versions_in (cognitive 16) crates/jcode-build-support/src/version_gc.rs:165 — jcode_build_support::version_gc::prune_old_versions_in has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Companion · ×1
  • Companion::handle (cognitive 16) crates/jcode-companion/src/server.rs:133 — Companion::handle has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (8 pts), if/else 5 (7 pts), boolean chains 1 (nesting depth added 5). 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 · AuthRetryStream · ×1
  • AuthRetryStream::poll_next (cognitive 16) crates/jcode-provider-grok-build-runtime/src/lib.rs:122 — AuthRetryStream::poll_next has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Expr · ×1
  • Expr::layout (cognitive 16) crates/jcode-render-core/src/math.rs:107 — Expr::layout has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 8). 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 · ResolvedTokenPricing · ×1
  • ResolvedTokenPricing::cost_for_usage (cognitive 16) crates/jcode-tui/src/tui/app/misc_ui.rs:33 — ResolvedTokenPricing::cost_for_usage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteConnection · ×1
  • RemoteConnection::next_event (cognitive 16) crates/jcode-tui/src/tui/backend.rs:1460 — RemoteConnection::next_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Snapshot · ×1
  • Snapshot::row (cognitive 16) crates/jcode-tui/src/tui/justrust_status.rs:158 — Snapshot::row has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · Poller · ×1
  • Poller::refresh (cognitive 16) crates/jcode-tui/src/tui/justrust_status.rs:324 — Poller::refresh has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · worker.validateTranscript (cognitive 16) · ×1
  • worker.validateTranscript (cognitive 16) telemetry-worker/src/worker.js:867 — worker.validateTranscript has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · worker.normalizeInstallFunnelEvent (cognitive 16) · ×1
  • worker.normalizeInstallFunnelEvent (cognitive 16) telemetry-worker/src/worker.js:2187 — worker.normalizeInstallFunnelEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · syncModelPrices (cognitive 16) · ×1
  • syncModelPrices (cognitive 16) telemetry-worker/src/model-pricing.js:320 — syncModelPrices has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (5 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts), loops 2, other 2 (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.
D30 · Dependency Vulnerabilities · Medium CVE · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · 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 (3 members, 28 shared lines) · ×1
  • Near-duplicate member family (3 members, 28 shared lines) crates/jcode-app-core/src/tool/discover.rs:991 — crates/jcode-app-core/src/tool/discover.rs:991-1062 | crates/jcode-app-core/src/tool/discover.rs:1180-1256 | crates/jcode-app-core/src/tool/discover.rs:1261-1350 — These 3 members are variants of one another: a block of 28 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (849 shared lines) · ×1
  • Near-duplicate member pair (849 shared lines) crates/jcode-tui-markdown/src/markdown_render_full.rs:28 — crates/jcode-tui-markdown/src/markdown_render_full.rs:28-1089 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:21-984 — These two members are variants of one another: 849 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 (95 shared lines) · ×1
  • Near-duplicate member pair (95 shared lines) crates/jcode-provider-anthropic-runtime/src/lib.rs:1282 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1282-1384 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1728-1829 — These two members are variants of one another: 95 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 (92 shared lines) · ×1
  • Near-duplicate member pair (92 shared lines) crates/jcode-provider-antigravity-runtime/src/lib.rs:456 — crates/jcode-provider-antigravity-runtime/src/lib.rs:456-771 | crates/jcode-provider-gemini-runtime/src/lib.rs:611-941 — These two members are variants of one another: 92 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 (89 shared lines) · ×1
  • Near-duplicate member pair (89 shared lines) crates/jcode-tui-mermaid/src/mermaid_widget.rs:87 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:87-311 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:341-548 — These two members are variants of one another: 89 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 (88 shared lines) · ×1
  • Near-duplicate member pair (88 shared lines) crates/jcode-render-core/src/preprocess.rs:779 — crates/jcode-render-core/src/preprocess.rs:779-929 | crates/jcode-tui-markdown/src/markdown_text_preprocess.rs:3-126 — These two members are variants of one another: 88 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) crates/jcode-base/src/background.rs:449 — crates/jcode-base/src/background.rs:449-633 | crates/jcode-base/src/background.rs:661-850 — 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 (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) crates/jcode-tui/src/tui/ui_prepare.rs:2650 — crates/jcode-tui/src/tui/ui_prepare.rs:2650-2744 | crates/jcode-tui/src/tui/ui_prepare.rs:2771-2936 — These two members are variants of one another: 53 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 (48 shared lines) · ×1
  • Near-duplicate member pair (48 shared lines) crates/jcode-base/src/provider/dispatch.rs:64 — crates/jcode-base/src/provider/dispatch.rs:64-181 | crates/jcode-base/src/provider/dispatch.rs:191-356 — These two members are variants of one another: 48 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 (47 shared lines) · ×1
  • Near-duplicate member pair (47 shared lines) crates/jcode-tui/src/tui/login_picker.rs:679 — crates/jcode-tui/src/tui/login_picker.rs:679-752 | crates/jcode-tui/src/tui/login_picker.rs:754-827 — These two members are variants of one another: 47 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 (46 shared lines) · ×1
  • Near-duplicate member pair (46 shared lines) crates/jcode-base/src/auth/oauth_callback_io.rs:93 — crates/jcode-base/src/auth/oauth_callback_io.rs:93-183 | crates/jcode-base/src/auth/oauth_callback_io.rs:200-306 — These two members are variants of one another: 46 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) crates/jcode-app-core/src/channel.rs:198 — crates/jcode-app-core/src/channel.rs:198-280 | crates/jcode-app-core/src/channel.rs:397-489 — 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 (35 shared lines) · ×1
  • Near-duplicate member pair (35 shared lines) crates/jcode-tui/src/tui/app/remote/reconnect.rs:270 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:270-371 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:483-711 — These two members are variants of one another: 35 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 · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) crates/jcode-tui-account-picker/src/overlay.rs:458 — crates/jcode-tui-account-picker/src/overlay.rs:458-496 | crates/jcode-tui-account-picker/src/overlay.rs:498-577 | crates/jcode-tui-account-picker/src/overlay.rs:579-771 | crates/jcode-tui-usage-overlay/src/lib.rs:440-505 | crates/jcode-tui-usage-overlay/src/lib.rs:507-588 | crates/jcode-tui-usage-overlay/src/lib.rs:590-638 | crates/jcode-tui/src/tui/login_picker.rs:346-402 | crates/jcode-tui/src/tui/login_picker.rs:404-470 | crates/jcode-tui/src/tui/login_picker.rs:472-593 — These 9 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 9 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 9 times.
D4 · Code Duplication · Edited copy of a member (92 corresponding lines) · ×1
  • Edited copy of a member (92 corresponding lines) crates/jcode-app-core/src/session_launch.rs:660 — crates/jcode-app-core/src/session_launch.rs:660-751 | crates/jcode-app-core/src/session_launch.rs:785-876 — These two members are one piece of code written twice and then edited apart: 92 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (95 corresponding lines) · ×1
  • Edited copy of a member (95 corresponding lines) crates/jcode-app-core/src/usage_openai.rs:314 — crates/jcode-app-core/src/usage_openai.rs:314-408 | crates/jcode-base/src/usage/openai_helpers.rs:339-441 — These two members are one piece of code written twice and then edited apart: 95 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (107 corresponding lines) · ×1
  • Edited copy of a member (107 corresponding lines) src/cli/commands.rs:2871 — src/cli/commands.rs:2871-2983 | src/cli/commands.rs:2988-3094 — These two members are one piece of code written twice and then edited apart: 107 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (96 corresponding lines) · ×1
  • Edited copy of a member (96 corresponding lines) crates/jcode-tui/src/tui/app/commands_improve.rs:601 — crates/jcode-tui/src/tui/app/commands_improve.rs:601-696 | crates/jcode-tui/src/tui/app/commands_improve.rs:698-793 — These two members are one piece of code written twice and then edited apart: 96 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (75 corresponding lines) · ×1
  • Edited copy of a member (75 corresponding lines) crates/jcode-app-core/src/tool/session_search.rs:1378 — crates/jcode-app-core/src/tool/session_search.rs:1378-1452 | crates/jcode-app-core/src/tool/session_search.rs:1506-1599 — These two members are one piece of code written twice and then edited apart: 75 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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, 61+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 61+ corresponding lines) crates/jcode-base/src/session/memory_profile.rs:61 — crates/jcode-base/src/session/memory_profile.rs:61-134 | crates/jcode-tui/src/tui/app/debug.rs:347-412 | crates/jcode-tui/src/tui/memory_profile.rs:191-251 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 61 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 (62 corresponding lines) · ×1
  • Edited copy of a member (62 corresponding lines) crates/jcode-provider-bedrock/src/lib.rs:386 — crates/jcode-provider-bedrock/src/lib.rs:386-447 | crates/jcode-schema-dialect/src/dialect.rs:331-399 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) crates/jcode-tui-account-picker/src/overlay.rs:309 — crates/jcode-tui-account-picker/src/overlay.rs:309-372 | crates/jcode-tui-usage-overlay/src/lib.rs:333-384 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (63 corresponding lines) · ×1
  • Edited copy of a member (63 corresponding lines) crates/jcode-render-core/src/preprocess.rs:69 — crates/jcode-render-core/src/preprocess.rs:69-132 | crates/jcode-render-core/src/preprocess.rs:141-203 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (64 corresponding lines) · ×1
  • Edited copy of a member (64 corresponding lines) crates/jcode-base/src/prompt.rs:390 — crates/jcode-base/src/prompt.rs:390-453 | crates/jcode-base/src/prompt.rs:526-601 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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) crates/jcode-base/src/session/crash.rs:68 — crates/jcode-base/src/session/crash.rs:68-118 | crates/jcode-base/src/session/crash.rs:204-268 — 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 (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) crates/jcode-app-core/src/message_notifications.rs:137 — crates/jcode-app-core/src/message_notifications.rs:137-193 | crates/jcode-base/src/message/notifications.rs:492-557 — 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 copies of one member (3 members, 53+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 53+ corresponding lines) crates/jcode-tui-account-picker/src/overlay.rs:402 — crates/jcode-tui-account-picker/src/overlay.rs:402-456 | crates/jcode-tui-usage-overlay/src/lib.rs:386-438 | crates/jcode-tui/src/tui/login_picker.rs:290-344 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 53 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 (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) crates/jcode-tui/src/tui/app/debug.rs:17 — crates/jcode-tui/src/tui/app/debug.rs:17-76 | src/bin/tui_bench.rs:147-206 — 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, 36+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 36+ corresponding lines) crates/jcode-import-core/src/lib.rs:461 — crates/jcode-import-core/src/lib.rs:461-502 | crates/jcode-import-core/src/lib.rs:1119-1156 | crates/jcode-tui/src/tui/session_picker/loading.rs:853-888 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 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) crates/jcode-base/src/auth/antigravity.rs:229 — crates/jcode-base/src/auth/antigravity.rs:229-286 | crates/jcode-base/REDACTED:353-416 — 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 copies of one member (3 members, 44+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 44+ corresponding lines) crates/jcode-tui/src/tui/app/commands.rs:2932 — crates/jcode-tui/src/tui/app/commands.rs:2932-2975 | crates/jcode-tui/src/tui/app/commands.rs:2977-3021 | crates/jcode-tui/src/tui/app/commands.rs:3023-3066 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 44 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, 39+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 39+ corresponding lines) crates/jcode-base/src/provider/mod.rs:1918 — crates/jcode-base/src/provider/mod.rs:1918-1957 | crates/jcode-base/src/provider/mod.rs:2359-2397 | crates/jcode-base/src/provider/mod.rs:2863-2901 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 39 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, 68+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 68+ corresponding lines) crates/jcode-app-core/src/server/background_tasks.rs:89 — crates/jcode-app-core/src/server/background_tasks.rs:89-162 | crates/jcode-app-core/src/server/background_tasks.rs:182-249 | crates/jcode-app-core/src/server/background_tasks.rs:268-340 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 68 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 (69 corresponding lines) · ×1
  • Edited copy of a member (69 corresponding lines) crates/jcode-app-core/src/server/client_comm_channels.rs:131 — crates/jcode-app-core/src/server/client_comm_channels.rs:131-199 | crates/jcode-app-core/src/server/client_comm_channels.rs:216-284 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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, 31+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 31+ corresponding lines) src/cli/commands.rs:593 — src/cli/commands.rs:593-623 | src/cli/commands.rs:848-880 | src/cli/commands.rs:1134-1168 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 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, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) crates/jcode-base/src/provider/mod.rs:2113 — crates/jcode-base/src/provider/mod.rs:2113-2148 | crates/jcode-base/src/provider/mod.rs:2677-2709 | crates/jcode-base/src/provider/mod.rs:2711-2740 — 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 copies of one member (3 members, 28+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 28+ corresponding lines) crates/jcode-tui/src/tui/app/misc_ui.rs:470 — crates/jcode-tui/src/tui/app/misc_ui.rs:470-497 | crates/jcode-tui/src/tui/app/misc_ui.rs:499-526 | crates/jcode-tui/src/tui/app/misc_ui.rs:528-565 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 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 (43 corresponding lines) · ×1
  • Edited copy of a member (43 corresponding lines) crates/jcode-tui/src/tui/app/commands_improve.rs:298 — crates/jcode-tui/src/tui/app/commands_improve.rs:298-340 | crates/jcode-tui/src/tui/app/commands_improve.rs:345-387 — 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 (31 corresponding lines) · ×1
  • Edited copy of a member (31 corresponding lines) src/cli/login/scriptable.rs:478 — src/cli/login/scriptable.rs:478-508 | src/cli/login/scriptable.rs:514-563 — 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 copies of one member (3 members, 29+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 29+ corresponding lines) crates/jcode-app-core/src/server/jade_relay.rs:358 — crates/jcode-app-core/src/server/jade_relay.rs:358-386 | crates/jcode-app-core/src/server/jade_relay.rs:712-740 | crates/jcode-app-core/src/server/jade_relay.rs:749-784 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 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, 40+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 40+ corresponding lines) src/cli/provider_init.rs:970 — src/cli/provider_init.rs:970-1014 | src/cli/provider_init.rs:1052-1091 | src/cli/provider_init.rs:1135-1178 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 40 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, 22+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 22+ corresponding lines) crates/jcode-tui/src/tui/app/observe.rs:46 — crates/jcode-tui/src/tui/app/observe.rs:46-67 | crates/jcode-tui/src/tui/app/split_view.rs:16-39 | crates/jcode-tui/src/tui/app/todos_view.rs:347-370 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 19+ corresponding lines) crates/jcode-tui-account-picker/src/overlay.rs:51 — crates/jcode-tui-account-picker/src/overlay.rs:51-78 | crates/jcode-tui-usage-overlay/src/lib.rs:249-267 | crates/jcode-tui/src/tui/login_picker.rs:147-165 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 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 (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) crates/jcode-base/src/provider/openrouter.rs:286 — crates/jcode-base/src/provider/openrouter.rs:286-310 | crates/jcode-provider-openrouter-runtime/src/lib.rs:366-390 — 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 copies of one member (3 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 24+ corresponding lines) src/cli/provider_init.rs:790 — src/cli/provider_init.rs:790-817 | src/cli/provider_init.rs:1198-1221 | src/cli/provider_init.rs:1250-1273 — 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 (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) crates/jcode-provider-gemini-runtime/src/lib.rs:358 — crates/jcode-provider-gemini-runtime/src/lib.rs:358-388 | crates/jcode-provider-gemini-runtime/src/lib.rs:397-419 | crates/jcode-provider-gemini-runtime/src/lib.rs:421-449 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) crates/jcode-app-core/src/telemetry_state.rs:266 — crates/jcode-app-core/src/telemetry_state.rs:266-286 | crates/jcode-telemetry-core/src/state_support.rs:309-332 | crates/jcode-tui/src/tui/app/support.rs:70-87 — 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 (5 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 25+ corresponding lines) src/cli/login.rs:594 — src/cli/login.rs:594-619 | src/cli/login.rs:650-677 | src/cli/login.rs:695-721 | src/cli/login.rs:1067-1092 | src/cli/login.rs:1166-1190 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 25 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 (6 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 15+ corresponding lines) crates/jcode-base/src/provider/openrouter.rs:139 — crates/jcode-base/src/provider/openrouter.rs:139-153 | crates/jcode-base/src/provider/openrouter.rs:155-171 | crates/jcode-base/src/provider/openrouter.rs:173-189 | crates/jcode-provider-openrouter-runtime/src/lib.rs:144-158 | crates/jcode-provider-openrouter-runtime/src/lib.rs:160-176 | crates/jcode-provider-openrouter-runtime/src/lib.rs:178-194 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) crates/jcode-tui/src/tui/session_picker/loading.rs:2269 — crates/jcode-tui/src/tui/session_picker/loading.rs:2269-2282 | crates/jcode-tui/src/tui/session_picker/loading.rs:2474-2489 | crates/jcode-tui/src/tui/session_picker/loading.rs:2756-2769 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:20-33 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) crates/jcode-tui-mermaid/src/lib.rs:804 — crates/jcode-tui-mermaid/src/lib.rs:804-811 | crates/jcode-tui-mermaid/src/lib.rs:1105-1112 | crates/jcode-tui-mermaid/src/lib.rs:1209-1216 | crates/jcode-tui/src/tui/ui_inline_image.rs:207-216 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 11+ corresponding lines) crates/jcode-tui/src/tui/app/hotkey_feedback.rs:650 — crates/jcode-tui/src/tui/app/hotkey_feedback.rs:650-664 | crates/jcode-tui/src/tui/app/inline_interactive.rs:212-222 | crates/jcode-tui/src/tui/app/inline_interactive.rs:264-274 | crates/jcode-tui/src/tui/app/shortcut_hints.rs:143-157 | crates/jcode-tui/src/tui/app/swarm_hint.rs:42-56 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 11+ corresponding lines) crates/jcode-telemetry-core/src/lib.rs:1226 — crates/jcode-telemetry-core/src/lib.rs:1226-1236 | crates/jcode-telemetry-core/src/lib.rs:2567-2577 | crates/jcode-telemetry-core/src/lib.rs:2579-2589 | crates/jcode-telemetry-core/src/lib.rs:2591-2601 — 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 · Edited copies of one member (5 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 8+ corresponding lines) crates/jcode-provider-core/src/auth_mode.rs:194 — crates/jcode-provider-core/src/auth_mode.rs:194-201 | crates/jcode-provider-core/src/auth_mode.rs:204-211 | crates/jcode-provider-core/src/auth_mode.rs:214-221 | crates/jcode-provider-core/src/auth_mode.rs:233-240 | crates/jcode-provider-core/src/auth_mode.rs:243-250 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 14+ corresponding lines) crates/jcode-tui/src/tui/ui.rs:320 — crates/jcode-tui/src/tui/ui.rs:320-333 | crates/jcode-tui/src/tui/ui.rs:391-405 | crates/jcode-tui/src/tui/ui.rs:465-479 | crates/jcode-tui/src/tui/ui.rs:494-508 | crates/jcode-tui/src/tui/ui.rs:526-540 — These 5 members are one piece of code written 5 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 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) crates/jcode-tui-core/src/stream_buffer.rs:526 — crates/jcode-tui-core/src/stream_buffer.rs:526-534 | crates/jcode-tui/src/tui/app/debug.rs:4-11 | crates/jcode-tui/src/tui/ui_frame_metrics.rs:255-261 | src/bin/tui_bench.rs:41-48 — 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 (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) crates/jcode-tui-account-picker/src/overlay.rs:84 — crates/jcode-tui-account-picker/src/overlay.rs:84-96 | crates/jcode-tui-usage-overlay/src/lib.rs:273-284 | crates/jcode-tui/src/tui/login_picker.rs:133-145 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 6+ corresponding lines) crates/jcode-base/src/provider_catalog.rs:1319 — crates/jcode-base/src/provider_catalog.rs:1319-1325 | crates/jcode-build-meta/src/lib.rs:65-70 | crates/jcode-build-support/src/paths.rs:353-359 | crates/jcode-provider-bedrock/src/lib.rs:277-283 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 3+ corresponding lines) crates/jcode-app-core/src/server/util.rs:211 — crates/jcode-app-core/src/server/util.rs:211-213 | crates/jcode-base/src/memory/cache.rs:32-34 | crates/jcode-build-support/src/paths.rs:145-149 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 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 · Duplicated block (247 lines × 2) · ×1
  • Duplicated block (247 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:158 — crates/jcode-tui-markdown/src/markdown_render_full.rs:158-404 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:135-381 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:158` 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 (337–342 lines × 2) · ×1
  • Duplicated block (337–342 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:505 — crates/jcode-tui-markdown/src/markdown_render_full.rs:505-846 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:484-820 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:505` 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 (92 lines × 2) · ×1
  • Duplicated block (92 lines × 2) crates/jcode-app-core/src/usage_openai.rs:317 — crates/jcode-app-core/src/usage_openai.rs:317-408 | crates/jcode-base/src/usage/openai_helpers.rs:350-441 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 `crates/jcode-app-core/src/usage_openai.rs:317` 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 (88–89 lines × 2) · ×1
  • Duplicated block (88–89 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:903 — crates/jcode-tui-markdown/src/markdown_render_full.rs:903-991 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:873-960 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:903` 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 (65–67 lines × 2) · ×1
  • Duplicated block (65–67 lines × 2) crates/jcode-provider-antigravity-runtime/src/lib.rs:685 — crates/jcode-provider-antigravity-runtime/src/lib.rs:685-751 | crates/jcode-provider-gemini-runtime/src/lib.rs:858-922 — before extracting anything, compare `crates/jcode-provider-antigravity-runtime/src/lib.rs` and `crates/jcode-provider-gemini-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 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 `crates/jcode-provider-antigravity-runtime/src/lib.rs:685` 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 (53–55 lines × 2) · ×1
  • Duplicated block (53–55 lines × 2) src/cli/tui_launch.rs:778 — src/cli/tui_launch.rs:778-832 | src/cli/tui_launch.rs:837-889 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/tui_launch.rs:778` 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 (48–54 lines × 2) · ×1
  • Duplicated block (48–54 lines × 2) crates/jcode-base/src/background.rs:524 — crates/jcode-base/src/background.rs:524-577 | crates/jcode-base/src/background.rs:751-798 — both copies are in the same file, so extract the 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 (52–53 lines × 2) · ×1
  • Duplicated block (52–53 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:848 — crates/jcode-tui-markdown/src/markdown_render_full.rs:848-900 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:821-872 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:848` 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 (51–52 lines × 2) · ×1
  • Duplicated block (51–52 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:105 — crates/jcode-tui-markdown/src/markdown_render_full.rs:105-156 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:84-134 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:105` 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–46 lines × 2) · ×1
  • Duplicated block (45–46 lines × 2) crates/jcode-provider-anthropic-runtime/src/lib.rs:1339 — crates/jcode-provider-anthropic-runtime/src/lib.rs:1339-1384 | crates/jcode-provider-anthropic-runtime/src/lib.rs:1785-1829 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-anthropic-runtime/src/lib.rs:1339` 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 (42 lines × 2) · ×1
  • Duplicated block (42 lines × 2) crates/jcode-app-core/src/server/client_lifecycle.rs:1429 — crates/jcode-app-core/src/server/client_lifecycle.rs:1429-1470 | crates/jcode-app-core/src/server/client_lifecycle.rs:1491-1532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_lifecycle.rs:1429` 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 (41–42 lines × 2) · ×1
  • Duplicated block (41–42 lines × 2) crates/jcode-tui/src/tui/ui.rs:950 — crates/jcode-tui/src/tui/ui.rs:950-990 | crates/jcode-tui/src/tui/ui.rs:1001-1042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui.rs:1001` 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.
D4 · Code Duplication · Duplicated block (39–41 lines × 3) · ×1
  • Duplicated block (39–41 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:403 — crates/jcode-tui-account-picker/src/overlay.rs:403-443 | crates/jcode-tui-usage-overlay/src/lib.rs:387-425 | crates/jcode-tui/src/tui/login_picker.rs:291-331 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 (37–41 lines × 2) · ×1
  • Duplicated block (37–41 lines × 2) crates/jcode-provider-doctor/src/live_provider_probes.rs:826 — crates/jcode-provider-doctor/src/live_provider_probes.rs:826-866 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1154-1190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-doctor/src/live_provider_probes.rs:826` 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.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×1
  • Duplicated block (40 lines × 2) crates/jcode-tui-style/src/color.rs:95 — crates/jcode-tui-style/src/color.rs:95-134 | crates/jcode-tui-workspace/src/color_support.rs:64-103 — before extracting anything, compare `crates/jcode-tui-style/src/color.rs` and `crates/jcode-tui-workspace/src/color_support.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 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.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) crates/jcode-tui/src/tui/app/auth_account_picker.rs:708 — crates/jcode-tui/src/tui/app/auth_account_picker.rs:708-746 | crates/jcode-tui/src/tui/app/auth_account_picker.rs:991-1029 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/auth_account_picker.rs:708` 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 (53 lines × 2) · ×1
  • Duplicated block (53 lines × 2) crates/jcode-app-core/src/server/client_comm_channels.rs:147 — crates/jcode-app-core/src/server/client_comm_channels.rs:147-199 | crates/jcode-app-core/src/server/client_comm_channels.rs:232-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/server/client_comm_channels.rs:147` 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 (32–36 lines × 2) · ×1
  • Duplicated block (32–36 lines × 2) crates/jcode-tui-mermaid/src/mermaid_widget.rs:127 — crates/jcode-tui-mermaid/src/mermaid_widget.rs:127-162 | crates/jcode-tui-mermaid/src/mermaid_widget.rs:381-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-mermaid/src/mermaid_widget.rs:127` 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 (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) crates/jcode-app-core/src/session_launch.rs:674 — crates/jcode-app-core/src/session_launch.rs:674-708 | crates/jcode-app-core/src/session_launch.rs:802-836 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-app-core/src/session_launch.rs:674` 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, `crates/jcode-app-core/src/session_launch.rs:709` calls `apply_runtime_env` and `crates/jcode-app-core/src/session_launch.rs:837` 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 (33 lines × 3) · ×1
  • Duplicated block (33 lines × 3) src/cli/commands.rs:2911 — src/cli/commands.rs:2911-2943 | src/cli/commands.rs:3029-3061 | src/cli/commands.rs:3226-3258 — 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/cli/commands.rs:2911` 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 (32 lines × 3) · ×1
  • Duplicated block (32 lines × 3) crates/jcode-telemetry-core/src/lib.rs:1635 — crates/jcode-telemetry-core/src/lib.rs:1635-1666 | crates/jcode-telemetry-core/src/lifecycle.rs:51-82 | crates/jcode-telemetry-core/src/lifecycle.rs:233-264 — 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.
D4 · Code Duplication · Duplicated block (36–37 lines × 4) · ×1
  • Duplicated block (36–37 lines × 4) crates/jcode-base/src/embedding_stub.rs:50 — crates/jcode-base/src/embedding_stub.rs:50-85 | crates/jcode-embedding/src/lib.rs:49-84 | crates/jcode-memory-types/src/graph.rs:52-87 | crates/jcode-memory-types/src/lib.rs:874-910 — before extracting anything, compare `crates/jcode-base/src/embedding_stub.rs` and `crates/jcode-embedding/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 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 `crates/jcode-base/src/embedding_stub.rs:50` 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, `crates/jcode-base/src/embedding_stub.rs:49` calls `debug` and `crates/jcode-embedding/src/lib.rs:48` 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 (28 lines × 3) · ×1
  • Duplicated block (28 lines × 3) crates/jcode-app-core/src/usage_display.rs:140 — crates/jcode-app-core/src/usage_display.rs:140-167 | crates/jcode-base/src/usage/display.rs:147-174 | crates/jcode-tui-usage-overlay/src/lib.rs:744-771 — before extracting anything, compare `crates/jcode-app-core/src/usage_display.rs` and `crates/jcode-base/src/usage/display.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 133 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.
D4 · Code Duplication · Duplicated block (27 lines × 3) · ×1
  • Duplicated block (27 lines × 3) crates/jcode-tui/src/tui/app/commands.rs:323 — crates/jcode-tui/src/tui/app/commands.rs:323-349 | crates/jcode-tui/src/tui/app/commands_improve.rs:403-429 | crates/jcode-tui/src/tui/app/commands_overnight.rs:81-107 — 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.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) crates/jcode-app-core/src/usage_openai.rs:81 — crates/jcode-app-core/src/usage_openai.rs:81-106 | crates/jcode-base/src/usage/openai_helpers.rs:87-113 — before extracting anything, compare `crates/jcode-app-core/src/usage_openai.rs` and `crates/jcode-base/src/usage/openai_helpers.rs` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 326 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 `crates/jcode-app-core/src/usage_openai.rs:81` 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 (25–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) crates/jcode-tui/src/tui/app/remote.rs:462 — crates/jcode-tui/src/tui/app/remote.rs:462-488 | crates/jcode-tui/src/tui/app/remote.rs:1798-1822 — both copies are in the same file, so extract the 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 lines × 3) · ×1
  • Duplicated block (26 lines × 3) crates/jcode-app-core/src/tool/apply_patch.rs:432 — crates/jcode-app-core/src/tool/apply_patch.rs:432-457 | crates/jcode-app-core/src/tool/edit.rs:351-376 | crates/jcode-app-core/src/tool/write.rs:213-238 — 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. 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 (22–26 lines × 3) · ×1
  • Duplicated block (22–26 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:826 — crates/jcode-provider-doctor/src/live_provider_probes.rs:826-851 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1154-1175 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1346-1367 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.rs:826` 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, `crates/jcode-provider-doctor/src/live_provider_probes.rs:825` calls `build_native_claude_provider` and `crates/jcode-provider-doctor/src/live_provider_probes.rs:1345` 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 (4–26 lines × 3) · ×1
  • Duplicated block (4–26 lines × 3) crates/jcode-base/src/session/crash.rs:39 — crates/jcode-base/src/session/crash.rs:39-42 | crates/jcode-base/src/session/crash.rs:79-103 | crates/jcode-base/src/session/crash.rs:215-240 — 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 `crates/jcode-base/src/session/crash.rs:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `crates/jcode-base/src/session/crash.rs:77` calls `path`, `extension`, `unwrap_or` and `crates/jcode-base/src/session/crash.rs:39` 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 (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) crates/jcode-tui/src/tui/ui_messages.rs:2366 — crates/jcode-tui/src/tui/ui_messages.rs:2366-2389 | crates/jcode-tui/src/tui/ui_messages.rs:3130-3155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui_messages.rs:2366` 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 (24–25 lines × 3) · ×1
  • Duplicated block (24–25 lines × 3) crates/jcode-tui/src/tui/session_picker.rs:430 — crates/jcode-tui/src/tui/session_picker.rs:430-453 | crates/jcode-tui/src/tui/session_picker.rs:495-519 | crates/jcode-tui/src/tui/session_picker.rs:592-615 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/session_picker.rs:495` 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.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) crates/jcode-app-core/src/server/jade_relay.rs:1090 — crates/jcode-app-core/src/server/jade_relay.rs:1090-1112 | crates/jcode-app-core/src/server/spawn_model_selection.rs:7-31 — 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.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) crates/jcode-base/src/session.rs:791 — crates/jcode-base/src/session.rs:791-814 | crates/jcode-base/src/session.rs:850-874 — both copies are in the same file, so extract the 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–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) crates/jcode-provider-bedrock/src/lib.rs:406 — crates/jcode-provider-bedrock/src/lib.rs:406-427 | crates/jcode-schema-dialect/src/dialect.rs:351-375 — before extracting anything, compare `crates/jcode-provider-bedrock/src/lib.rs` and `crates/jcode-schema-dialect/src/dialect.rs` as WHOLE FILES: this scan already matched 3 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. 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 `crates/jcode-provider-bedrock/src/lib.rs:406` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31–33 lines × 2) · ×1
  • Duplicated block (31–33 lines × 2) crates/jcode-provider-openrouter-runtime/src/lib.rs:2663 — crates/jcode-provider-openrouter-runtime/src/lib.rs:2663-2695 | crates/jcode-provider-openrouter-runtime/src/lib.rs:2717-2747 — both copies are in the same file, so extract the 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 (20–25 lines × 2) · ×1
  • Duplicated block (20–25 lines × 2) crates/jcode-tui/src/tui/app/remote/key_handling.rs:1679 — crates/jcode-tui/src/tui/app/remote/key_handling.rs:1679-1703 | crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs:270-289 — 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 `crates/jcode-tui/src/tui/app/remote/key_handling.rs:1679` 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 (21–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) crates/jcode-app-core/src/server/client_session.rs:1554 — crates/jcode-app-core/src/server/client_session.rs:1554-1574 | crates/jcode-app-core/src/server/client_session.rs:2033-2056 — both copies are in the same file, so extract the 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–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) crates/jcode-provider-antigravity-runtime/src/lib.rs:368 — crates/jcode-provider-antigravity-runtime/src/lib.rs:368-390 | crates/jcode-provider-gemini-runtime/src/lib.rs:527-550 — before extracting anything, compare `crates/jcode-provider-antigravity-runtime/src/lib.rs` and `crates/jcode-provider-gemini-runtime/src/lib.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 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 `crates/jcode-provider-antigravity-runtime/src/lib.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.
D4 · Code Duplication · Duplicated block (22–23 lines × 3) · ×1
  • Duplicated block (22–23 lines × 3) crates/jcode-provider-doctor/src/live_provider_probes.rs:853 — crates/jcode-provider-doctor/src/live_provider_probes.rs:853-874 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1177-1198 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1368-1390 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.rs:853` 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–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) crates/jcode-tui/src/tui/app/onboarding_graph.rs:211 — crates/jcode-tui/src/tui/app/onboarding_graph.rs:211-233 | crates/jcode-tui/src/tui/app/onboarding_graph.rs:249-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/app/onboarding_graph.rs:211` 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 (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:310 — crates/jcode-tui-account-picker/src/overlay.rs:310-331 | crates/jcode-tui-usage-overlay/src/lib.rs:334-355 | crates/jcode-tui/src/tui/login_picker.rs:205-226 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 `crates/jcode-tui-account-picker/src/overlay.rs:310` 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 (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1727 — crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1727-1748 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1769-1787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1727` 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 (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) crates/jcode-tui-markdown/src/markdown_wrap.rs:275 — crates/jcode-tui-markdown/src/markdown_wrap.rs:275-296 | crates/jcode-tui-markdown/src/markdown_wrap.rs:398-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui-markdown/src/markdown_wrap.rs:275` 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 × 3) · ×1
  • Duplicated block (21 lines × 3) crates/jcode-app-core/src/server/client_lifecycle.rs:1701 — crates/jcode-app-core/src/server/client_lifecycle.rs:1701-1721 | crates/jcode-app-core/src/server/client_lifecycle.rs:1742-1762 | crates/jcode-app-core/src/server/client_lifecycle.rs:1774-1794 — 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 `crates/jcode-app-core/src/server/client_lifecycle.rs:1701` 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, `crates/jcode-app-core/src/server/client_lifecycle.rs:1722` calls `Some`, `try_available_models_snapshot` and `crates/jcode-app-core/src/server/client_lifecycle.rs:1763` 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–21 lines × 3) · ×1
  • Duplicated block (17–21 lines × 3) crates/jcode-setup-hints/src/lib.rs:2392 — crates/jcode-setup-hints/src/lib.rs:2392-2408 | crates/jcode-tui-style/src/color.rs:61-81 | crates/jcode-tui-workspace/src/color_support.rs:32-50 — before extracting anything, compare `crates/jcode-setup-hints/src/lib.rs` and `crates/jcode-tui-style/src/color.rs` as WHOLE FILES: this scan already matched 3 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 `crates/jcode-setup-hints/src/lib.rs:2392` 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 (20–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) crates/jcode-tui/src/tui/app/inline_interactive.rs:1213 — crates/jcode-tui/src/tui/app/inline_interactive.rs:1213-1233 | crates/jcode-tui/src/tui/app/inline_interactive.rs:1529-1548 | crates/jcode-tui/src/tui/app/inline_interactive.rs:2260-2279 — 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 `super) fn poll_model_picker_load(&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, `crates/jcode-tui/src/tui/app/inline_interactive.rs:1549` calls `clone` and `crates/jcode-tui/src/tui/app/inline_interactive.rs:1235` 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 (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) crates/jcode-telemetry-core/src/lib.rs:1729 — crates/jcode-telemetry-core/src/lib.rs:1729-1749 | crates/jcode-telemetry-core/src/lib.rs:1766-1785 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-telemetry-core/src/lib.rs:1729` 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.
D4 · Code Duplication · Duplicated block (10–21 lines × 2) · ×1
  • Duplicated block (10–21 lines × 2) crates/jcode-tui-anim/src/lib.rs:196 — crates/jcode-tui-anim/src/lib.rs:196-205 | crates/jcode-tui-anim/src/lib.rs:286-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (19–21 lines × 2) · ×1
  • Duplicated block (19–21 lines × 2) crates/jcode-tui/src/tui/app/commands.rs:2057 — crates/jcode-tui/src/tui/app/commands.rs:2057-2075 | crates/jcode-tui/src/tui/app/commands.rs:2136-2156 — both copies are in the same file, so extract the 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 (16–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) crates/jcode-provider-core/src/transport.rs:60 — crates/jcode-provider-core/src/transport.rs:60-79 | scripts/repro/tls-bad-record-mac/src/main.rs:40-55 — 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.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) crates/jcode-telemetry-core/src/lib.rs:1668 — crates/jcode-telemetry-core/src/lib.rs:1668-1686 | crates/jcode-telemetry-core/src/lifecycle.rs:105-123 | crates/jcode-telemetry-core/src/lifecycle.rs:292-310 — 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.
D4 · Code Duplication · Duplicated block (18–19 lines × 3) · ×1
  • Duplicated block (18–19 lines × 3) crates/jcode-tui/src/tui/app/turn.rs:214 — crates/jcode-tui/src/tui/app/turn.rs:214-231 | crates/jcode-tui/src/tui/app/turn.rs:532-550 | crates/jcode-tui/src/tui/app/turn.rs:1534-1552 — 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 `crates/jcode-tui/src/tui/app/turn.rs:214` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–19 lines × 2) · ×1
  • Duplicated block (14–19 lines × 2) crates/jcode-tui/src/tui/ui.rs:1324 — crates/jcode-tui/src/tui/ui.rs:1324-1337 | crates/jcode-tui/src/tui/ui.rs:1491-1509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/ui.rs:1324` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `key` to `&BodyCacheKey` in one and `FullPrepCacheKey` 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 (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) crates/jcode-tui-mermaid/src/mermaid_inline.rs:168 — crates/jcode-tui-mermaid/src/mermaid_inline.rs:168-185 | crates/jcode-tui-mermaid/src/mermaid_inline.rs:221-237 | crates/jcode-tui-mermaid/src/mermaid_runtime.rs:753-769 — 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 `crates/jcode-tui-mermaid/src/mermaid_inline.rs:168` 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, `crates/jcode-tui-mermaid/src/mermaid_runtime.rs:751` calls `open`, `ok`, `dimensions` and `crates/jcode-tui-mermaid/src/mermaid_inline.rs:165` 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–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) crates/jcode-base/src/sidecar.rs:921 — crates/jcode-base/src/sidecar.rs:921-937 | crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:1944-1961 — 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. 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 (3–17 lines × 3) · ×1
  • Duplicated block (3–17 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:52 — crates/jcode-tui-account-picker/src/overlay.rs:52-54 | crates/jcode-tui-usage-overlay/src/lib.rs:251-267 | crates/jcode-tui/src/tui/login_picker.rs:149-165 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 `crates/jcode-tui-usage-overlay/src/lib.rs:251` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-tui-usage-overlay/src/lib.rs:251` calls `capacity` and `crates/jcode-tui-account-picker/src/overlay.rs:52` 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 (11–17 lines × 2) · ×1
  • Duplicated block (11–17 lines × 2) crates/jcode-tui/src/tui/session_picker/loading.rs:2204 — crates/jcode-tui/src/tui/session_picker/loading.rs:2204-2220 | crates/jcode-tui/src/tui/session_picker/loading.rs:2780-2790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/session_picker/loading.rs:2204` 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.
D4 · Code Duplication · Duplicated block (20–28 lines × 3) · ×1
  • Duplicated block (20–28 lines × 3) crates/jcode-tui/src/tui/ui_inline_interactive.rs:939 — crates/jcode-tui/src/tui/ui_inline_interactive.rs:939-966 | crates/jcode-tui/src/tui/ui_inline_interactive.rs:1018-1045 | crates/jcode-tui/src/tui/ui_input/command_suggestions.rs:94-113 — 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 `crates/jcode-tui/src/tui/ui_inline_interactive.rs:939` 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 (14–15 lines × 4) · ×1
  • Duplicated block (14–15 lines × 4) crates/jcode-app-core/src/tool/computer/keys.rs:84 — crates/jcode-app-core/src/tool/computer/keys.rs:84-97 | crates/jcode-render-core/src/math.rs:202-216 | crates/jcode-render-core/src/math.rs:238-252 | crates/jcode-tui-core/src/korean_input.rs:45-58 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-render-core/src/math.rs:202` 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 (3–15 lines × 4) · ×1
  • Duplicated block (3–15 lines × 4) crates/jcode-app-core/src/tool/read.rs:406 — crates/jcode-app-core/src/tool/read.rs:406-420 | crates/jcode-base/src/provider/image_clamp.rs:409-422 | crates/jcode-terminal-image/src/display.rs:234-248 | crates/jcode-tui-mermaid/src/lib.rs:1514-1516 — before extracting anything, compare `crates/jcode-app-core/src/tool/read.rs` and `crates/jcode-base/src/provider/image_clamp.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/jcode-app-core/src/tool/read.rs:406` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/jcode-app-core/src/tool/read.rs:406` calls `Some` and `crates/jcode-tui-mermaid/src/lib.rs:1514` 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–15 lines × 2) · ×1
  • Duplicated block (9–15 lines × 2) crates/jcode-base/src/platform.rs:389 — crates/jcode-base/src/platform.rs:389-397 | crates/jcode-build-support/src/platform_support.rs:39-53 — 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 `crates/jcode-base/src/platform.rs:389` 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–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) crates/jcode-provider-bedrock/src/lib.rs:431 — crates/jcode-provider-bedrock/src/lib.rs:431-445 | crates/jcode-schema-dialect/src/dialect.rs:383-394 — before extracting anything, compare `crates/jcode-provider-bedrock/src/lib.rs` and `crates/jcode-schema-dialect/src/dialect.rs` as WHOLE FILES: this scan already matched 3 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. 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 (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) crates/jcode-tui/src/tui/app/remote.rs:2260 — crates/jcode-tui/src/tui/app/remote.rs:2260-2290 | crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs:458-488 — before extracting anything, compare `crates/jcode-tui/src/tui/app/remote.rs` and `crates/jcode-tui/src/tui/app/remote/key_handling/key_events.rs` as WHOLE FILES: this scan already matched 4 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. 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 `crates/jcode-tui/src/tui/app/remote.rs:2260` 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–14 lines × 3) · ×1
  • Duplicated block (11–14 lines × 3) crates/jcode-tui-account-picker/src/overlay.rs:504 — crates/jcode-tui-account-picker/src/overlay.rs:504-517 | crates/jcode-tui-usage-overlay/src/lib.rs:512-522 | crates/jcode-tui/src/tui/login_picker.rs:410-423 — before extracting anything, compare `crates/jcode-tui-account-picker/src/overlay.rs` and `crates/jcode-tui-usage-overlay/src/lib.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 148 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 `crates/jcode-tui-account-picker/src/overlay.rs:504` 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 (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) crates/jcode-tui/src/tui/keybind.rs:95 — crates/jcode-tui/src/tui/keybind.rs:95-108 | crates/jcode-tui/src/tui/keybind.rs:144-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-tui/src/tui/keybind.rs:95` 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 (10–12 lines × 4) · ×1
  • Duplicated block (10–12 lines × 4) crates/jcode-app-core/src/perf.rs:366 — crates/jcode-app-core/src/perf.rs:366-377 | crates/jcode-setup-hints/src/lib.rs:2391-2400 | crates/jcode-tui-style/src/color.rs:60-70 | crates/jcode-tui-workspace/src/color_support.rs:31-41 — before extracting anything, compare `crates/jcode-setup-hints/src/lib.rs` and `crates/jcode-tui-style/src/color.rs` as WHOLE FILES: this scan already matched 3 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.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) crates/jcode-app-core/src/server/comm_control.rs:456 — crates/jcode-app-core/src/server/comm_control.rs:456-466 | crates/jcode-app-core/src/server/comm_control.rs:598-609 | crates/jcode-app-core/src/server/comm_control.rs:653-664 — 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 `crates/jcode-app-core/src/server/comm_control.rs:456` 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 (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) crates/jcode-harness-api-server/src/translate.rs:2409 — crates/jcode-harness-api-server/src/translate.rs:2409-2420 | crates/jcode-harness-api-server/src/translate.rs:2800-2808 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/jcode-harness-api-server/src/translate.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.
D4 · Code Duplication · Duplicated block (10–12 lines × 3) · ×1
  • Duplicated block (10–12 lines × 3) crates/jcode-import-core/src/lib.rs:740 — crates/jcode-import-core/src/lib.rs:740-749 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:38-49 | crates/jcode-tui/src/tui/session_picker/loading/pi_sessions.rs:123-134 — 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. 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) · ×1
  • Duplicated block (10–11 lines × 3) src/cli/tui_launch.rs:757 — src/cli/tui_launch.rs:757-766 | src/cli/tui_launch.rs:790-800 | src/cli/tui_launch.rs:848-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/tui_launch.rs:757` 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 (9–10 lines × 8) · ×1
  • Duplicated block (9–10 lines × 8) crates/jcode-provider-cursor-runtime/src/wire.rs:711 — crates/jcode-provider-cursor-runtime/src/wire.rs:711-720 | crates/jcode-provider-cursor-runtime/src/wire.rs:732-740 | crates/jcode-provider-cursor-runtime/src/wire.rs:769-777 | crates/jcode-provider-cursor-runtime/src/wire.rs:844-852 | crates/jcode-provider-cursor-runtime/src/wire.rs:874-883 | crates/jcode-provider-cursor-runtime/src/wire.rs:893-902 | crates/jcode-provider-cursor-runtime/src/wire.rs:919-928 | crates/jcode-provider-cursor-runtime/src/wire.rs:937-946 — all 8 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 `crates/jcode-provider-cursor-runtime/src/wire.rs:711` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `crates/jcode-provider-cursor-runtime/src/wire.rs:740` calls `to_string`, `to_vec` and `crates/jcode-provider-cursor-runtime/src/wire.rs:720` 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 lines × 6) · ×1
  • Duplicated block (10 lines × 6) crates/jcode-provider-doctor/src/live_provider_probes.rs:805 — crates/jcode-provider-doctor/src/live_provider_probes.rs:805-814 | crates/jcode-provider-doctor/src/live_provider_probes.rs:903-912 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1133-1142 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1223-1232 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1324-1333 | crates/jcode-provider-doctor/src/live_provider_probes.rs:1415-1424 — 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 `crates/jcode-provider-doctor/src/live_provider_probes.rs:805` 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, `crates/jcode-provider-doctor/src/live_provider_probes.rs:1220` calls `with_evidence` and `crates/jcode-provider-doctor/src/live_provider_probes.rs:804` 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 (7–10 lines × 3) · ×1
  • Duplicated block (7–10 lines × 3) crates/jcode-tui/src/tui/app/remote/reconnect.rs:355 — crates/jcode-tui/src/tui/app/remote/reconnect.rs:355-361 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:647-656 | crates/jcode-tui/src/tui/app/remote/reconnect.rs:685-694 — 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 `crates/jcode-tui/src/tui/app/remote/reconnect.rs:355` 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 (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) crates/jcode-tui-markdown/src/markdown_render_full.rs:494 — crates/jcode-tui-markdown/src/markdown_render_full.rs:494-502 | crates/jcode-tui-markdown/src/markdown_render_lazy.rs:475-480 — before extracting anything, compare `crates/jcode-tui-markdown/src/markdown_render_full.rs` and `crates/jcode-tui-markdown/src/markdown_render_lazy.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 868 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 `crates/jcode-tui-markdown/src/markdown_render_full.rs:494` 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 (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) crates/jcode-tui/src/tui/keybind.rs:67 — crates/jcode-tui/src/tui/keybind.rs:67-74 | crates/jcode-tui/src/tui/keybind.rs:650-657 | crates/jcode-tui/src/tui/keybind.rs:667-674 | crates/jcode-tui/src/tui/keybind.rs:684-691 | crates/jcode-tui/src/tui/keybind.rs:701-708 — 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 `crates/jcode-tui/src/tui/keybind.rs:67` 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 (5–8 lines × 3) · ×1
  • Duplicated block (5–8 lines × 3) crates/jcode-base/src/import.rs:1080 — crates/jcode-base/src/import.rs:1080-1087 | crates/jcode-import-core/src/lib.rs:653-657 | crates/jcode-tui/src/tui/session_picker/loading.rs:2291-2297 — before extracting anything, compare `crates/jcode-base/src/import.rs` and `crates/jcode-import-core/src/lib.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. 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–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) crates/jcode-app-core/src/server/runtime_ssh_accounts.rs:171 — crates/jcode-app-core/src/server/runtime_ssh_accounts.rs:171-176 | crates/jcode-tui/src/tui/app/usage_reset.rs:239-246 — 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 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–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) crates/jcode-base/src/recent_session_index.rs:150 — crates/jcode-base/src/recent_session_index.rs:150-155 | crates/jcode-harness-api-server/src/translate.rs:3248-3254 — 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 `crates/jcode-base/src/recent_session_index.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 (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) crates/jcode-app-core/src/server/comm_control.rs:439 — crates/jcode-app-core/src/server/comm_control.rs:439-443 | crates/jcode-app-core/src/server/comm_control.rs:584-587 | crates/jcode-app-core/src/server/comm_control.rs:640-644 — 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 `crates/jcode-app-core/src/server/comm_control.rs:439` 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 (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) crates/jcode-provider-core/src/openai_schema.rs:45 — crates/jcode-provider-core/src/openai_schema.rs:45-47 | crates/jcode-provider-core/src/openai_schema.rs:179-183 | crates/jcode-schema-dialect/src/dialect.rs:304-308 — 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 `crates/jcode-provider-core/src/openai_schema.rs:179` 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.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) crates/jcode-tui/src/tui/app/state_ui_storage.rs:278 — crates/jcode-tui/src/tui/app/state_ui_storage.rs:278-294 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:345-371 | crates/jcode-tui/src/tui/app/state_ui_storage.rs:384-411 — 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 `crates/jcode-tui/src/tui/app/state_ui_storage.rs:278` 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–19 lines × 3) · ×1
  • Duplicated block (16–19 lines × 3) crates/jcode-app-core/src/tool/discover.rs:1035 — crates/jcode-app-core/src/tool/discover.rs:1035-1050 | crates/jcode-app-core/src/tool/discover.rs:1226-1244 | crates/jcode-app-core/src/tool/discover.rs:1308-1326 — 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 `crates/jcode-app-core/src/tool/discover.rs:1035` 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 (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) crates/jcode-tui/src/tui/ui_overlays.rs:350 — crates/jcode-tui/src/tui/ui_overlays.rs:350-354 | crates/jcode-tui/src/tui/ui_overlays.rs:440-444 | crates/jcode-tui/src/tui/ui_overlays.rs:457-461 | crates/jcode-tui/src/tui/ui_overlays.rs:481-485 | crates/jcode-tui/src/tui/ui_overlays.rs:550-554 | crates/jcode-tui/src/tui/ui_overlays.rs:622-627 — 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 `crates/jcode-tui/src/tui/ui_overlays.rs:622` 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, `crates/jcode-tui/src/tui/ui_overlays.rs:454` calls `push`, `help_entry` and `crates/jcode-tui/src/tui/ui_overlays.rs:347` 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 · Near-duplicate member family (8 members, 37 shared lines) · ×1
  • Near-duplicate member family (8 members, 37 shared lines) scripts/check_donut_animates_live.py:69 — scripts/check_donut_animates_live.py:69-176 | scripts/count_idle_draws.py:46-165 | scripts/dump_fresh_spawn_screen.py:31-127 | scripts/pin_no_area_state.py:39-128 | scripts/probe_idle_state.py:94-206 | scripts/verify_donut_still_animates.py:69-245 | scripts/which_overlay_blocks_donut.py:43-118 | scripts/why_no_animation_area.py:34-133 — These 8 members are variants of one another: a block of 37 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 8 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 8 times.
D4 · Code Duplication · Near-duplicate member family (7 members, 14 shared lines) · ×1
  • Near-duplicate member family (7 members, 14 shared lines) scripts/check_donut_animates_live.py:69 — scripts/check_donut_animates_live.py:69-176 | scripts/count_idle_draws.py:46-165 | scripts/diagnose_idle_render_cost.py:314-443 | scripts/dump_fresh_spawn_screen.py:31-127 | scripts/probe_idle_state.py:94-206 | scripts/repro_slash_flicker.py:341-495 | scripts/verify_donut_still_animates.py:69-245 — These 7 members are variants of one another: a block of 14 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 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 28 shared lines) · ×1
  • Near-duplicate member family (6 members, 28 shared lines) scripts/count_idle_draws.py:46 — scripts/count_idle_draws.py:46-165 | scripts/diagnose_idle_render_cost.py:314-443 | scripts/pin_no_area_state.py:39-128 | scripts/probe_idle_state.py:94-206 | scripts/which_overlay_blocks_donut.py:43-118 | scripts/why_no_animation_area.py:34-133 — These 6 members are variants of one another: a block of 28 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 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 25 shared lines) · ×1
  • Near-duplicate member family (5 members, 25 shared lines) scripts/count_idle_draws.py:46 — scripts/count_idle_draws.py:46-165 | scripts/pin_no_area_state.py:39-128 | scripts/probe_idle_state.py:94-206 | scripts/profile_idle_donut.py:49-157 | scripts/which_overlay_blocks_donut.py:43-118 — 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) crates/jcode-provider-doctor/src/provider_e2e.rs:873 — crates/jcode-provider-doctor/src/provider_e2e.rs:873-947 | crates/jcode-provider-doctor/src/provider_e2e.rs:1216-1291 | crates/jcode-provider-doctor/src/provider_e2e.rs:1868-1943 | crates/jcode-provider-doctor/src/provider_e2e.rs:2184-2251 — 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 · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) scripts/diagnose_idle_render_cost.py:78 — scripts/diagnose_idle_render_cost.py:78-90 | scripts/profile_remote_resume_burst.py:77-89 | scripts/profile_single_spawn.py:27-39 | scripts/repro_expand_edit_shortcut.py:144-156 | scripts/repro_input_flicker.py:89-101 | scripts/repro_input_lag.py:91-103 | scripts/repro_live_duplicate.py:114-126 | scripts/repro_slash_flicker.py:85-97 — These 8 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 8 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 8 times.
D4 · Code Duplication · Edited copy of a member (1 corresponding lines) · ×1
  • Edited copy of a member (1 corresponding lines) scripts/jcode_harbor_agent.py:53 — scripts/jcode_harbor_agent.py:53-53 | scripts/jcode_harbor_claude_agent.py:55-55 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (5 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 3+ corresponding lines) scripts/check_code_size_budget.py:31 — scripts/check_code_size_budget.py:31-37 | scripts/check_panic_budget.py:34-36 | scripts/check_swallowed_error_budget.py:41-43 | scripts/check_test_size_budget.py:26-28 | scripts/check_wildcard_reexport_budget.py:41-43 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 3 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 · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) crates/jcode-provider-doctor/src/provider_e2e.rs:922 — crates/jcode-provider-doctor/src/provider_e2e.rs:922-939 | crates/jcode-provider-doctor/src/provider_e2e.rs:1266-1283 | crates/jcode-provider-doctor/src/provider_e2e.rs:1918-1935 | crates/jcode-provider-doctor/src/provider_e2e.rs:2233-2250 — 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 `crates/jcode-provider-doctor/src/provider_e2e.rs:922` 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 (33–40 lines × 2) · ×1
  • Duplicated block (33–40 lines × 2) scripts/repro_input_flicker.py:480 — scripts/repro_input_flicker.py:480-512 | scripts/repro_input_lag.py:458-497 — 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 `scripts/repro_input_lag.py:458` 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 (38–39 lines × 2) · ×1
  • Duplicated block (38–39 lines × 2) scripts/benchmark_swarm.py:248 — scripts/benchmark_swarm.py:248-286 | scripts/benchmark_swarm.py:327-364 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) scripts/benchmark_swarm.py:46 — scripts/benchmark_swarm.py:46-81 | scripts/benchmark_takehome.py:32-67 — 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. 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, `scripts/benchmark_takehome.py:27` calls `get` and `scripts/benchmark_swarm.py:37` 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 (33–35 lines × 2) · ×1
  • Duplicated block (33–35 lines × 2) scripts/diagnose_idle_render_cost.py:329 — scripts/diagnose_idle_render_cost.py:329-361 | scripts/repro_slash_flicker.py:358-392 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_slash_flicker.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) scripts/measure_animation_cpu_cost.py:101 — scripts/measure_animation_cpu_cost.py:101-128 | scripts/sweep_animation_fps.py:92-118 — before extracting anything, compare `scripts/measure_animation_cpu_cost.py` and `scripts/sweep_animation_fps.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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 (20–25 lines × 6) · ×1
  • Duplicated block (20–25 lines × 6) scripts/check_donut_animates_live.py:80 — scripts/check_donut_animates_live.py:80-99 | scripts/dump_fresh_spawn_screen.py:44-63 | scripts/pin_no_area_state.py:49-68 | scripts/verify_donut_still_animates.py:79-103 | scripts/which_overlay_blocks_donut.py:53-72 | scripts/why_no_animation_area.py:44-63 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/dump_fresh_spawn_screen.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 87 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 `scripts/check_donut_animates_live.py:80` 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 (19–23 lines × 2) · ×1
  • Duplicated block (19–23 lines × 2) scripts/benchmark_takehome.py:139 — scripts/benchmark_takehome.py:139-157 | scripts/benchmark_takehome.py:232-254 — both copies are in the same file, so extract the 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 (10–23 lines × 2) · ×1
  • Duplicated block (10–23 lines × 2) scripts/check_donut_animates_live.py:110 — scripts/check_donut_animates_live.py:110-119 | scripts/verify_donut_still_animates.py:114-136 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/verify_donut_still_animates.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×1
  • Duplicated block (17–21 lines × 2) scripts/bench_headless_memory.py:88 — scripts/bench_headless_memory.py:88-108 | scripts/repro_idle_session_rss.py:107-123 — 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 `scripts/bench_headless_memory.py:88` 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–21 lines × 8) · ×1
  • Duplicated block (15–21 lines × 8) scripts/check_donut_animates_live.py:77 — scripts/check_donut_animates_live.py:77-92 | scripts/count_idle_draws.py:56-73 | scripts/dump_fresh_spawn_screen.py:41-56 | scripts/pin_no_area_state.py:46-61 | scripts/probe_idle_state.py:101-115 | scripts/verify_donut_still_animates.py:76-96 | scripts/which_overlay_blocks_donut.py:50-65 | scripts/why_no_animation_area.py:41-56 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/check_donut_animates_live.py:73` calls `add_argument` and `scripts/verify_donut_still_animates.py:72` 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 (16 lines × 6) · ×1
  • Duplicated block (16 lines × 6) scripts/diagnose_idle_render_cost.py:151 — scripts/diagnose_idle_render_cost.py:151-166 | scripts/repro_expand_edit_shortcut.py:194-209 | scripts/repro_input_flicker.py:212-227 | scripts/repro_input_lag.py:170-185 | scripts/repro_live_duplicate.py:164-179 | scripts/repro_slash_flicker.py:172-187 — 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 6 call sites, so a change lands once. 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 after the matched lines, `scripts/repro_input_lag.py:186` calls `monotonic` and `scripts/repro_expand_edit_shortcut.py:210` 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 (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) scripts/diagnose_idle_render_cost.py:200 — scripts/diagnose_idle_render_cost.py:200-215 | scripts/repro_input_flicker.py:275-290 | scripts/repro_input_lag.py:249-264 | scripts/repro_slash_flicker.py:218-233 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 10) · ×1
  • Duplicated block (14 lines × 10) scripts/check_donut_animates_live.py:163 — scripts/check_donut_animates_live.py:163-176 | scripts/count_idle_draws.py:152-165 | scripts/diagnose_idle_render_cost.py:430-443 | scripts/dump_fresh_spawn_screen.py:114-127 | scripts/pin_no_area_state.py:115-128 | scripts/probe_idle_state.py:193-206 | scripts/repro_slash_flicker.py:482-495 | scripts/verify_donut_still_animates.py:232-245 | scripts/which_overlay_blocks_donut.py:105-118 | scripts/why_no_animation_area.py:120-133 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_donut_animates_live.py:163` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/pin_no_area_state.py:113` calls `sleep` and `scripts/diagnose_idle_render_cost.py:428` 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 × 5) · ×1
  • Duplicated block (14 lines × 5) scripts/diagnose_idle_render_cost.py:97 — scripts/diagnose_idle_render_cost.py:97-110 | scripts/repro_expand_edit_shortcut.py:103-116 | scripts/repro_input_flicker.py:108-121 | scripts/repro_input_lag.py:110-123 | scripts/repro_slash_flicker.py:104-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. 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 (13 lines × 8) · ×1
  • Duplicated block (13 lines × 8) scripts/diagnose_idle_render_cost.py:78 — scripts/diagnose_idle_render_cost.py:78-90 | scripts/profile_remote_resume_burst.py:77-89 | scripts/profile_single_spawn.py:27-39 | scripts/repro_expand_edit_shortcut.py:144-156 | scripts/repro_input_flicker.py:89-101 | scripts/repro_input_lag.py:91-103 | scripts/repro_live_duplicate.py:114-126 | scripts/repro_slash_flicker.py:85-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeout_s` to `float = 30.0` in one and `float = 10.0` 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 (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) scripts/diagnose_idle_render_cost.py:94 — scripts/diagnose_idle_render_cost.py:94-106 | scripts/repro_expand_edit_shortcut.py:100-112 | scripts/repro_input_flicker.py:105-117 | scripts/repro_input_lag.py:107-119 | scripts/repro_live_duplicate.py:68-80 | scripts/repro_slash_flicker.py:101-113 — 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 6 call sites, so a change lands once. 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 (12–13 lines × 5) · ×1
  • Duplicated block (12–13 lines × 5) scripts/diagnose_idle_render_cost.py:129 — scripts/diagnose_idle_render_cost.py:129-140 | scripts/repro_expand_edit_shortcut.py:288-300 | scripts/repro_input_flicker.py:140-151 | scripts/repro_input_lag.py:143-154 | scripts/repro_slash_flicker.py:136-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 5 call sites, so a change lands once. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeout_s` to `float = 10.0` in one and `float = 6.0` 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 (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) scripts/diagnose_idle_render_cost.py:167 — scripts/diagnose_idle_render_cost.py:167-178 | scripts/repro_expand_edit_shortcut.py:211-222 | scripts/repro_input_flicker.py:234-245 | scripts/repro_input_lag.py:190-201 | scripts/repro_live_duplicate.py:181-192 | scripts/repro_slash_flicker.py:193-204 — 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 6 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/repro_slash_flicker.py:192` calls `feed`, `decode` and `scripts/repro_input_lag.py:189` 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 (6–9 lines × 4) · ×1
  • Duplicated block (6–9 lines × 4) scripts/check_code_size_budget.py:135 — scripts/check_code_size_budget.py:135-143 | scripts/check_panic_budget.py:136-141 | scripts/check_swallowed_error_budget.py:191-196 | scripts/check_test_size_budget.py:121-127 — before extracting anything, compare `scripts/check_code_size_budget.py` and `scripts/check_test_size_budget.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check_code_size_budget.py:135` 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–9 lines × 2) · ×1
  • Duplicated block (5–9 lines × 2) scripts/dump_fresh_spawn_screen.py:37 — scripts/dump_fresh_spawn_screen.py:37-41 | scripts/repro_real_spawn_lag.py:140-148 — 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 `scripts/repro_real_spawn_lag.py:140` 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 × 8) · ×1
  • Duplicated block (8 lines × 8) scripts/check_donut_animates_live.py:93 — scripts/check_donut_animates_live.py:93-100 | scripts/count_idle_draws.py:76-83 | scripts/dump_fresh_spawn_screen.py:57-64 | scripts/pin_no_area_state.py:62-69 | scripts/probe_idle_state.py:122-129 | scripts/verify_donut_still_animates.py:97-104 | scripts/which_overlay_blocks_donut.py:66-73 | scripts/why_no_animation_area.py:57-64 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) scripts/diagnose_idle_render_cost.py:324 — scripts/diagnose_idle_render_cost.py:324-331 | scripts/repro_expand_edit_shortcut.py:436-443 | scripts/repro_input_flicker.py:483-491 | scripts/repro_input_lag.py:462-470 | scripts/repro_live_duplicate.py:447-454 | scripts/repro_slash_flicker.py:353-360 | scripts/repro_startup_lag.py:83-90 — 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 7 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/repro_input_flicker.py:483` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/repro_live_duplicate.py:446` calls `add_argument`, `parse_args` and `scripts/repro_input_flicker.py:483` 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 (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) scripts/diagnose_idle_render_cost.py:336 — scripts/diagnose_idle_render_cost.py:336-343 | scripts/profile_idle_donut.py:69-76 | scripts/profile_remote_resume_burst.py:327-334 | scripts/repro_expand_edit_shortcut.py:449-456 | scripts/repro_live_duplicate.py:460-467 | scripts/repro_slash_flicker.py:365-372 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 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. 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 (7 lines × 8) · ×1
  • Duplicated block (7 lines × 8) scripts/diagnose_idle_render_cost.py:337 — scripts/diagnose_idle_render_cost.py:337-343 | scripts/profile_idle_donut.py:70-76 | scripts/profile_remote_resume_burst.py:328-334 | scripts/repro_expand_edit_shortcut.py:450-456 | scripts/repro_input_flicker.py:503-509 | scripts/repro_input_lag.py:486-492 | scripts/repro_live_duplicate.py:461-467 | scripts/repro_slash_flicker.py:366-372 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/profile_idle_donut.py` as WHOLE FILES: this scan already matched 5 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. 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 (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) scripts/diagnose_idle_render_cost.py:220 — scripts/diagnose_idle_render_cost.py:220-226 | scripts/repro_input_flicker.py:295-300 | scripts/repro_slash_flicker.py:238-244 — before extracting anything, compare `scripts/diagnose_idle_render_cost.py` and `scripts/repro_input_flicker.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 167 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, `scripts/repro_input_flicker.py:304` calls `setdefault` and `scripts/diagnose_idle_render_cost.py:227` 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 (7 lines × 9) · ×1
  • Duplicated block (7 lines × 9) scripts/check_donut_animates_live.py:78 — scripts/check_donut_animates_live.py:78-84 | scripts/count_idle_draws.py:57-63 | scripts/dump_fresh_spawn_screen.py:42-48 | scripts/pin_no_area_state.py:47-53 | scripts/probe_idle_state.py:102-108 | scripts/profile_idle_donut.py:63-69 | scripts/verify_donut_still_animates.py:77-83 | scripts/which_overlay_blocks_donut.py:51-57 | scripts/why_no_animation_area.py:42-48 — before extracting anything, compare `scripts/check_donut_animates_live.py` and `scripts/count_idle_draws.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/profile_idle_donut.py:59` calls `Path`, `exists` and `scripts/count_idle_draws.py:56` 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 (4–5 lines × 4) · ×1
  • Duplicated block (4–5 lines × 4) scripts/count_idle_draws.py:53 — scripts/count_idle_draws.py:53-57 | scripts/pin_no_area_state.py:44-47 | scripts/probe_idle_state.py:98-102 | scripts/which_overlay_blocks_donut.py:48-51 — before extracting anything, compare `scripts/count_idle_draws.py` and `scripts/pin_no_area_state.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/count_idle_draws.py:50` calls `add_argument` and `scripts/probe_idle_state.py:97` 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 (26 lines × 4) · ×1
  • Duplicated block (26 lines × 4) scripts/bench_memory_cli.py:162 — scripts/bench_memory_cli.py:162-188 | scripts/bench_startup_visible_ready.py:131-157 | scripts/profile_remote_resume_burst.py:120-145 | scripts/profile_single_spawn.py:70-95 — 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. 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.
D5 · Coupling · Unstable project jcode-app-core · ×1
  • Unstable project jcode-app-core — jcode-app-core has instability 0.97 with 1 dependents.
D5 · Coupling · Unstable project jcode-protocol · ×1
  • Unstable project jcode-protocol — jcode-protocol has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project jcode-provider-bedrock · ×1
  • Unstable project jcode-provider-bedrock — jcode-provider-bedrock has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project jcode-provider-doctor · ×1
  • Unstable project jcode-provider-doctor — jcode-provider-doctor has instability 0.89 with 1 dependents.
D5 · Coupling · Unstable project jcode-setup-hints · ×1
  • Unstable project jcode-setup-hints — jcode-setup-hints has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project jcode-telemetry-core · ×1
  • Unstable project jcode-telemetry-core — jcode-telemetry-core has instability 0.88 with 1 dependents.
D5 · Coupling · Unstable project jcode-tui · ×1
  • Unstable project jcode-tui — jcode-tui has instability 0.96 with 1 dependents.
D5 · Coupling · Unstable project jcode-tui-messages · ×1
  • Unstable project jcode-tui-messages — jcode-tui-messages has instability 0.83 with 1 dependents.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 21 plain JS — the untyped files are scripts/accept_live_local_message.mjs, scripts/accept_live_local_message.test.mjs, scripts/test_version_sdk_release.mjs, scripts/version_sdk_release.mjs, telemetry-worker/scripts/model-price-report.mjs, telemetry-worker/scripts/move-bulk-events.mjs (+15 more).
R10 · Code Duplication · Duplicated block with local edits (38 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (38 matched lines × 2 locations) telemetry-worker/src/worker.js:1579 — telemetry-worker/src/worker.js:1579 · telemetry-worker/src/worker.js:1793 — the two spans are one implementation copied and then locally edited — 372 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×1
  • Duplicated block (20 lines × 2 locations) telemetry-worker/src/worker.js:291 — telemetry-worker/src/worker.js:291 · telemetry-worker/src/worker.js:435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×1
  • Duplicated block (16 lines × 2 locations) telemetry-worker/src/worker.js:426 — telemetry-worker/src/worker.js:426 · telemetry-worker/src/worker.js:474 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (12 lines × 2 locations) · ×1
  • Duplicated block (12 lines × 2 locations) scripts/accept_live_local_message.mjs:40 — scripts/accept_live_local_message.mjs:40 · scripts/accept_live_local_message.mjs:67 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (12 lines × 4 locations) · ×1
  • Duplicated block (12 lines × 4 locations) telemetry-worker/src/worker.js:1206 — telemetry-worker/src/worker.js:1206 · telemetry-worker/src/worker.js:1222 · telemetry-worker/src/worker.js:1238 · telemetry-worker/src/worker.js:1270 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (12 lines × 3 locations) · ×1
  • Duplicated block (12 lines × 3 locations) telemetry-worker/src/worker.js:2008 — telemetry-worker/src/worker.js:2008 · telemetry-worker/src/worker.js:2044 · telemetry-worker/src/worker.js:2071 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (9 lines × 3 locations) · ×1
  • Duplicated block (9 lines × 3 locations) telemetry-worker/src/worker.js:1989 — telemetry-worker/src/worker.js:1989 · telemetry-worker/src/worker.js:2015 · telemetry-worker/src/worker.js:2078 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (8 lines × 2 locations) · ×1
  • Duplicated block (8 lines × 2 locations) telemetry-worker/src/worker.js:1230 — telemetry-worker/src/worker.js:1230 · telemetry-worker/src/worker.js:1246 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (6 lines × 3 locations) · ×1
  • Duplicated block (6 lines × 3 locations) telemetry-worker/src/worker.js:411 — telemetry-worker/src/worker.js:411 · telemetry-worker/src/worker.js:467 · telemetry-worker/src/worker.js:490 — 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.
R10 · Code Duplication · Duplicated block (6 lines × 2 locations) · ×1
  • Duplicated block (6 lines × 2 locations) telemetry-worker/src/worker.js:2232 — telemetry-worker/src/worker.js:2232 · telemetry-worker/src/worker.js:2267 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function insertEvent (cyclomatic 135, cognitive 145) · ×1
  • Complex function insertEvent (cyclomatic 135, cognitive 145) telemetry-worker/src/worker.js:1183 — insertEvent has cyclomatic complexity 135 and cognitive complexity 145; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetch (cyclomatic 64, cognitive 73) · ×1
  • Complex function fetch (cyclomatic 64, cognitive 73) telemetry-worker/src/worker.js:510 — fetch has cyclomatic complexity 64 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertTurnDetails (cyclomatic 49, cognitive 46) · ×1
  • Complex function insertTurnDetails (cyclomatic 49, cognitive 46) telemetry-worker/src/worker.js:1579 — insertTurnDetails has cyclomatic complexity 49 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function classifyConcurrency (cyclomatic 40, cognitive 38) · ×1
  • Complex function classifyConcurrency (cyclomatic 40, cognitive 38) telemetry-worker/src/concurrency.js:20 — classifyConcurrency has cyclomatic complexity 40 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeUsageReportEvent (cyclomatic 38, cognitive 37) · ×1
  • Complex function normalizeUsageReportEvent (cyclomatic 38, cognitive 37) telemetry-worker/src/worker.js:2359 — normalizeUsageReportEvent has cyclomatic complexity 38 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function oauthAccount (cyclomatic 38, cognitive 33) · ×1
  • Complex function oauthAccount (cyclomatic 38, cognitive 33) telemetry-worker/src/oauth-account.js:14 — oauthAccount has cyclomatic complexity 38 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertSessionDetails (cyclomatic 35, cognitive 32) · ×1
  • Complex function insertSessionDetails (cyclomatic 35, cognitive 32) telemetry-worker/src/worker.js:1793 — insertSessionDetails has cyclomatic complexity 35 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeWebEvent (cyclomatic 33, cognitive 38) · ×1
  • Complex function normalizeWebEvent (cyclomatic 33, cognitive 38) telemetry-worker/src/worker.js:2102 — normalizeWebEvent has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function pruneOldEvents (cyclomatic 32, cognitive 60) · ×1
  • Complex function pruneOldEvents (cyclomatic 32, cognitive 60) telemetry-worker/src/worker.js:1044 — pruneOldEvents has cyclomatic complexity 32 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertTodoSessionDetails (cyclomatic 28, cognitive 25) · ×1
  • Complex function insertTodoSessionDetails (cyclomatic 28, cognitive 25) telemetry-worker/src/worker.js:2015 — insertTodoSessionDetails has cyclomatic complexity 28 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function main (cyclomatic 22, cognitive 28) · ×1
  • Complex function main (cyclomatic 22, cognitive 28) scripts/accept_live_local_message.mjs:89 — main has cyclomatic complexity 22 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertWebDetails (cyclomatic 21, cognitive 18) · ×1
  • Complex function insertWebDetails (cyclomatic 21, cognitive 18) telemetry-worker/src/worker.js:2051 — insertWebDetails has cyclomatic complexity 21 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function resolvePriceRows (cyclomatic 20, cognitive 30) · ×1
  • Complex function resolvePriceRows (cyclomatic 20, cognitive 30) telemetry-worker/src/model-pricing.js:160 — resolvePriceRows has cyclomatic complexity 20 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeDiscoveryEvent (cyclomatic 19, cognitive 21) · ×1
  • Complex function normalizeDiscoveryEvent (cyclomatic 19, cognitive 21) telemetry-worker/src/worker.js:2243 — normalizeDiscoveryEvent has cyclomatic complexity 19 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 18, cognitive 28) · ×1
  • Complex function (anonymous) (cyclomatic 18, cognitive 28) telemetry-worker/src/worker.js:700 — (anonymous) has cyclomatic complexity 18 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function validateTranscript (cyclomatic 17, cognitive 14) · ×1
  • Complex function validateTranscript (cyclomatic 17, cognitive 14) telemetry-worker/src/worker.js:867 — validateTranscript has cyclomatic complexity 17 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 16, cognitive 27) · ×1
  • Complex function (anonymous) (cyclomatic 16, cognitive 27) telemetry-worker/scripts/move-bulk-events.mjs:90 — (anonymous) has cyclomatic complexity 16 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeInstallFunnelEvent (cyclomatic 16, cognitive 16) · ×1
  • Complex function normalizeInstallFunnelEvent (cyclomatic 16, cognitive 16) telemetry-worker/src/worker.js:2187 — normalizeInstallFunnelEvent has cyclomatic complexity 16 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function q (cyclomatic 15, cognitive 24) · ×1
  • Complex function q (cyclomatic 15, cognitive 24) telemetry-worker/scripts/move-bulk-events.mjs:32 — q has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function execute (cyclomatic 15, cognitive 16) · ×1
  • Complex function execute (cyclomatic 15, cognitive 16) telemetry-worker/scripts/run-retention.mjs:42 — execute has cyclomatic complexity 15 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function writeFirehose (cyclomatic 15, cognitive 14) · ×1
  • Complex function writeFirehose (cyclomatic 15, cognitive 14) telemetry-worker/src/worker.js:374 — writeFirehose has cyclomatic complexity 15 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function recordDailyActivity (cyclomatic 14, cognitive 13) · ×1
  • Complex function recordDailyActivity (cyclomatic 14, cognitive 13) telemetry-worker/src/worker.js:1654 — recordDailyActivity has cyclomatic complexity 14 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ingestTranscript (cyclomatic 13, cognitive 13) · ×1
  • Complex function ingestTranscript (cyclomatic 13, cognitive 13) telemetry-worker/src/worker.js:796 — ingestTranscript has cyclomatic complexity 13 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertDiscoveryDetails (cyclomatic 13, cognitive 10) · ×1
  • Complex function insertDiscoveryDetails (cyclomatic 13, cognitive 10) telemetry-worker/src/worker.js:1989 — insertDiscoveryDetails has cyclomatic complexity 13 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function syncModelPrices (cyclomatic 12, cognitive 16) · ×1
  • Complex function syncModelPrices (cyclomatic 12, cognitive 16) telemetry-worker/src/model-pricing.js:320 — syncModelPrices has cyclomatic complexity 12 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function buildModelPriceReport (cyclomatic 12, cognitive 13) · ×1
  • Complex function buildModelPriceReport (cyclomatic 12, cognitive 13) telemetry-worker/scripts/model-price-report.mjs:3 — buildModelPriceReport has cyclomatic complexity 12 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function commonEventEntries (cyclomatic 12, cognitive 11) · ×1
  • Complex function commonEventEntries (cyclomatic 12, cognitive 11) telemetry-worker/src/worker.js:1863 — commonEventEntries has cyclomatic complexity 12 and cognitive complexity 11; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function main (cyclomatic 11, cognitive 16) · ×1
  • Complex function main (cyclomatic 11, cognitive 16) telemetry-worker/scripts/sync-model-prices.mjs:83 — main has cyclomatic complexity 11 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeLabel (cyclomatic 11, cognitive 13) · ×1
  • Complex function normalizeLabel (cyclomatic 11, cognitive 13) telemetry-worker/src/model-pricing.js:67 — normalizeLabel has cyclomatic complexity 11 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function writeConcurrencyFirehose (cyclomatic 11, cognitive 10) · ×1
  • Complex function writeConcurrencyFirehose (cyclomatic 11, cognitive 10) telemetry-worker/src/worker.js:320 — writeConcurrencyFirehose has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · telemetry-worker/src/worker.js · ×1
  • telemetry-worker/src/worker.js: 2342 lines of code telemetry-worker/src/worker.js:1 — telemetry-worker/src/worker.js has 2342 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
X15 · Unvalidated length from an untrusted reader · Length read from the parsed input is spent without ever being bounded · ×1
  • Length read from the parsed input is spent without ever being bounded crates/jcode-app-core/src/tool/session_search_index.rs:284 — `entry_count` is read from the bytes being parsed at line 283 (`read_u32`), then used to size a `Vec::with_capacity` at line 284 — and nowhere in its scope is `entry_count` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: it reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB, and an allocation the allocator refuses aborts the process with `memory allocation of … bytes failed` — an abort, not a panic, so no `catch_unwind` intercepts it and the whole process dies; a 64-bit length past `isize::MAX` panics with `capacity overflow` instead, out of a parser whose failure path was written for malformed input, not for hostile input. Bound `entry_count` against the bytes actually remaining and a maximum the format allows before allocating.
Minor — 122 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate scripts/measure_animation_cpu_cost.py:153 — `args.session or recent_session(debug_sock, str(REPO_ROOT))` appears character-identically in 3 files — scripts/measure_animation_cpu_cost.py, scripts/profile_real_spawn.py, scripts/repro_real_spawn_lag.py. 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 scripts/jcode_harbor_agent.py:37 — `candidate.exists() and candidate.is_file()` appears character-identically in 2 files — scripts/jcode_harbor_agent.py, scripts/jcode_harbor_claude_agent.py. 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 scripts/repro_input_flicker.py:498 — `env.get("JCODE_RUNTIME_DIR") or f"/run/user/{os.getuid()}"` appears character-identically in 3 files — scripts/repro_input_flicker.py, scripts/repro_input_lag.py, scripts/repro_startup_lag.py. 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 scripts/repro_input_flicker.py:499 — `env.get("JCODE_SOCKET") or str(real_runtime / "jcode.sock")` appears character-identically in 2 files — scripts/repro_input_flicker.py, scripts/repro_input_lag.py. 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 scripts/measure_animation_cpu_cost.py:69 — `env.get("JCODE_SOCKET") or str(runtime / "jcode.sock")` appears character-identically in 5 files — scripts/measure_animation_cpu_cost.py, scripts/profile_real_spawn.py, scripts/repro_real_spawn_lag.py, scripts/repro_startup_lag.py. 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 scripts/jcode_harbor_agent.py:294 — `isinstance(cache_read, int) and isinstance(cache_create, int)` appears character-identically in 2 files — scripts/jcode_harbor_agent.py, scripts/jcode_harbor_claude_agent.py. 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 scripts/check_code_size_budget.py:52 — `name == "tests.rs" or name.endswith("_tests.rs") or name.endswith("_test.rs") or name.startswith("tests_")` appears character-identically in 4 files — scripts/check_code_size_budget.py, scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py, scripts/check_test_size_budget.py. 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 scripts/cloud_acceptance_tui.py:376 — `not entry.name.isdigit() or int(entry.name) == os.getpid()` appears character-identically in 2 files — scripts/cloud_acceptance_tui.py, scripts/update_rehearsal.py. 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 scripts/check_code_size_budget.py:91 — `not isinstance(k, str) or not isinstance(v, int) or v <= 0` appears character-identically in 3 files — scripts/check_code_size_budget.py, scripts/check_panic_budget.py, scripts/check_test_size_budget.py. 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 scripts/check_code_size_budget.py:88 — `not isinstance(threshold, int) or threshold <= 0` appears character-identically in 2 files — scripts/check_code_size_budget.py, scripts/check_test_size_budget.py. 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 scripts/measure_animation_cpu_cost.py:66 — `os.environ.get("JCODE_RUNTIME_DIR") or f"/run/user/{os.getuid()}"` appears character-identically in 4 files — scripts/measure_animation_cpu_cost.py, scripts/profile_real_spawn.py, scripts/repro_real_spawn_lag.py, scripts/sweep_animation_fps.py. 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 scripts/check_donut_animates_live.py:78 — `os.environ.get("JCODE_SCRATCH_DIR") or tempfile.gettempdir()` appears character-identically in 13 files — scripts/check_donut_animates_live.py, scripts/count_idle_draws.py, scripts/dump_fresh_spawn_screen.py, scripts/measure_animation_cpu_cost.py. 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 scripts/jcode_harbor_agent.py:29 — `os.environ.get(env_name) or default_path` appears character-identically in 2 files — scripts/jcode_harbor_agent.py, scripts/jcode_harbor_claude_agent.py. 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 scripts/check_code_size_budget.py:46 — `part == "tests" or part.endswith("_tests") or part.endswith("_test") or part.startswith("tests_")` appears character-identically in 4 files — scripts/check_code_size_budget.py, scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py, scripts/check_test_size_budget.py. 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 scripts/check_panic_budget.py:64 — `path.suffix == ".rs" and not is_test_rust_file(path)` appears character-identically in 2 files — scripts/check_panic_budget.py, scripts/check_swallowed_error_budget.py. 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 scripts/benchmark_discovery.py:466 — `process.stdout is not None and process.stderr is not None` appears character-identically in 2 files — scripts/benchmark_discovery.py, scripts/benchmark_discovery_rate.py. 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 scripts/profile_idle_donut.py:123 — `rec.returncode != 0 or not data.exists()` appears character-identically in 2 files — scripts/profile_idle_donut.py, scripts/profile_real_spawn.py. 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 scripts/bench_headless_memory.py:223 — `shutil.which("claude") or str(Path.home() / ".local/bin/claude")` appears character-identically in 2 files — scripts/bench_headless_memory.py, scripts/bench_memory_cli.py. 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 crates/jcode-base/src/provider/pricing.rs:86 — `!creds.refresh_token.is_empty() || creds.id_token.is_some()` appears character-identically in 5 files — crates/jcode-base/src/provider/pricing.rs, crates/jcode-base/src/sidecar.rs, crates/jcode-base/src/usage.rs, crates/jcode-base/src/usage/provider_fetch.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 crates/jcode-base/src/usage.rs:716 — `!is_chatgpt || creds.access_token.is_empty()` appears character-identically in 2 files — crates/jcode-base/src/usage.rs, crates/jcode-base/src/usage/provider_fetch.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 crates/jcode-tui/src/tui/app/input.rs:4226 — `!messages.is_empty() && !preserve_visible_turn` appears character-identically in 2 files — crates/jcode-tui/src/tui/app/input.rs, crates/jcode-tui/src/tui/app/remote.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 crates/jcode-base/src/mcp/oauth.rs:158 — `!metadata.is_dir() || metadata.file_type().is_symlink()` appears character-identically in 2 files — crates/jcode-base/src/mcp/oauth.rs, src/cli/cloud_replace.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 crates/jcode-tui-account-picker/src/overlay.rs:363 — `!modifiers.contains(KeyModifiers::CONTROL) && !modifiers.contains(KeyModifiers::ALT)` appears character-identically in 3 files — crates/jcode-tui-account-picker/src/overlay.rs, crates/jcode-tui-usage-overlay/src/lib.rs, crates/jcode-tui/src/tui/login_picker.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 crates/jcode-setup-hints/src/linux_env.rs:598 — `!new_text.is_empty() && !new_text.ends_with('\n')` appears character-identically in 2 files — crates/jcode-setup-hints/src/linux_env.rs, crates/jcode-setup-hints/src/linux_niri.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 crates/jcode-app-core/src/server/input_shell_output.rs:28 — `!output.is_empty() && !output.ends_with('\n')` appears character-identically in 2 files — crates/jcode-app-core/src/server/input_shell_output.rs, crates/jcode-tui/src/tui/app/input/shell_commands.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.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on Err · ×37
  • Silent fallback default on Err crates/jcode-app-core/src/ambient/runner.rs:323 — `queue_json` 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 crates/jcode-app-core/src/ambient/runner.rs:364 — `log_json` 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 crates/jcode-app-core/src/ambient/prompt.rs:176 — `gather_recent_sessions` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-app-core/src/catchup.rs:257 — `load_seen_state` turns every `Err` into `PersistedCatchupState::default()` — 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 crates/jcode-app-core/src/server/await_members_state.rs:366 — `scan_pending_await_members_including_expired` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-app-core/src/server/idle_hibernation.rs:78 — `reclaim_idle_caches` 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 crates/jcode-app-core/src/server/swarm_watchdog.rs:133 — `update_stalls` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-app-core/src/session_active_pids.rs:39 — `active_session_ids` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-app-core/src/session_rebuild.rs:241 — `rebuild_version_label` turns every `Err` into `"local source build".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 crates/jcode-app-core/src/telemetry_state.rs:172 — `prune_active_session_files` 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 crates/jcode-base/src/gateway/registry.rs:23 — `load` turns every `Err` into `Self::default()` — 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 crates/jcode-base/src/mcp/schema_cache.rs:133 — `load_uncached` turns every `Err` into `Self::default()` — 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 crates/jcode-base/src/skill.rs:407 — `installed_plugin_paths` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-base/src/auth/refresh_state.rs:145 — `load_all` turns every `Err` into `BTreeMap::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 crates/jcode-base/src/auth/validation.rs:14 — `load_all` turns every `Err` into `BTreeMap::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 crates/jcode-base/src/client_focus.rs:138 — `clients_showing_session` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-base/src/client_focus.rs:152 — `clients_showing_session_in` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-base/src/mcp/oauth.rs:99 — `canonical_resource` turns every `Err` into `String::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 crates/jcode-base/src/mobile_sync.rs:683 — `drain_upload_response` turns every `Err` into `"read_error"` — 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 crates/jcode-base/src/model_usage.rs:180 — `legacy_selections` 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.
  • Silent fallback default on Err crates/jcode-base/src/scratch_maintenance.rs:163 — `busy_process_dirs` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-base/src/session/crash.rs:417 — `find_crashed_legacy_scan` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-base/src/session/prewarm.rs:104 — `sessions_owned_by` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/jcode-base/src/usage.rs:713 — `enqueue_openai_usage_tasks` 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 crates/jcode-base/src/usage/accessors.rs:319 — `get_openai_usage_for_email_sync` turns every `Err` into `OpenAIUsageData::default()` — 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.
  • + 12 more in this group — see findings.md.
X9 · Subsumed condition operand · Subsumed condition operand · ×24
  • Subsumed condition operand scripts/repro/tls-bad-record-mac/src/main.rs:35 — `lower.contains("operation timed out")` can never decide this `||` — every value satisfying `lower.contains("operation timed out")` also satisfies `lower.contains("timed out")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:42 — `lower.contains("fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:43 — `lower.contains("fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:44 — `lower.contains("received fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:45 — `lower.contains("received fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:83 — `error_str.contains("500 internal server error")` can never decide this `||` — every value satisfying `error_str.contains("500 internal server error")` also satisfies `error_str.contains("internal server error")`, 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 scripts/repro/tls-bad-record-mac/src/main.rs:86 — `error_str.contains("504 gateway timeout")` can never decide this `||` — every value satisfying `error_str.contains("504 gateway timeout")` also satisfies `error_str.contains("timeout")`, 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 crates/jcode-tui-mermaid/src/mermaid_svg.rs:21 — `trimmed.contains("-.->")` can never decide this `||` — every value satisfying `trimmed.contains("-.->")` also satisfies `trimmed.contains("-.-")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/jcode-tui/src/tui/ui_tools.rs:133 — `intent.contains("await")` can never decide this `||` — every value satisfying `intent.contains("await")` also satisfies `intent.contains("wait")`, 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 crates/jcode-tui/src/tui/session_picker/loading.rs:711 — `model.contains("openai-codex")` can never decide this `||` — every value satisfying `model.contains("openai-codex")` also satisfies `model.contains("codex")`, 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 crates/jcode-provider-openrouter-runtime/src/catalog_fetch.rs:296 — `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 crates/jcode-provider-openrouter/src/lib.rs:725 — `lower.contains("kimi-k2.5")` can never decide this `||` — every value satisfying `lower.contains("kimi-k2.5")` also satisfies `lower.contains("kimi-k2")`, 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 crates/jcode-provider-openai-runtime/src/openai_stream_runtime.rs:2000 — `error_str.contains("500 internal server error")` can never decide this `||` — every value satisfying `error_str.contains("500 internal server error")` also satisfies `error_str.contains("internal server error")`, 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 crates/jcode-provider-doctor/src/live_provider_probes.rs:1490 — `outcome.text.contains("REASON_TEST_ANSWER= 4")` can never decide this `||` — every value satisfying `outcome.text.contains("REASON_TEST_ANSWER= 4")` also satisfies `outcome.text.contains("REASON_TEST_ANSWER")`, 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 crates/jcode-provider-core/src/transport.rs:42 — `lower.contains("operation timed out")` can never decide this `||` — every value satisfying `lower.contains("operation timed out")` also satisfies `lower.contains("timed out")`, 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 crates/jcode-provider-core/src/transport.rs:62 — `lower.contains("fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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 crates/jcode-provider-core/src/transport.rs:63 — `lower.contains("fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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 crates/jcode-provider-core/src/transport.rs:64 — `lower.contains("received fatal alert: badrecordmac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: badrecordmac")` also satisfies `lower.contains("badrecordmac")`, 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 crates/jcode-provider-core/src/transport.rs:65 — `lower.contains("received fatal alert: bad_record_mac")` can never decide this `||` — every value satisfying `lower.contains("received fatal alert: bad_record_mac")` also satisfies `lower.contains("bad_record_mac")`, 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 crates/jcode-provider-anthropic-runtime/src/error_classification.rs:43 — `error_str.contains("500 internal server error")` can never decide this `||` — every value satisfying `error_str.contains("500 internal server error")` also satisfies `error_str.contains("internal server error")`, 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 crates/jcode-logging/src/lib.rs:619 — `name.starts_with("jcode-desktop-")` can never decide this `||` — every value satisfying `name.starts_with("jcode-desktop-")` also satisfies `name.starts_with("jcode-")`, 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 crates/jcode-logging/src/lib.rs:656 — `key.contains("oauth_code")` can never decide this `||` — every value satisfying `key.contains("oauth_code")` also satisfies `key.contains("auth_code")`, 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 crates/jcode-compaction-core/src/lib.rs:729 — `lower.contains("request exceeds the maximum size")` can never decide this `||` — every value satisfying `lower.contains("request exceeds the maximum size")` also satisfies `lower.contains("exceeds the maximum size")`, 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 crates/jcode-app-core/src/catchup.rs:446 — `lower.contains("pnpm test")` can never decide this `||` — every value satisfying `lower.contains("pnpm test")` also satisfies `lower.contains("npm test")`, 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.
D19 · Documentation Quality · Documentation · ×7
  • Documentation: no build, run or usage example sdk/npm/darwin-arm64/README.md:1 — `darwin-arm64` is a published package (`package.json` without `"private": true`) and neither `sdk/npm/darwin-arm64/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example sdk/npm/darwin-x64/README.md:1 — `darwin-x64` is a published package (`package.json` without `"private": true`) and neither `sdk/npm/darwin-x64/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example sdk/npm/linux-arm64/README.md:1 — `linux-arm64` is a published package (`package.json` without `"private": true`) and neither `sdk/npm/linux-arm64/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example sdk/npm/linux-x64/README.md:1 — `linux-x64` is a published package (`package.json` without `"private": true`) and neither `sdk/npm/linux-x64/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example sdk/npm/win32-arm64/README.md:1 — `win32-arm64` is a published package (`package.json` without `"private": true`) and neither `sdk/npm/win32-arm64/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example sdk/npm/win32-x64/README.md:1 — `win32-x64` is a published package (`package.json` without `"private": true`) and neither `sdk/npm/win32-x64/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no map of the repository's parts README.md:1 — The repository has 7 units (`darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64`, `win32-arm64`, ...); `README.md` and the documents it links name none of them. Add a short list of the parts and what each does.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×2
  • Silent fallback default on parse failure scripts/check_wildcard_reexport_budget.py:63 — `count_wildcards` returns `0` when `(OSError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure scripts/cloud_acceptance_tui.py:123 — `lease` returns `{}` when `(FileNotFoundError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. 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.
C4 · Data Retention · Partial data-retention evidence · ×1
  • Partial data-retention evidence — A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found Cargo.toml:108 — No ADRs found. The recognised ADR directories in this tree were read — `docs/proposals` — and none of their files is a decision record (a README, index or template page does not count). 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 `Cargo.toml` makes this repository a deployable product (line 108).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 4 of 93 project(s) overshoot their size bounds, lowering Project Cohesion to 9.1/10. The most over is `crates/jcode-tui` (190499 LoC, 391 module-visible types across 31 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Low CVE · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
ED3 · Event naming · Event not named in past tense · ×1
  • Event not named in past tense: UpdateStatus crates/jcode-base/src/bus.rs:422 — `UpdateStatus` is an imperative name inside a domain-event set whose siblings are past-tense facts — it reads as an intent, not something that happened. Name new events for the fact that occurred (e.g. `ItemAdded`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe.
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.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 14/22 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `crates/jcode-harness-api-server`, `crates/jcode-provider-bedrock`, `crates/jcode-provider-core` and 3 more.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation sdk/typescript/examples/demo-app/package.json:9 — `sdk/typescript/examples/demo-app/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch scripts/update_rehearsal.py:91 — `git_short_hash` swallows every exception into `return 'rehearsal'` — 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 — 47 finding(s)
D12 · Dependency Hygiene · Outdated · ×46
  • 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"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
  • Outdated: arboard — `arboard` is locked at 3.6.1 but 3.7.0 is the current stable release on crates.io, and it already satisfies the `"3"` requirement declared in crates/jcode-tui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arboard` and commit the updated REDACTED.
  • Outdated: aws-config — `aws-config` is locked at 1.9.0 but 1.13.2 is the current stable release on crates.io, and it already satisfies the `"1.9.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-config` and commit the updated REDACTED.
  • Outdated: aws-credential-types — `aws-credential-types` is locked at 1.3.0 but 1.3.1 is the current stable release on crates.io, and it already satisfies the `"1.3.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-credential-types` and commit the updated REDACTED.
  • Outdated: aws-sdk-bedrock — `aws-sdk-bedrock` is locked at 1.148.0 but 1.168.0 is the current stable release on crates.io, and it already satisfies the `"1.148.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-bedrock` and commit the updated REDACTED.
  • Outdated: aws-sdk-bedrockruntime — `aws-sdk-bedrockruntime` is locked at 1.136.0 but 1.155.0 is the current stable release on crates.io, and it already satisfies the `"1.136.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-bedrockruntime` and commit the updated REDACTED.
  • Outdated: aws-sdk-sts — `aws-sdk-sts` is locked at 1.108.0 but 1.126.0 is the current stable release on crates.io, and it already satisfies the `"1.108.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sdk-sts` and commit the updated REDACTED.
  • Outdated: aws-smithy-types — `aws-smithy-types` is locked at 1.6.1 but 1.9.4 is the current stable release on crates.io, and it already satisfies the `"1.6.1"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-types` and commit the updated REDACTED.
  • Outdated: aws-types — `aws-types` is locked at 1.4.0 but 1.7.0 is the current stable release on crates.io, and it already satisfies the `"1.4.0"` requirement declared in crates/jcode-provider-bedrock/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-types` and commit the updated REDACTED.
  • Outdated: azure_core — `azure_core` is locked at 1.0.0 but 1.1.0 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in crates/jcode-azure-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p azure_core` and commit the updated REDACTED.
  • Outdated: bytes — `bytes` is locked at 1.11.1 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-provider-core/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 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.6.1 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: flate2 — `flate2` is locked at 1.1.8 but 1.1.11 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-app-core/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 Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures` and commit the updated REDACTED.
  • Outdated: h2 — `h2` is locked at 0.4.19 but 0.4.20 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in crates/jcode-provider-cursor-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p h2` and commit the updated REDACTED.
  • Outdated: http — `http` is locked at 1.4.0 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-provider-cursor-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p http` and commit the updated REDACTED.
  • Outdated: image — `image` is locked at 0.25.9 but 0.25.10 is the current stable release on crates.io, and it already satisfies the `"0.25"` requirement declared in crates/jcode-base/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p image` and commit the updated REDACTED.
  • Outdated: lettre — `lettre` is locked at 0.11.22 but 0.11.23 is the current stable release on crates.io, and it already satisfies the `"0.11.22"` requirement declared in crates/jcode-notify-email/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p lettre` and commit the updated REDACTED.
  • Outdated: memchr — `memchr` is locked at 2.7.6 but 2.8.3 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in crates/jcode-session-types/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p memchr` and commit the updated REDACTED.
  • Outdated: objc2 — `objc2` is locked at 0.6.4 but 0.6.5 is the current stable release on crates.io, and it already satisfies the `"0.6"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p objc2` and commit the updated REDACTED.
  • Outdated: open — `open` is locked at 5.3.3 but 5.4.5 is the current stable release on crates.io, and it already satisfies the `"5"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p open` and commit the updated REDACTED.
  • Outdated: pdf-extract — `pdf-extract` is locked at 0.12.0 but 0.12.1 is the current stable release on crates.io, and it already satisfies the `"0.12"` requirement declared in crates/jcode-pdf/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p pdf-extract` 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 Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ratatui` and commit the updated REDACTED.
  • Outdated: rayon — `rayon` is locked at 1.11.0 but 1.12.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/jcode-productivity-core/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rayon` and commit the updated REDACTED.
  • + 21 more in this group — see findings.md.
D10 · Test Quality · Skipped (documented) · ×1
  • Skipped (documented): dashboard stays within a five-term SQLite compound SELECT budget telemetry-worker/test/concurrency.test.mjs:340 — Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call

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-5bdadf1cbf1d40a3a96d2ec2124b9faf/history.json --exit-code 0 --source .7artifacts/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-5bdadf1cbf1d40a3a96d2ec2124b9faf/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 --exclude sdk/typescript .127artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .19artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .0artifacts/raw/trivy-config.json
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 Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1daa9-b2fd-78d4-a86c-ea8bba8d5fbb · 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