Public report of futuregene/future-os, published 16 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 16 November 2026, 17:53 UTC · Survey ID cd_0350122586a24d81b71bbe32b19d1866
futuregene/future-os
Measured 16 November 2026, 17:52 UTC, at code version f45797c
First survey, so nothing to compare with yet
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
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: 781,411 lines of product code in 33 projects, tests not counted · Estimated rebuild effort: about 7.7 person-years · Weakest lens: Production Readiness, 44.6
Findings by how serious they are
161 critical2995 serious224 minor
13 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
16 November 2026, 17:52 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 ▸
73of 73 dimensions measured by tools.
3336of 3380 findings point to an exact file and line, so you can open each one in the code. The other 44 concern the repository as a whole, such as missing documentation.
73dimensions across 9 lenses, read from 781,411 lines of product code in 33 projects.
futuregene/future-os falls short of our standard for production, in part because it has uses of packages that aren't listed. It scores 50.3 out of 100 and is rated Adequate, and 128 of its 161 critical findings are security problems.
Production Readiness, at 44.6, is the weakest lens and counts most in the score. The best first step is replacing the two exposed passwords or keys and switching the old ones off, worth about 4.4 points. Tidying the declared packages would lift Production Readiness itself, worth about 3.9 points. Raising Production Readiness to 70 would lift the score to about 54.7.
Eighty-five pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Twenty-four weaknesses in the code could be used by an attacker, and ten secrets can leak from the build pipeline. Pinning each tool to an exact version, fixing the weaknesses the scanner points to and limiting each secret to its own step would close these risks. Passing outside input through environment variables would fix the three pipeline steps that put outside input straight into a shell command, and the two passwords or keys in the code and the two passwords or keys in the code's history need replacing, with the old ones switched off. The 14 sets of files in separate parts that keep changing together need that dependency made explicit.
The product code is 781,411 lines, about €1,100,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 44.6 to 70, the lowest score rated Strong, the score would rise from 50.3 to about 54.7.
Code composition: what the lines of code are
Product code 72%Tests 28%
Rebuild cost: about €1,100,000 · Estimate
Cost to rebuild
€370,000 to €1,900,000, for 6,177 to 19,595 hours of work, about 7.7 person-years for 4 to 15 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 50. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Very large: 781,411 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2).
Raises the score by about 4.4 points · Low effort · REDACTED Scanning
2
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
Raises the score by about 3.9 points · Medium effort · Dependency Hygiene
3
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Raises the score by about 3.0 points · Medium effort · Keyboard semantics
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 €1,100,000 to build again, about 7.7 person-years of work. Its weakest lens is Production Readiness, at 44.6 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 4.4 points for low effort, because it clears the 2 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 1,562,540 lines over the last 90 days, which is about 6,336,968 lines a year. At that pace, the extra work comes to an estimated 760.5 to 4563.3 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.
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.
1261 modules, with 1636 dependencies between them. 14 loops run through 59 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 1221 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.
desktop.src.components.layout uses desktop.src.integrations.storage.types, so a change to desktop.src.integrations.storage.types can break desktop.src.components.layout, while a change to desktop.src.components.layout can't break desktop.src.integrations.storage.types.
Position
Below the diagonal: desktop.src.components.layout uses a module listed above it, which is the healthy direction.
desktop.src.components.layout.hooks uses desktop.src.integrations.storage.types, so a change to desktop.src.integrations.storage.types can break desktop.src.components.layout.hooks, while a change to desktop.src.components.layout.hooks can't break desktop.src.integrations.storage.types.
Position
Below the diagonal: desktop.src.components.layout.hooks uses a module listed above it, which is the healthy direction.
desktop.src.features.agent uses desktop.src.integrations.storage.types, so a change to desktop.src.integrations.storage.types can break desktop.src.features.agent, while a change to desktop.src.features.agent can't break desktop.src.integrations.storage.types.
Position
Below the diagonal: desktop.src.features.agent uses a module listed above it, which is the healthy direction.
desktop.src.features.agent uses packages.thread-projection.src.model, so a change to packages.thread-projection.src.model can break desktop.src.features.agent, while a change to desktop.src.features.agent can't break packages.thread-projection.src.model.
Position
Below the diagonal: desktop.src.features.agent uses a module listed above it, which is the healthy direction.
desktop.src.features.remote-peer uses packages.thread-projection.src.model, so a change to packages.thread-projection.src.model can break desktop.src.features.remote-peer, while a change to desktop.src.features.remote-peer can't break packages.thread-projection.src.model.
Position
Below the diagonal: desktop.src.features.remote-peer uses a module listed above it, which is the healthy direction.
future_agent.rpc.protocol uses future_agent.types, so a change to future_agent.types can break future_agent.rpc.protocol, while a change to future_agent.rpc.protocol can't break future_agent.types.
Position
Below the diagonal: future_agent.rpc.protocol uses a module listed above it, which is the healthy direction.
future_agent.rpc.protocol uses future_rpc.payloads, so a change to future_rpc.payloads can break future_agent.rpc.protocol, while a change to future_agent.rpc.protocol can't break future_rpc.payloads.
Position
Below the diagonal: future_agent.rpc.protocol uses a module listed above it, which is the healthy direction.
21→40 future_agent.service uses future_agent.rpcpart of a loop✕
Connections
3 pairs of types, where a type in future_agent.service uses a type in future_agent.rpc.
future_agent.service uses future_agent.rpc, so a change to future_agent.rpc can break future_agent.service, while a change to future_agent.service can't break future_agent.rpc.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
future_agent.session.entry uses future_agent.types, so a change to future_agent.types can break future_agent.session.entry, while a change to future_agent.session.entry can't break future_agent.types.
Position
Below the diagonal: future_agent.session.entry uses a module listed above it, which is the healthy direction.
future_channel.providers.traits uses future_channel.bridge.inbound, so a change to future_channel.bridge.inbound can break future_channel.providers.traits, while a change to future_channel.providers.traits can't break future_channel.bridge.inbound.
Position
Below the diagonal: future_channel.providers.traits uses a module listed above it, which is the healthy direction.
23→33 future_channel.providers.traits uses future_channel.bridgepart of a loop✕
Connections
1 pair of types, where a type in future_channel.providers.traits uses a type in future_channel.bridge.
future_channel.providers.traits uses future_channel.bridge, so a change to future_channel.bridge can break future_channel.providers.traits, while a change to future_channel.providers.traits can't break future_channel.bridge.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
future_goal.contract uses future_goal.state, so a change to future_goal.state can break future_goal.contract, while a change to future_goal.contract can't break future_goal.state.
Position
Below the diagonal: future_goal.contract uses a module listed above it, which is the healthy direction.
future_goal.store uses future_goal.state, so a change to future_goal.state can break future_goal.store, while a change to future_goal.store can't break future_goal.state.
Position
Below the diagonal: future_goal.store uses a module listed above it, which is the healthy direction.
future_remote_server.supervisor uses future_remote_server.credentials, so a change to future_remote_server.credentials can break future_remote_server.supervisor, while a change to future_remote_server.supervisor can't break future_remote_server.credentials.
Position
Below the diagonal: future_remote_server.supervisor uses a module listed above it, which is the healthy direction.
future_tui.workbench.state uses future_tui.workbench.i18n, so a change to future_tui.workbench.i18n can break future_tui.workbench.state, while a change to future_tui.workbench.state can't break future_tui.workbench.i18n.
Position
Below the diagonal: future_tui.workbench.state uses a module listed above it, which is the healthy direction.
mobile.src.features.chat uses packages.markdown.src.types, so a change to packages.markdown.src.types can break mobile.src.features.chat, while a change to mobile.src.features.chat can't break packages.markdown.src.types.
Position
Below the diagonal: mobile.src.features.chat uses a module listed above it, which is the healthy direction.
mobile.src.features.chat uses packages.remote-protocol.src.types, so a change to packages.remote-protocol.src.types can break mobile.src.features.chat, while a change to mobile.src.features.chat can't break packages.remote-protocol.src.types.
Position
Below the diagonal: mobile.src.features.chat uses a module listed above it, which is the healthy direction.
packages.remote-client.src uses packages.remote-protocol.src.types, so a change to packages.remote-protocol.src.types can break packages.remote-client.src, while a change to packages.remote-client.src can't break packages.remote-protocol.src.types.
Position
Below the diagonal: packages.remote-client.src uses a module listed above it, which is the healthy direction.
packages.remote-client.src uses packages.thread-projection.src.model, so a change to packages.thread-projection.src.model can break packages.remote-client.src, while a change to packages.remote-client.src can't break packages.thread-projection.src.model.
Position
Below the diagonal: packages.remote-client.src uses a module listed above it, which is the healthy direction.
packages.remote-client.src.client uses packages.remote-protocol.src.types, so a change to packages.remote-protocol.src.types can break packages.remote-client.src.client, while a change to packages.remote-client.src.client can't break packages.remote-protocol.src.types.
Position
Below the diagonal: packages.remote-client.src.client uses a module listed above it, which is the healthy direction.
future_agent.session.manager uses future_agent.service, so a change to future_agent.service can break future_agent.session.manager, while a change to future_agent.session.manager can't break future_agent.service.
Position
Below the diagonal: future_agent.session.manager uses a module listed above it, which is the healthy direction.
future_agent.session.manager uses future_agent.session.entry, so a change to future_agent.session.entry can break future_agent.session.manager, while a change to future_agent.session.manager can't break future_agent.session.entry.
Position
Below the diagonal: future_agent.session.manager uses a module listed above it, which is the healthy direction.
future_agent.session.sqlite_store uses future_agent.service, so a change to future_agent.service can break future_agent.session.sqlite_store, while a change to future_agent.session.sqlite_store can't break future_agent.service.
Position
Below the diagonal: future_agent.session.sqlite_store uses a module listed above it, which is the healthy direction.
future_agent.session.sqlite_store uses future_agent.session.entry, so a change to future_agent.session.entry can break future_agent.session.sqlite_store, while a change to future_agent.session.sqlite_store can't break future_agent.session.entry.
Position
Below the diagonal: future_agent.session.sqlite_store uses a module listed above it, which is the healthy direction.
future_channel.bridge uses future_channel.bridge.inbound, so a change to future_channel.bridge.inbound can break future_channel.bridge, while a change to future_channel.bridge can't break future_channel.bridge.inbound.
Position
Below the diagonal: future_channel.bridge uses a module listed above it, which is the healthy direction.
future_channel.bridge uses future_channel.providers.traits, so a change to future_channel.providers.traits can break future_channel.bridge, while a change to future_channel.bridge can't break future_channel.providers.traits.
Position
Below the diagonal: future_channel.bridge uses a module listed above it, which is the healthy direction.
future_goal.console uses future_goal.state, so a change to future_goal.state can break future_goal.console, while a change to future_goal.console can't break future_goal.state.
Position
Below the diagonal: future_goal.console uses a module listed above it, which is the healthy direction.
future_goal.console uses future_goal.contract, so a change to future_goal.contract can break future_goal.console, while a change to future_goal.console can't break future_goal.contract.
Position
Below the diagonal: future_goal.console uses a module listed above it, which is the healthy direction.
future_goal.console uses future_goal.store, so a change to future_goal.store can break future_goal.console, while a change to future_goal.console can't break future_goal.store.
Position
Below the diagonal: future_goal.console uses a module listed above it, which is the healthy direction.
future_tui.workbench uses future_tui.workbench.i18n, so a change to future_tui.workbench.i18n can break future_tui.workbench, while a change to future_tui.workbench can't break future_tui.workbench.i18n.
Position
Below the diagonal: future_tui.workbench uses a module listed above it, which is the healthy direction.
future_tui.workbench uses future_tui.workbench.state, so a change to future_tui.workbench.state can break future_tui.workbench, while a change to future_tui.workbench can't break future_tui.workbench.state.
Position
Below the diagonal: future_tui.workbench uses a module listed above it, which is the healthy direction.
mobile.src.remote uses packages.remote-protocol.src.types, so a change to packages.remote-protocol.src.types can break mobile.src.remote, while a change to mobile.src.remote can't break packages.remote-protocol.src.types.
Position
Below the diagonal: mobile.src.remote uses a module listed above it, which is the healthy direction.
mobile.src.remote uses packages.remote-client.src.client, so a change to packages.remote-client.src.client can break mobile.src.remote, while a change to mobile.src.remote can't break packages.remote-client.src.client.
Position
Below the diagonal: mobile.src.remote uses a module listed above it, which is the healthy direction.
future_agent.rpc.broadcaster uses future_agent.rpc.protocol, so a change to future_agent.rpc.protocol can break future_agent.rpc.broadcaster, while a change to future_agent.rpc.broadcaster can't break future_agent.rpc.protocol.
Position
Below the diagonal: future_agent.rpc.broadcaster uses a module listed above it, which is the healthy direction.
future_agent.rpc.broadcaster uses future_agent.session.manager, so a change to future_agent.session.manager can break future_agent.rpc.broadcaster, while a change to future_agent.rpc.broadcaster can't break future_agent.session.manager.
Position
Below the diagonal: future_agent.rpc.broadcaster uses a module listed above it, which is the healthy direction.
future_agent.rpc.broadcaster uses future_agent.session.sqlite_store, so a change to future_agent.session.sqlite_store can break future_agent.rpc.broadcaster, while a change to future_agent.rpc.broadcaster can't break future_agent.session.sqlite_store.
Position
Below the diagonal: future_agent.rpc.broadcaster uses a module listed above it, which is the healthy direction.
future_tui.workbench.live uses future_tui.workbench.i18n, so a change to future_tui.workbench.i18n can break future_tui.workbench.live, while a change to future_tui.workbench.live can't break future_tui.workbench.i18n.
Position
Below the diagonal: future_tui.workbench.live uses a module listed above it, which is the healthy direction.
future_tui.workbench.live uses future_tui.workbench.state, so a change to future_tui.workbench.state can break future_tui.workbench.live, while a change to future_tui.workbench.live can't break future_tui.workbench.state.
Position
Below the diagonal: future_tui.workbench.live uses a module listed above it, which is the healthy direction.
future_tui.workbench.live uses future_tui.workbench, so a change to future_tui.workbench can break future_tui.workbench.live, while a change to future_tui.workbench.live can't break future_tui.workbench.
Position
Below the diagonal: future_tui.workbench.live uses a module listed above it, which is the healthy direction.
future_agent.rpc.session uses future_agent.types, so a change to future_agent.types can break future_agent.rpc.session, while a change to future_agent.rpc.session can't break future_agent.types.
Position
Below the diagonal: future_agent.rpc.session uses a module listed above it, which is the healthy direction.
future_agent.rpc.session uses future_rpc.payloads, so a change to future_rpc.payloads can break future_agent.rpc.session, while a change to future_agent.rpc.session can't break future_rpc.payloads.
Position
Below the diagonal: future_agent.rpc.session uses a module listed above it, which is the healthy direction.
future_agent.rpc.session uses future_agent.session.entry, so a change to future_agent.session.entry can break future_agent.rpc.session, while a change to future_agent.rpc.session can't break future_agent.session.entry.
Position
Below the diagonal: future_agent.rpc.session uses a module listed above it, which is the healthy direction.
future_agent.rpc.session uses future_agent.session.manager, so a change to future_agent.session.manager can break future_agent.rpc.session, while a change to future_agent.rpc.session can't break future_agent.session.manager.
Position
Below the diagonal: future_agent.rpc.session uses a module listed above it, which is the healthy direction.
future_agent.rpc.session uses future_agent.rpc.broadcaster, so a change to future_agent.rpc.broadcaster can break future_agent.rpc.session, while a change to future_agent.rpc.session can't break future_agent.rpc.broadcaster.
Position
Below the diagonal: future_agent.rpc.session uses a module listed above it, which is the healthy direction.
future_agent.rpc uses future_rpc.payloads, so a change to future_rpc.payloads can break future_agent.rpc, while a change to future_agent.rpc can't break future_rpc.payloads.
Position
Below the diagonal: future_agent.rpc uses a module listed above it, which is the healthy direction.
future_agent.rpc uses future_agent.rpc.protocol, so a change to future_agent.rpc.protocol can break future_agent.rpc, while a change to future_agent.rpc can't break future_agent.rpc.protocol.
Position
Below the diagonal: future_agent.rpc uses a module listed above it, which is the healthy direction.
future_agent.rpc uses future_agent.session.manager, so a change to future_agent.session.manager can break future_agent.rpc, while a change to future_agent.rpc can't break future_agent.session.manager.
Position
Below the diagonal: future_agent.rpc uses a module listed above it, which is the healthy direction.
future_agent.rpc uses future_agent.rpc.session, so a change to future_agent.rpc.session can break future_agent.rpc, while a change to future_agent.rpc can't break future_agent.rpc.session.
Position
Below the diagonal: future_agent.rpc uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 56.5 · Adequate · gated by D1, D2, X5 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
133
High / Critical
A03:2025 — Software Supply Chain Failures
22
Medium
A07:2025 — Authentication Failures
5
High / Critical
A02:2025 — Security Misconfiguration
1
Medium
Roadmap
Top priorities: Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2); Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2).
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
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 — 161
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 — 2995
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 — 224
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 73 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 — 73 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 3336 of 3380 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
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: the JavaScript/TypeScript half could not be measured — the dependency install for desktop/ was timed out after 600s, so the suite never ran. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
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 9,468 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 329 test source file(s) (.rs, .py) 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 MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the dependency install for desktop/ was timed out after 600s, so the suite never ran. This is OUR limitation, not a defect in the repo — it is excluded from the score.
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 for the vitest suite in desktop/ was NOT MEASURED: the dependency install for desktop/ was timed out after 600s, so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
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 for the jest suite in packages/remote-client/ was NOT MEASURED: the dependency install for packages/remote-client/ was timed out after 600s, so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
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 for the vitest suite in packages/remote-crypto/ was NOT MEASURED: the dependency install for packages/remote-crypto/ was timed out after 600s, so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
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 for the vitest suite in packages/remote-protocol/ was NOT MEASURED: the dependency install for packages/remote-protocol/ was timed out after 600s, so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D12 Dependency Hygiene — 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. Not scored — 2 Maven/Gradle manifest(s) were read, stating a version for 3 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — 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. D22's deterministic call-shape rules are gated per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): 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.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `desktop/src/components/layout/ActivityRail.tsx`, `desktop/src/components/layout/ContextPanel.tsx`, `desktop/src/features/markdown/useCodeHighlighter.ts`, `mobile/modules/future-share-intent/extension/ShareViewController.swift`, `mobile/src/remote/RemoteContext.tsx`, … (+5 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
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.
AX7 Slice cohesion — 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. 145 further occurrence(s) are not listed individually; the score already reflects all 185.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 272 further occurrence(s) are not listed individually; the score already reflects all 312.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 420 further occurrence(s) are not listed individually; the score already reflects all 460.
R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 51 further occurrence(s) are not listed individually; the score already reflects all 91.
X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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. 79 further occurrence(s) are not listed individually; the score already reflects all 119.
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.
X2 Cancellation propagation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X27 Collection changed while being enumerated — 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 repository's C# was parsed (it ships no .sln or .csproj, so it was read as syntax-only projects), but this check proves its findings from resolved symbols and a reference-free parse resolves none. It abstained rather than report a clean bill it could not earn. That is a gap in this analyzer's reach into build-less repositories — not a finding that the repository is free of what this check looks for.
X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D22 Internal API Consistency: API consistency compares the call shapes of members that play the same role on the exposed C# surface: whether the API suits its callers is not measured, and surfaces in other languages are not measured.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
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.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
502 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ActivityRail.ActivityRail at 290. A further 31 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 future_tui::workbench::i18n::pair at 383 — they are counted neither in the figure above nor in this dimension's score. 13 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: tui/src/workbench/i18n.rs (future_tui::workbench::i18n::pair at 383), tui/src/workbench/preferences.rs (Action::default_key at 30), cli/src/browser/input.rs (future_cli::browser::input::key_table at 23), tui/src/themes.rs (future_tui::themes::theme_for_spec at 23), mobile/src/remote/pendingPromptStorage.ts (pendingPromptStorage.loadPendingPromptDirect at 22), and 8 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.
+ 318 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with ActivityRail.ActivityRail (cyclomatic 290). — Refactoring it lifts Cyclomatic Complexity from 3.2 to about 3.5/10.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 384 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 18 bodies over 120 down to 120 or less in Cognitive Complexity — start with ActivityRail.ActivityRail (cognitive 444), Loop::run_streaming_inner (cognitive 400), AppShell.ReadyAppShell (cognitive 242). — 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 18 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.2 / 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.
ClassTooLong: Live · ×29tui/src/workbench/live.rs:166
TooManyMethods: Live · ×16tui/src/workbench/live.rs:166
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 214 FunctionTooLong finding(s) in God Classes — start with screen.rs (8), mod.rs (4), session.rs (4). — One of this dimension's main actionable groups (214 warning-level).
Resolve the 123 FileTooLong finding(s) in God Classes — start with mod.rs (8), session.rs (3), data.ts (2). — One of this dimension's main actionable groups (123 warning-level).
Resolve the 57 MethodTooLong finding(s) in God Classes — start with mod.rs (9), live.rs (4), session_prompt.rs (3). — One of this dimension's main actionable groups (57 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
360 duplicated block group(s) detected. 1.8 % of the production lines (14,264 of 781,411) are in a reported copy. A further 262 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 37 of the 622 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.
+ 148 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 35 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with mod.rs (2), providers.rs (2), email.rs (2). — One of this dimension's main actionable groups (35 warning-level).
Resolve the 33 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with decode.rs (2), harness.py (2), entries.rs. — One of this dimension's main actionable groups (33 warning-level).
Resolve the 33 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with task.rs (4), email.rs (3), REDACTED (3). — One of this dimension's main actionable groups (33 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling5.5 / 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.
33 production modules (Gradle+Cargo+npm), 0 dependency cycle(s), 2 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 16 module(s) off the main sequence, with abstractness counted on 28 of the 33 (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: @future-os/git-graph · ×16
Unstable project future-host
Unstable project future-tui
What to do
Resolve the 16 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (16 warning-level).
Resolve the 1 Unstable project future-host finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Unstable project future-tui 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.
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.
Low cohesion: Raw (LCOM4 6) · ×5cli/src/prompt.rs:117
What to do
Resolve the 5 Low cohesion finding(s) in Cohesion (LCOM4) — start with REDACTED, whatsapp.rs, linq.rs. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Stronggated by 6 serious findings✓ 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.
3 skipped (3 with a documented reason), 6 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 9468 tests. Measured on the JavaScript/TypeScript suite only — at least 329 test source file(s) (.rs, .py) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: accepts full nightly, test, and plain release versions · ×6scripts/tests/updater-signature.test.mjs:19
Mock-dominated test: foreground attempts immediately, then retries at 1s, 2s, 4s without network events · ×102packages/remote-client/tests/client.test.ts:348
Resolve the 102 Mock-dominated test finding(s) in Test Quality — start with client.test.ts (28), useFileDownload.test.ts (16), useTimelineController.test.ts (6). — One of this dimension's main actionable groups (102 recommendation-level).
Resolve the 6 No assertions finding(s) in Test Quality — start with agentStateCache.test.ts (2), updater-signature.test.mjs, secureChannel.perf.test.ts. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 726 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. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: desktop/src/components/layout/ActivityRail.tsx (53×290=15370); desktop/src/components/layout/AppShell.tsx (91×164=14924); mobile/src/screens/SessionList.tsx (51×227=11577) Repeated repair below the complexity floor: desktop/src-tauri/src/commands/threads.rs (15 of 29 changes were fixes); desktop/src/integrations/agent/agentClient.ts (11 of 19 changes were fixes); desktop/src/features/agent/useAgentThreadState.ts (10 of 14 changes were fixes)
Resolve the 245 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (10), RemoteContext.tsx (2), run.rs (2). — One of this dimension's main actionable groups (245 warning-level).
Resolve the 42 Repeated repair finding(s) in Churn × Complexity Hotspots — start with mod.rs (4), resilience.rs (2), threads.rs. — One of this dimension's main actionable groups (42 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor7.8 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
294 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is orchestration/goal/src/console.rs. Counted over 1339 of the 1720 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
0 deducted task-comment markers across 781411 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
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.
0 of 1 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question, a date that is no calendar day). How well each record argues its case is not measured.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
1 naming inconsistencies among 18 declarations measured against a convention their peers follow.
`toJSON` spells `JSON` where 17 names in the project spell it `Json`desktop/shot/mock/core.ts:26
What to do
Resolve the 1 `toJSON` spells `JSON` where 17 names in the project spell it `Json` finding(s) in Naming Consistency — start with core.ts. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D22 · Internal API Consistency10.0 / 10Exemplary○ Nothing flagged
What it measures: Whether the internal API surface is consistent and coherent.
Method: Call-shape rules (A1-A9) over the structured code model of the intentionally exposed C# surface: members of one type, overloads of one name and the same slot across sibling types are compared, and a member that makes a caller use a different convention for the same kind of operation is flagged. Deterministic, no model. Advisory.
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.
8 of 32 build units (Cargo, Gradle, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion · ×8agent/Cargo.toml:1
What to do
Resolve the 8 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with Cargo.toml (5), package.json (3). — One of this dimension's main actionable groups (8 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
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
Resolve the 2 REDACTED finding(s) in Secrets (history) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
133 finding(s): 0 critical, 124 high, 8 medium, 1 low. 85 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 31 file(s) — `benchmark/fusion/suites/baseline-400.cases.json`, `benchmark/fusion/suites/dev-12.cases.json`, `desktop/src/components/layout/ActivityRail.tsx` (line 210, line 212, line 214, …), `desktop/src/components/layout/AppShell.tsx`, `desktop/src/components/layout/ContextPanel.tsx` (line 40, line 63, line 68), … (+26 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 7 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
+ 6 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 24 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (5), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (24 issue-level).
Resolve the 10 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (5), REDACTED (5). — One of this dimension's main actionable groups (10 issue-level).
No action in Static Analysis (SAST) — all 85 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 (85 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 5 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (4), REDACTED. — One of this dimension's main actionable groups (5 warning-level).
Resolve the 4 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Resolve the 4 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 1 Medium IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
Every significant source file has living knowledge — recently and meaningfully worked. Counted over 1339 of the 1720 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 14 Boundary-crossing change coupling finding(s) in Change Coupling — start with TasksView.tsx (3), useTasks.ts (3), data.ts (3). — One of this dimension's main actionable groups (14 issue-level).
Resolve the 15 Change coupling finding(s) in Change Coupling — start with commands.rs (2), REDACTED, TasksView.tsx. — One of this dimension's main actionable groups (15 warning-level).
Resolve the 7 Change-coupling hub finding(s) in Change Coupling — start with TasksSettingsPage.tsx, locales.ts, REDACTED. — One of this dimension's main actionable groups (7 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 3 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives5.3 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. — desktop/src/features/artifacts/PdfPreview.tsx:92
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels5.5 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×10) — desktop/src/components/layout/OnboardingGate.tsx:302, desktop/src/components/layout/OnboardingGate.tsx:318, desktop/src/features/settings/EnvironmentPage.tsx:72, …
This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×2) — desktop/src/features/agent/ApprovalPrompt.tsx:243, mobile/src/features/chat/components/SendQueuePanel.tsx:203
This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×14) — desktop/src/features/agent/NewConversationWorkspaceForm.tsx:63, desktop/src/features/artifacts/ArtifactsPanel.tsx:91, desktop/src/features/settings/ModelsPage.tsx:90, …
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — desktop/src/features/markdown/MarkdownContent.tsx:341
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×2) — host/web/index.html:135, host/web/index.html:165
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×3) — desktop/scripts/storage-read-benchmark.html:2, desktop/scripts/streaming-markdown-benchmark.html:2, host/web/index.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. — desktop/src/components/layout/AppShell.tsx:2086
This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×3) — desktop/src/components/ui/Dialog.tsx:33, desktop/src/features/palette/ShortcutCheatSheet.tsx:54, desktop/src/features/settings/SettingsDialog.tsx:132
This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×2) — desktop/src/features/agent/composer/ChoicePopover.tsx:73, desktop/src/features/remote-peer/RemoteUsageDialog.tsx:37
This <div> binds mousedown, mouseup, mousemove, wheel and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. — desktop/src/features/filepreview/ImagePreview.tsx:279
This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — desktop/src/features/palette/CommandPalette.tsx:134
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — desktop/src/features/vibe/AddToVibeDialog.tsx:122
This <header> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. — desktop/src/features/vibe/VibeStage.tsx:1032
This <div> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. — desktop/src/features/vibe/VibeStage.tsx:1266
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×3) — desktop/src/components/layout/ConversationSearch.tsx:97, desktop/src/features/agent/search/ThreadSearch.tsx:267, desktop/src/features/palette/CommandPalette.tsx:142
<span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — desktop/src/components/layout/RailRow.tsx:284
<div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — desktop/src/features/agent/MentionEditor.tsx:1039
<span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — desktop/src/features/agent/MessageBlock.tsx:545
<textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×2) — desktop/src/features/agent/SendQueuePanel.tsx:302, desktop/src/features/remote-peer/RemoteComposer.tsx:1486
`button` sets color: #fff on background-color: #2b6cff — 4.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — host/web/index.html:30
`#presenceStatus.offline` sets color: #9aa4b2 on background-color: #4a4a4a — 3.5:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — host/web/index.html:38
`h3 .num` sets color: #2b6cff on background-color: #eaf0ff — 3.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — scripts/screenshots/document.css:13
`.tag` sets color: #2b6cff on background-color: #eef3ff — 4.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — scripts/screenshots/document.css:38
`.animate-pop-in` moves (`animation: pop-in 0.24s ease-out both`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — desktop/src/styles/globals.css:187
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Other · Architecture — Whether feature slices stay independent (no direct cross-slice references) — the discipline that makes vertical-slice architecture pay off.
Method: Roslyn scan (vertical-slice gated): feature slices resolved from namespaces (.Features.*, .Slices.*) or project names; cross-slice type references detected. Deterministic, traceable.
`AgentThread` (slice 'agent') depends on `useCommand` from slice 'keyboard'. — desktop/src/features/agent/AgentThread.tsx:457
`AgentThread` (slice 'agent') depends on `installRecommendedSkill` from slice 'skills'. — desktop/src/features/agent/AgentThread.tsx:645
`AgentThread` (slice 'agent') depends on `ChoiceCardAnswer` from slice 'markdown'. — desktop/src/features/agent/AgentThread.tsx:676
`ComposerImpl` (slice 'agent') depends on `useCommand` from slice 'keyboard'. — desktop/src/features/agent/Composer.tsx:515
`MessageBlockProps` (slice 'agent') depends on `ChoiceCardAnswer` from slice 'markdown'. — desktop/src/features/agent/MessageBlock.tsx:42
`MessageBlockImpl` (slice 'agent') depends on `MarkdownContent` from slice 'markdown'. — desktop/src/features/agent/MessageBlock.tsx:243
`MessageBlockImpl` (slice 'agent') depends on `STREAMED_BLOCK_CONTAINMENT` from slice 'markdown'. — desktop/src/features/agent/MessageBlock.tsx:271
`MessageBlockImpl` (slice 'agent') depends on `StreamingMarkdownContent` from slice 'markdown'. — desktop/src/features/agent/MessageBlock.tsx:308
`MessageListProps` (slice 'agent') depends on `ChoiceCardAnswer` from slice 'markdown'. — desktop/src/features/agent/MessageList.tsx:35
`NewConversation` (slice 'agent') depends on `fetchCoachPrompt` from slice 'skills'. — desktop/src/features/agent/NewConversation.tsx:197
`NewConversation` (slice 'agent') depends on `installRecommendedSkill` from slice 'skills'. — desktop/src/features/agent/NewConversation.tsx:242
`NewConversation` (slice 'agent') depends on `SkillGuideBanner` from slice 'skills'. — desktop/src/features/agent/NewConversation.tsx:436
`ThinkingBlock` (slice 'agent') depends on `STREAMED_BLOCK_CONTAINMENT` from slice 'markdown'. — desktop/src/features/agent/ThinkingBlock.tsx:118
`ThinkingBlock` (slice 'agent') depends on `StreamingMarkdownContent` from slice 'markdown'. — desktop/src/features/agent/ThinkingBlock.tsx:121
`ThreadHeader` (slice 'agent') depends on `useCommand` from slice 'keyboard'. — desktop/src/features/agent/ThreadHeader.tsx:73
`summarizeRunForPrompt` (slice 'agent') depends on `toolCommand` from slice 'runs'. — desktop/src/features/agent/buildContinuePrompt.ts:70
`buildReferenceContext` (slice 'agent') depends on `parseFutureMarkdown` from slice 'markdown'. — desktop/src/features/agent/buildReferencePrompt.ts:19
`buildReferenceContext` (slice 'agent') depends on `referenceKey` from slice 'markdown'. — desktop/src/features/agent/buildReferencePrompt.ts:24
`buildReferenceContext` (slice 'agent') depends on `resolveFutureReferences` from slice 'markdown'. — desktop/src/features/agent/buildReferencePrompt.ts:28
`ChoicePopoverProps` (slice 'agent') depends on `ChoiceCardMode` from slice 'markdown'. — desktop/src/features/agent/composer/ChoicePopover.tsx:14
`ChoicePopoverProps` (slice 'agent') depends on `ChoiceCardOption` from slice 'markdown'. — desktop/src/features/agent/composer/ChoicePopover.tsx:15
`ComposerControls` (slice 'agent') depends on `useCommand` from slice 'keyboard'. — desktop/src/features/agent/composer/ComposerControls.tsx:144
`ChoiceAnswer` (slice 'agent') depends on `ChoiceCardMode` from slice 'markdown'. — desktop/src/features/agent/composer/choiceAnswer.ts:20
`AttachmentChip` (slice 'agent') depends on `useRemoteAttachmentOrigin` from slice 'remote-peer'. — desktop/src/features/agent/messages/AttachmentChip.tsx:26
`AttachmentChip` (slice 'agent') depends on `previewKindForPath` from slice 'filepreview'. — desktop/src/features/agent/messages/AttachmentChip.tsx:31
`AttachmentChip` (slice 'agent') depends on `previewRemoteFile` from slice 'remote-peer'. — desktop/src/features/agent/messages/AttachmentChip.tsx:47
`AttachmentChip` (slice 'agent') depends on `FilePreviewOverlay` from slice 'filepreview'. — desktop/src/features/agent/messages/AttachmentChip.tsx:109
`ThreadSearch` (slice 'agent') depends on `useCommand` from slice 'keyboard'. — desktop/src/features/agent/search/ThreadSearch.tsx:194
`mayContainThreadSearch` (slice 'agent') depends on `parseFutureMarkdown` from slice 'markdown'. — desktop/src/features/agent/threadSearchCache.ts:22
`MarkdownPreview` (slice 'filepreview') depends on `MarkdownContent` from slice 'markdown'. — desktop/src/features/filepreview/MarkdownPreview.tsx:58
`TextPreview` (slice 'filepreview') depends on `useCodeHighlighter` from slice 'markdown'. — desktop/src/features/filepreview/TextPreview.tsx:50
`TextPreview` (slice 'filepreview') depends on `MAX_HIGHLIGHTABLE_CODE_LENGTH` from slice 'markdown'. — desktop/src/features/filepreview/TextPreview.tsx:53
`TextPreview` (slice 'filepreview') depends on `HighlightedCode` from slice 'markdown'. — desktop/src/features/filepreview/TextPreview.tsx:84
`FileTreePanel` (slice 'filetree') depends on `useLinkContextMenu` from slice 'markdown'. — desktop/src/features/filetree/FileTreePanel.tsx:49
`FileTreePanel` (slice 'filetree') depends on `previewKindForPath` from slice 'filepreview'. — desktop/src/features/filetree/FileTreePanel.tsx:99
`FileTreePanel` (slice 'filetree') depends on `LinkMenuItem` from slice 'markdown'. — desktop/src/features/filetree/FileTreePanel.tsx:134
`FileTreePanel` (slice 'filetree') depends on `LinkContextMenu` from slice 'markdown'. — desktop/src/features/filetree/FileTreePanel.tsx:364
`FileTreePanel` (slice 'filetree') depends on `FilePreviewOverlay` from slice 'filepreview'. — desktop/src/features/filetree/FileTreePanel.tsx:368
`siblingImages` (slice 'filetree') depends on `previewKindForPath` from slice 'filepreview'. — desktop/src/features/filetree/imageSiblings.ts:28
`FusionDiscussionPanel` (slice 'fusion') depends on `usePreviewLoadingGate` from slice 'filepreview'. — desktop/src/features/fusion/FusionDiscussionPanel.tsx:27
What to do
Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Other · Domain Modelling — Whether an aggregate references another aggregate by identity rather than embedding it by object reference.
Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.
Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.
Other · Domain Modelling — Whether domain identifiers are strongly typed (a newtype wrapper) rather than raw primitives — consistency once an idiom exists.
Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. Deterministic, adoption percentage.
Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.
Do you agree with this assessment?
DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.
Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
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.
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.
Other · Code Health — Unreviewed-generation residue: shipped members still throwing NotImplementedException, and placeholder string literals left in non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
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.
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.
1 ADR-shaped document(s) detected by content — `docs/design/workspace-thread-archive-and-paging.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
`docs/architecture/fusion.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-tasks`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — docs/architecture/fusion.md:160
`docs/architecture/headless-package-development.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-channel`, `future-tui`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — docs/architecture/headless-package-development.md:59
`docs/architecture/headless-package-development.zh-CN.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-channel`, `future-tui`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — docs/architecture/headless-package-development.zh-CN.md:59
`docs/architecture/remote-package-development.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-agent`, `future-channel`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — docs/architecture/remote-package-development.md:47
`docs/guide/ci.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-fusion`, `future-config`, `future-http`, `future-logging`, `future-relay-endpoint`, `@future-os/git-graph`, `@future-os/peer-icons`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — docs/guide/ci.md:108
`docs/guide/ci.zh-CN.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-fusion`, `future-config`, `future-http`, `future-logging`, `future-relay-endpoint`, `@future-os/git-graph`, `@future-os/peer-icons`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — docs/guide/ci.zh-CN.md:88
What to do
Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
Update docs/architecture/fusion.md so it draws the parts the code has today: add future-tasks.
Update docs/architecture/headless-package-development.md so it draws the parts the code has today: add future-channel, future-tui.
Update docs/architecture/headless-package-development.zh-CN.md so it draws the parts the code has today: add future-channel, future-tui.
Update docs/architecture/remote-package-development.md so it draws the parts the code has today: add future-agent, future-channel.
Update docs/guide/ci.md so it draws the parts the code has today: add future-fusion, future-config, future-http, future-logging, future-relay-endpoint, @future-os/git-graph, @future-os/peer-icons.
Update docs/guide/ci.zh-CN.md so it draws the parts the code has today: add future-fusion, future-config, future-http, future-logging, future-relay-endpoint, @future-os/git-graph, @future-os/peer-icons.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability6.4 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 6/13 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `desktop`, `orchestration/goal`, `packages/remote-server` and 2 more.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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.
`desktop/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`. — desktop/package.json:19
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Deployment is orchestrated by compose, but no service declares a `healthcheck:` and nothing pins a previous image to fall back to — the runtime can tell that the container is up, not that it is serving, so a bad release is harder to detect and reverse. — REDACTED:211
What to do
Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
Do you agree with this assessment?
P5 · DR & Backup10.0 / 10Exemplary✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — channels/src/tls.rs:12, packages/http/src/lib.rs:27
`reqwest::blocking::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — packages/http/src/lib.rs:44
What to do
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
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.
`mkdirSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — harness/lib/cli-driver.mjs:102, harness/lib/cli-driver.mjs:287
`appendFileSync` in `note` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/cli-driver.mjs:114
`existsSync` in `queryDb` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/cli-driver.mjs:123
`writeFileSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — harness/lib/cli-driver.mjs:202, harness/lib/cli-driver.mjs:203, harness/lib/cli-driver.mjs:351
`rmSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/cli-driver.mjs:294
`mkdirSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — harness/lib/data.mjs:27, harness/lib/data.mjs:70
`existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×6) — harness/lib/data.mjs:28, harness/lib/data.mjs:31, harness/lib/data.mjs:64, …
`readFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/data.mjs:29
`copyFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×4) — harness/lib/data.mjs:42, harness/lib/data.mjs:65, harness/lib/data.mjs:74, …
`execFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/data.mjs:44
`statSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/data.mjs:53
`cpSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/data.mjs:78
`writeFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/data.mjs:83
`existsSync` in `ensureDevServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/dev-server.mjs:106
`existsSync` in `ensureMobileServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — harness/lib/dev-server.mjs:137, harness/lib/dev-server.mjs:144
`existsSync` in `callback to filter` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/dev-server.mjs:152
`existsSync` in `callback to candidates.find` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/dev-server.mjs:199
`readFileSync` in `callback to createHttpServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/dev-server.mjs:211
`existsSync` in `ensureTerminalServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/dev-server.mjs:251
`mkdirSync` in `runRemoteLiveCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/remote-live.mjs:113
`writeFileSync` in `append` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/remote-live.mjs:162
`existsSync` in `readLog` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/remote-live.mjs:392
`readFileSync` in `readLog` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/remote-live.mjs:392
`writeFileSync` in `runRemoteLiveCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/lib/remote-live.mjs:432
`fs.existsSync` in `judge` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/scripts/video-judge.mjs:132
`fs.readFileSync` in `judge` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/scripts/video-judge.mjs:133
`fs.writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — harness/scripts/video-judge.mjs:188
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety9.2 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
73 duplicated blocks under the repository root have copies in at least two of the sibling directories desktop, harness, mobile, packages, scripts — 54 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 73 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 73 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 73 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — desktop/src/features/settings/CustomProviderDialog.tsx:130
44 duplicated blocks under desktop/src/features/ have copies in at least two of the sibling directories agent, artifacts, filepreview, filetree, keyboard, markdown (+8 more sibling(s) not listed) — 21 of them are reported below, and 23 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 44 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 44 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 44 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — desktop/src/features/agent/agentQueue.ts:133
39 duplicated blocks under mobile/src/ have copies in at least two of the sibling directories components, features, i18n, lib, notifications, remote (+3 more sibling(s) not listed) — 13 of them are reported below, and 26 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 39 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 39 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 39 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — mobile/src/i18n/LanguageSettings.tsx:17
26 duplicated blocks under desktop/src/ have copies in at least two of the sibling directories components, features, integrations, lib — 13 of them are reported below, and 13 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 26 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 26 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 26 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — desktop/src/components/layout/ArchiveGuideBubble.tsx:34
mobile/src/features/settings/DateField.tsx:10 · mobile/src/features/settings/TimeField.tsx:10 — the two spans are one implementation copied and then locally edited — 1059 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — mobile/src/features/settings/DateField.tsx:10
desktop/src/features/agent/agentQueue.ts:133 · desktop/src/features/remote-peer/remoteQueue.ts:123 — the two spans are one implementation copied and then locally edited — 987 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/agent/agentQueue.ts:133
desktop/src/features/settings/CustomProviderDialog.tsx:130 · mobile/src/features/settings/CustomProviderPage.tsx:176 — the two spans are one implementation copied and then locally edited — 595 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/settings/CustomProviderDialog.tsx:130
scripts/measure/measure-sync-browser.ts:19 · scripts/measure/measure-sync-snapshot.ts:21 — the two spans are one implementation copied and then locally edited — 917 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/measure/measure-sync-browser.ts:19
desktop/src/features/remote-peer/RemoteProvidersPanel.tsx:47 · desktop/src/features/remote-peer/RemoteWorkspacesPanel.tsx:41 — the two spans are one implementation copied and then locally edited — 456 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/remote-peer/RemoteProvidersPanel.tsx:47
desktop/src/features/review/GitChangesReview.tsx:39 · desktop/src/features/review/LastRunReview.tsx:99 — the two spans are one implementation copied and then locally edited — 271 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/review/GitChangesReview.tsx:39
harness/lib/remote-live.mjs:343 · harness/lib/remote-mobile-live.mjs:275 — the two spans are one implementation copied and then locally edited — 477 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — harness/lib/remote-live.mjs:343
desktop/shot/mock/data.ts:919 · mobile/shot/mock/data.ts:363 — the 2 copies are spread across 2 files, 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. — desktop/shot/mock/data.ts:919
desktop/src/components/layout/recentOrder.ts:115 · mobile/src/screens/recentRows.ts:98 — the two spans are one implementation copied and then locally edited — 399 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/layout/recentOrder.ts:115
mobile/src/features/chat/components/SendChoiceSheet.tsx:47 · mobile/src/features/chat/components/SessionUsageSheet.tsx:75 — the two spans are one implementation copied and then locally edited — 360 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — mobile/src/features/chat/components/SendChoiceSheet.tsx:47
mobile/src/features/chat/messages/ReplyBlocks.tsx:249 · mobile/src/features/chat/messages/ReplyBlocks.tsx:376 — the two spans are one implementation copied and then locally edited — 327 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. — mobile/src/features/chat/messages/ReplyBlocks.tsx:249
mobile/src/remote/pendingContinuationStorage.ts:10 · mobile/src/remote/pendingPromptStorage.ts:26 — the two spans are one implementation copied and then locally edited — 347 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — mobile/src/remote/pendingContinuationStorage.ts:10
desktop/src/features/remote-peer/RemoteFilesDialog.tsx:52 · desktop/src/features/remote-peer/useRemoteFiles.ts:120 — the two spans are one implementation copied and then locally edited — 209 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/remote-peer/RemoteFilesDialog.tsx:52
mobile/src/i18n/LanguageSettings.tsx:17 · mobile/src/theme/AppearanceSettings.tsx:32 — the two spans are one implementation copied and then locally edited — 339 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — mobile/src/i18n/LanguageSettings.tsx:17
desktop/src/features/remote-peer/remoteReasoning.ts:24 · desktop/src/features/remote-peer/remoteToolTarget.ts:22 — the two spans are one implementation copied and then locally edited — 273 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/remote-peer/remoteReasoning.ts:24
desktop/src/features/remote-peer/remoteSessionReference.ts:157 · mobile/src/features/chat/sessionCompletion.ts:42 — the two spans are one implementation copied and then locally edited — 331 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/remote-peer/remoteSessionReference.ts:157
desktop/src/features/tasks/TasksView.tsx:182 · mobile/src/features/settings/TasksSettingsPage.tsx:335 — the two spans are one implementation copied and then locally edited — 265 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/tasks/TasksView.tsx:182
desktop/src/features/agent/composer/choiceAnswer.ts:66 · mobile/src/features/chat/choiceAnswer.ts:41 — the two spans are one implementation copied and then locally edited — 343 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/agent/composer/choiceAnswer.ts:66
desktop/src/features/remote-peer/RemotePeersView.tsx:601 · desktop/src/features/remote-peer/RemoteRenameDialog.tsx:72 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/features/remote-peer/RemotePeersView.tsx:601
desktop/src/features/agent/runtime/liveRunProjection.ts:594 · desktop/src/features/agent/runtime/liveRunProjection.ts:746 — the two spans are one implementation copied and then locally edited — 219 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. — desktop/src/features/agent/runtime/liveRunProjection.ts:594
desktop/src/components/layout/ActivityRailMenus.tsx:162 · desktop/src/components/layout/ActivityRailMenus.tsx:270 — 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. — desktop/src/components/layout/ActivityRailMenus.tsx:162
desktop/src/features/remote-peer/peerGlyphs.ts:48 · mobile/src/remote/peerGlyphs.ts:48 — the 2 copies are spread across 2 files, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents. — desktop/src/features/remote-peer/peerGlyphs.ts:48
desktop/src/features/remote-peer/mergeConversations.ts:409 · packages/remote-client/src/catalogDelta.ts:20 — the two spans are one implementation copied and then locally edited — 165 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/remote-peer/mergeConversations.ts:409
desktop/src/lib/fontSize.ts:51 · desktop/src/lib/replyDisplay.ts:45 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/lib/fontSize.ts:51
desktop/src/components/layout/ActivityRailMenus.tsx:219 · desktop/src/components/layout/ActivityRailMenus.tsx:320 — the two spans are one implementation copied and then locally edited — 165 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. — desktop/src/components/layout/ActivityRailMenus.tsx:219
desktop/src/features/agent/ThinkingBlock.tsx:53 · mobile/src/features/chat/messages/ThinkingRow.tsx:55 — the two spans are one implementation copied and then locally edited — 214 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/agent/ThinkingBlock.tsx:53
desktop/src/features/git-history/LaneGraph.tsx:58 · mobile/src/features/chat/components/GitGraphPanel.tsx:292 — the two spans are one implementation copied and then locally edited — 155 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/git-history/LaneGraph.tsx:58
mobile/src/features/chat/components/SessionPicker.tsx:49 · mobile/src/features/chat/components/SkillPicker.tsx:70 — the two spans are one implementation copied and then locally edited — 298 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — mobile/src/features/chat/components/SessionPicker.tsx:49
packages/markdown/src/remarkLatexMath.ts:8 · packages/markdown/src/remarkMathFence.ts:8 — the two spans are one implementation copied and then locally edited — 188 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/markdown/src/remarkLatexMath.ts:8
desktop/src/components/layout/ActivityRail.tsx:2474 · desktop/src/components/layout/ActivityRail.tsx:2539 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/components/layout/ActivityRail.tsx:2474
desktop/src/features/agent/composer/useComposerAttachments.ts:77 · desktop/src/features/agent/composer/useComposerAttachments.ts:140 — the two spans are one implementation copied and then locally edited — 259 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. — desktop/src/features/agent/composer/useComposerAttachments.ts:77
desktop/src/features/settings/AccountPage.tsx:139 · desktop/src/features/settings/AccountPage.tsx:166 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/features/settings/AccountPage.tsx:139
mobile/src/features/chat/composer/ComposerToolbar.tsx:58 · mobile/src/features/chat/composer/ComposerToolbar.tsx:85 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — mobile/src/features/chat/composer/ComposerToolbar.tsx:58
desktop/src/components/layout/ActivityRailSelectionToolbar.tsx:52 · desktop/src/components/layout/ActivityRailSelectionToolbar.tsx:86 — 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. — desktop/src/components/layout/ActivityRailSelectionToolbar.tsx:52
desktop/src/features/agent/agentQueue.ts:84 · mobile/src/remote/sessionQueue.ts:96 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/features/agent/agentQueue.ts:84
desktop/src/features/agent/replyBlocks.ts:18 · mobile/src/features/chat/messages/ReplyBlocks.tsx:135 — the two spans are one implementation copied and then locally edited — 185 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/features/agent/replyBlocks.ts:18
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
harness/mobile-client/entry.mjs:24 reaches into another package with a relative path (../../mobile/src/remote/pairing.ts) — import the package by name instead. — harness/mobile-client/entry.mjs:24
harness/mobile-client/entry.mjs:25 reaches into another package with a relative path (../../mobile/src/remote/client.ts) — import the package by name instead. — harness/mobile-client/entry.mjs:25
mobile/jest.environment.js:32 imports jest-expo/src/preset/nativeEnvironment, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — mobile/jest.environment.js:32
mobile/src/components/__tests__/MarkdownText.test.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/markdown/src/parseFutureMarkdown) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — mobile/src/components/__tests__/MarkdownText.test.ts:11
scripts/measure/measure-mobile-performance.ts:5 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead. — scripts/measure/measure-mobile-performance.ts:5
scripts/measure/measure-mobile-performance.ts:7 reaches into another package with a relative path (../../packages/markdown/src/types) — import the package by name instead. — scripts/measure/measure-mobile-performance.ts:7
scripts/measure/measure-sync-browser.ts:9 reaches into another package with a relative path (../../mobile/src/remote/client) — import the package by name instead. — scripts/measure/measure-sync-browser.ts:9
scripts/measure/measure-sync-browser.ts:10 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead. — scripts/measure/measure-sync-browser.ts:10
scripts/measure/measure-sync-snapshot.ts:7 reaches into another package with a relative path (../../mobile/src/remote/client) — import the package by name instead. — scripts/measure/measure-sync-snapshot.ts:7
scripts/measure/measure-sync-snapshot.ts:8 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead. — scripts/measure/measure-sync-snapshot.ts:8
scripts/measure/measure-sync-warm.ts:10 reaches into another package with a relative path (../../mobile/src/remote/client) — import the package by name instead. — scripts/measure/measure-sync-warm.ts:10
scripts/measure/measure-sync-warm.ts:11 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead. — scripts/measure/measure-sync-warm.ts:11
scripts/tests/test-mobile-ios-project.cjs:9 reaches past another workspace package's public entry into its internals with a relative path (../../mobile/plugins/withIosShareExtension) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — scripts/tests/test-mobile-ios-project.cjs:9
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
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.
runCase has cyclomatic complexity 149 and cognitive complexity 235; 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. — harness/lib/run.mjs:82
processEvent has cyclomatic complexity 127 and cognitive complexity 223; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:225
ActivityRail has cyclomatic complexity 124 and cognitive complexity 119; 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. — desktop/src/components/layout/ActivityRail.tsx:276
ReadyAppShell has cyclomatic complexity 99 and cognitive complexity 89; 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. — desktop/src/components/layout/AppShell.tsx:152
machineSurface has cyclomatic complexity 84 and cognitive complexity 83; 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. — mobile/src/remote/RemoteContext.tsx:564
MessageBlockImpl has cyclomatic complexity 83 and cognitive complexity 77; 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. — desktop/src/features/agent/MessageBlock.tsx:78
SessionsScreen has cyclomatic complexity 77 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — mobile/src/screens/SessionsScreen.tsx:98
runCliCase has cyclomatic complexity 76 and cognitive complexity 131; 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. — harness/lib/cli-driver.mjs:99
TimelineCardView has cyclomatic complexity 75 and cognitive complexity 132; 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. — mobile/src/features/chat/messages/TimelineCard.tsx:43
readRunReplay has cyclomatic complexity 69 and cognitive complexity 88; 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. — packages/thread-projection/src/replay.ts:262
ChatScreen has cyclomatic complexity 67 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mobile/src/features/chat/ChatScreen.tsx:72
renderRow has cyclomatic complexity 64 and cognitive complexity 63; 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. — mobile/src/screens/SessionList.tsx:997
ComposerDockView has cyclomatic complexity 60 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. — mobile/src/features/chat/components/ComposerDock.tsx:37
AgentThread has cyclomatic complexity 59 and cognitive complexity 55; 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. — desktop/src/features/agent/AgentThread.tsx:188
RemoteComposer has cyclomatic complexity 57 and cognitive complexity 49; 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. — desktop/src/features/remote-peer/RemoteComposer.tsx:230
VibeStage has cyclomatic complexity 56 and cognitive complexity 55; 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. — desktop/src/features/vibe/VibeStage.tsx:147
SessionList has cyclomatic complexity 55 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mobile/src/screens/SessionList.tsx:182
writeReport has cyclomatic complexity 53 and cognitive complexity 91; 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. — harness/lib/report.mjs:41
UpdatePage has cyclomatic complexity 53 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/features/settings/UpdatePage.tsx:28
main has cyclomatic complexity 52 and cognitive complexity 89; 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. — harness/cli.mjs:54
ContextPanel has cyclomatic complexity 48 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/layout/ContextPanel.tsx:91
ArtifactDetailPanel has cyclomatic complexity 47 and cognitive complexity 35; 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. — desktop/src/features/artifacts/ArtifactDetailPanel.tsx:41
runReconcile has cyclomatic complexity 46 and cognitive complexity 63; 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. — packages/remote-client/src/syncEngine.ts:571
(anonymous) has cyclomatic complexity 46 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — mobile/src/remote/useTimelineController.ts:277
PendingApprovalCard has cyclomatic complexity 45 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mobile/src/features/chat/messages/PendingApprovalCard.tsx:36
TerminalPanelShell has cyclomatic complexity 45 and cognitive complexity 40; 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. — desktop/src/features/terminal/TerminalPanel.tsx:100
ComposerControls has cyclomatic complexity 45 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/features/agent/composer/ComposerControls.tsx:104
remote_peer_request has cyclomatic complexity 45 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 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. — desktop/shot/mock/backend.ts:1525
runSendPipeline has cyclomatic complexity 44 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/features/agent/sendPipeline.ts:74
applyEvent has cyclomatic complexity 44 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 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. — packages/remote-client/src/projection.ts:516
analyzeRun has cyclomatic complexity 42 and cognitive complexity 57; 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. — harness/lib/analyze.mjs:850
TaskForm has cyclomatic complexity 42 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — mobile/src/features/settings/TasksSettingsPage.tsx:664
RemoteProvider has cyclomatic complexity 42 and cognitive complexity 40; 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. — mobile/shot/mock/RemoteContext.tsx:197
applyOps has cyclomatic complexity 41 and cognitive complexity 74; 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. — packages/remote-client/src/syncEngine.ts:874
handleKeyDown has cyclomatic complexity 41 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — desktop/src/features/agent/MentionEditor.tsx:802
deterministicFindings has cyclomatic complexity 38 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 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. — harness/lib/analyze.mjs:135
turnFromAcc has cyclomatic complexity 37 and cognitive complexity 40; 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. — packages/thread-projection/src/projection.ts:325
affected has cyclomatic complexity 36 and cognitive complexity 66; 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/ci/affected.mjs:42
(anonymous) has cyclomatic complexity 36 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — packages/remote-client/src/client.ts:1260
AppShellDialogs has cyclomatic complexity 36 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/layout/AppShellDialogs.tsx:88
Do you agree with this assessment?
R3 · Large Files5.8 / 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.
desktop/src/components/layout/ActivityRail.tsx has 2780 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/ActivityRail.tsx:1
desktop/src/components/layout/AppShell.tsx has 2462 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/AppShell.tsx:1
desktop/shot/mock/data.ts has 2054 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/shot/mock/data.ts:1
mobile/src/screens/SessionList.tsx has 1863 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/screens/SessionList.tsx:1
packages/remote-client/src/client.ts has 1852 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/remote-client/src/client.ts:1
desktop/shot/mock/backend.ts has 1695 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/shot/mock/backend.ts:1
desktop/src/features/remote-peer/RemoteComposer.tsx has 1661 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/remote-peer/RemoteComposer.tsx:1
mobile/src/screens/SessionsScreen.tsx has 1580 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/screens/SessionsScreen.tsx:1
desktop/src/features/vibe/VibeStage.tsx has 1450 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/vibe/VibeStage.tsx:1
desktop/src/features/remote-peer/remotePeerClient.ts has 1448 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/remote-peer/remotePeerClient.ts:1
mobile/src/remote/RemoteContext.tsx has 1401 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/remote/RemoteContext.tsx:1
packages/remote-client/src/syncEngine.ts has 1321 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/remote-client/src/syncEngine.ts:1
packages/remote-client/src/projection.ts has 1205 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/remote-client/src/projection.ts:1
mobile/src/features/settings/TasksSettingsPage.tsx has 1204 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/features/settings/TasksSettingsPage.tsx:1
mobile/src/features/chat/ChatScreen.tsx has 1186 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/features/chat/ChatScreen.tsx:1
REDACTED has 1127 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
desktop/src/features/agent/AgentThread.tsx has 1116 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/agent/AgentThread.tsx:1
desktop/src/features/remote-peer/mergeConversations.ts has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/remote-peer/mergeConversations.ts:1
desktop/src/features/tasks/TasksView.tsx has 1056 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/tasks/TasksView.tsx:1
mobile/src/remote/files.ts has 1047 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/remote/files.ts:1
desktop/src/features/agent/MentionEditor.tsx has 1045 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/agent/MentionEditor.tsx:1
harness/lib/analyze.mjs has 1036 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — harness/lib/analyze.mjs:1
desktop/src/components/layout/hooks/useThreadStore.ts has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/hooks/useThreadStore.ts:1
mobile/shot/mock/data.ts has 989 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/shot/mock/data.ts:1
desktop/src/features/agent/Composer.tsx has 979 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/agent/Composer.tsx:1
desktop/src/components/layout/hooks/useRemotePeers.ts has 975 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/hooks/useRemotePeers.ts:1
desktop/src/features/remote-peer/useRemoteTimeline.ts has 974 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/remote-peer/useRemoteTimeline.ts:1
mobile/src/remote/useTimelineController.ts has 961 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/remote/useTimelineController.ts:1
REDACTED has 958 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
mobile/src/remote/useSessionCatalog.ts has 918 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/remote/useSessionCatalog.ts:1
mobile/src/remote/useDesktopConnection.ts has 877 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/remote/useDesktopConnection.ts:1
mobile/shot/mock/RemoteContext.tsx has 821 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/shot/mock/RemoteContext.tsx:1
packages/markdown/src/parseFutureMarkdown.ts has 812 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/markdown/src/parseFutureMarkdown.ts:1
desktop/src/features/remote-peer/RemoteConversationView.tsx has 792 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/remote-peer/RemoteConversationView.tsx:1
desktop/src/features/skills/SkillsView.tsx has 763 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/skills/SkillsView.tsx:1
desktop/src/features/agent/runtime/liveRunProjection.ts has 758 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/agent/runtime/liveRunProjection.ts:1
mobile/src/components/MarkdownText.tsx has 755 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — mobile/src/components/MarkdownText.tsx:1
desktop/src/features/settings/CustomProviderDialog.tsx has 742 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/settings/CustomProviderDialog.tsx:1
desktop/src/features/runs/RunInspectPanel.tsx has 719 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/runs/RunInspectPanel.tsx:1
desktop/src/features/remote/RemoteView.tsx has 708 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/features/remote/RemoteView.tsx:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage9.6 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×35) — desktop/shot/mock/data.ts:1, desktop/shot/mock/backend.ts:1, mobile/shot/mock/data.ts:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
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.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
The package in `desktop` declares the lint script `lint` (`eslint "src/**/*.{ts,tsx}" "shot/**/*.{ts,tsx}" "vite.shot.config.ts" && npm run typecheck`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `desktop` (or the workspace's task runner). — desktop/package.json:10
The package in `mobile` declares the lint script `lint` (`eslint .`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `mobile` (or the workspace's task runner). — mobile/package.json:77
The package in `packages/remote-client` declares the lint script `lint` (`eslint src tests`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `packages/remote-client` (or the workspace's task runner). — packages/remote-client/package.json:104
The package in `packages/remote-crypto` declares the lint script `lint` (`eslint src tests vitest.config.ts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `packages/remote-crypto` (or the workspace's task runner). — packages/remote-crypto/package.json:22
The package in `packages/remote-protocol` declares the lint script `lint` (`eslint src tests vitest.config.ts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `packages/remote-protocol` (or the workspace's task runner). — packages/remote-protocol/package.json:22
The package in `tests/remote-interop` declares the lint script `lint` (`eslint src-ts scripts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `tests/remote-interop` (or the workspace's task runner). — tests/remote-interop/package.json:11
Do you agree with this assessment?
R7 · Dead Code9.6 / 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.
412 file(s) (~101005 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: mobile/src/features/settings/SettingsScreen.tsx imports '../../version.generated', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — mobile
Unreachable from the 389 application, 57 tooling and 702 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×32) — scripts/screenshots/injects/choice-card-lib.js, scripts/screenshots/injects/choice-card-mobile-lib.js, scripts/screenshots/injects/choice-card-v3-queue-desktop.js, …
This script imports the product ('../roster.mjs'), so it is an authored benchmark, not measurement input — but nothing invokes it: no package.json script, no CI workflow or build recipe, no Dockerfile, no other file under scripts/skill_reco/bench/, and no in-repo reference to its name at all. It runs only if someone remembers to type `node scripts/skill_reco/bench/check-parity.mjs`, and it silently rots against the API it measures. Wire it into a script or workflow the way its wired siblings are, or delete it. — scripts/skill_reco/bench/check-parity.mjs
Nothing imports this binding — it is safe to review for removal. (×3) — desktop/src/features/remote-peer/remotePromptOutbox.ts:115, desktop/src/features/vibe/keyProbe.ts:24, mobile/src/remote/draftStorage.ts:45
This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. — harness/lib/issues-en-run.mjs:30
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable package.json — installs work only by hoisting accident. (×11) — scripts/tests/test-mobile-ios-project.cjs:8, scripts/release/updater-signature.mjs:55, harness/mobile-client/build.mjs:11, …
Declared in mobile/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×2) — mobile/package.json:35, mobile/package.json:37
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
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.
desktop/src/features/filepreview/FilePreviewOverlay.tsx → desktop/src/features/filepreview/MarkdownPreview.tsx → desktop/src/features/markdown/MarkdownContent.tsx → desktop/src/features/markdown/renderers/FileLink.tsx → desktop/src/features/filepreview/FilePreviewOverlay.tsx (one verified cycle inside a mutually-dependent group of 6 files) — desktop/src/features/filepreview/FilePreviewOverlay.tsx:11
What to do
Break each cycle by extracting the shared piece into a module both sides can import.
Other · Code Health — Whether nullable reference types are enabled and not undermined by heavy `!` suppression.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
0/1 NRT-eligible project(s) enable <Nullable>enable</Nullable> (projects targeting a pre-C#-8 framework are excluded — NRTs aren't available there). NRTs catch a whole class of null-deref bugs at compile time.
What to do
Enable <Nullable>enable</Nullable> across all projects and resolve warnings rather than suppressing with `!`.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). A further 2 got runtime (rendered axe-core) evidence this scan: 1.4.12, 2.4.4. The other 38 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 7 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.
AXH1 Runtime security headers — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXI1 Runtime container hardening — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility (rendered) — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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 — 38 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 7 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 61 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AX1 Captive dependencies — no DI registrations detected
AX2 Stateful singletons — no singleton implementations detected
AX4 Dependency direction — not applicable to a vertical-slice architecture (the inward-dependency rule is for layered/clean styles)
AX6 Interface segregation — AX6 reached only 24% of this repository's production lines — rust (576,155 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
AXA1 Runtime unauthenticated reachability — This run crawled public routes only — it had no logged-in session, so there is no authenticated surface to compare anonymous access against and nothing was measured. This is a statement about this run, not about your application: nothing here says access control is missing, and nothing here says it is present.
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXS1 Runtime exposed surface — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C2 Access Controls — No access-control surface detected in the analyzed source — no web/app surface to authorize (no HTTP API or web-UI project) and no authorization code at all (no [Authorize]/policies, no imperative guard methods). Access control is therefore N/A here — this is a library/CLI, which is authorized by its CALLER, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C4 Data Retention — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C5 Data-Subject Rights — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
D11 Test Reliability — Test reliability not measured — JavaScript/TypeScript suite did not run
D12 Dependency Hygiene — Not scored — 2 Maven/Gradle manifest(s) were read, stating a version for 3 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
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.
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 (tui), 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 — None of 1 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
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) — 10 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D8 Code Coverage — Coverage not measured — JavaScript/TypeScript suite
DM3 Integration-event coupling — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
DM6 Domain ↔ infrastructure boundary — this Rust crate maps no type to a persistence framework (diesel/sea-orm/sqlx), so DM6's domain↔infrastructure fusion read has no population to be taken over
DM7 Repository granularity — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
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 — no mutating command handlers or message consumers detected — idempotency check not applicable (this repository commits no MSBuild project, so its C# was read as syntax-only projects — a handler marked ONLY by an interface from a package is not visible without a build)
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF1 Benchmark discipline — Performance is assessed only for perf-relevant repos — a packaged library, one that ships benchmarks, or one already using allocation-aware APIs. This repo isn't one, so the Performance lens is not applicable and is excluded from the score.
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.
S1 Web-Security Posture — No web surface detected in the analyzed source — no HTTP API or web-UI project (no controllers/minimal-API endpoints, no Razor/Blazor views) and no web middleware (HTTPS redirection, HSTS, security headers, cookies). Transport security, security headers, secure cookies, CSRF/input-validation and middleware-order controls are therefore N/A here — this is a library/CLI/worker, not a web app. Crypto hygiene was still checked and found nothing to flag. If this codebase becomes web-facing, the dimension reactivates automatically.
X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X12 Unreachable branch — X12 reached only 0% of this repository's production lines — rust (576,155 lines), typescript (144,261 lines), javascript (21,781 lines), python (16,366 lines), swift (530 lines), kotlin (497 lines), java (57 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
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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
X2 Cancellation propagation — 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
X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — X24 reached only 22% of this repository's production lines — rust (576,155 lines), python (16,366 lines), swift (530 lines), kotlin (497 lines), java (57 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X25 Inert configuration knob — 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 — This check needs a compiled C# program and this repository commits no project file to compile, so only its syntax could be read. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X4 Structured logging — 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.
Boundary-crossing change coupling: TasksView.tsx ↔ taskTypes.ts desktop/src/features/tasks/TasksView.tsx:1— `desktop/src/features/tasks/TasksView.tsx` (context desktop) and `mobile/src/remote/taskTypes.ts` (context mobile) sit in DIFFERENT parts of the tree yet change together 100% of the time (10 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — 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 10 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109); `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin… — run `git show` on any of them.
Boundary-crossing change coupling: useTasks.ts ↔ taskTypes.ts desktop/src/features/tasks/useTasks.ts:1— `desktop/src/features/tasks/useTasks.ts` (context desktop) and `mobile/src/remote/taskTypes.ts` (context mobile) sit in DIFFERENT parts of the tree yet change together 100% of the time (10 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — 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 10 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109); `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin… — run `git show` on any of them.
Boundary-crossing change coupling: useTasks.ts ↔ locales.ts desktop/src/features/tasks/useTasks.ts:1— `desktop/src/features/tasks/useTasks.ts` (context desktop) and `mobile/src/i18n/locales.ts` (context mobile) sit in DIFFERENT parts of the tree yet change together 93% of the time (13 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — 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 13 shared commits counted here, the most recent 3 are `e7365a9c` feat(tasks): trim run-now paths, confirm deletes, and date pickers (#…; `22ad7180` refactor!: remove task dependencies (#1109); `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058) — run `git show` on any of them.
Boundary-crossing change coupling: useTasks.ts ↔ TasksSettingsPage.tsx desktop/src/features/tasks/useTasks.ts:1— `desktop/src/features/tasks/useTasks.ts` (context desktop) and `mobile/src/features/settings/TasksSettingsPage.tsx` (context mobile) sit in DIFFERENT parts of the tree yet change together 93% of the time (13 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — 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 13 shared commits counted here, the most recent 3 are `e7365a9c` feat(tasks): trim run-now paths, confirm deletes, and date pickers (#…; `22ad7180` refactor!: remove task dependencies (#1109); `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058) — run `git show` on any of them.
Boundary-crossing change coupling: data.ts ↔ taskTypes.ts desktop/shot/mock/data.ts:1— `desktop/shot/mock/data.ts` (context desktop) and `mobile/src/remote/taskTypes.ts` (context mobile) sit in DIFFERENT parts of the tree yet change together 90% of the time (9 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — 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 9 shared commits counted here, the most recent 3 are `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin…; `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Boundary-crossing change coupling: TasksView.tsx ↔ TasksSettingsPage.tsx desktop/src/features/tasks/TasksView.tsx:1— `desktop/src/features/tasks/TasksView.tsx` (context desktop) and `mobile/src/features/settings/TasksSettingsPage.tsx` (context mobile) sit in DIFFERENT parts of the tree yet change together 89% of the time (17 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `d1f253e7` feat(tasks): name the model's vendor in the picker on both ends (#1275); `e7365a9c` feat(tasks): trim run-now paths, confirm deletes, and date pickers (#…; `22ad7180` refactor!: remove task dependencies (#1109) — run `git show` on any of them.
Boundary-crossing change coupling: REDACTED ↔ kernel.rs desktop/src-tauri/src/commands/tasks.rs:1— `desktop/src-tauri/src/commands/tasks.rs` (context desktop) and `orchestration/tasks/src/kernel.rs` (context orchestration) sit in DIFFERENT parts of the tree yet change together 82% of the time (9 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin…; `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Boundary-crossing change coupling: backend.ts ↔ taskTypes.ts desktop/shot/mock/backend.ts:1— `desktop/shot/mock/backend.ts` (context desktop) and `mobile/src/remote/taskTypes.ts` (context mobile) 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 — 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 `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin…; `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Boundary-crossing change coupling: TasksView.tsx ↔ locales.ts desktop/src/features/tasks/TasksView.tsx:1— `desktop/src/features/tasks/TasksView.tsx` (context desktop) and `mobile/src/i18n/locales.ts` (context mobile) sit in DIFFERENT parts of the tree yet change together 74% of the time (17 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `57259b67` feat(desktop,mobile): thinking levels by their wire value; a failed r…; `e7365a9c` feat(tasks): trim run-now paths, confirm deletes, and date pickers (#…; `22ad7180` refactor!: remove task dependencies (#1109) — run `git show` on any of them.
Boundary-crossing change coupling: help.rs ↔ kernel.rs cli/src/help.rs:1— `cli/src/help.rs` (context cli) and `orchestration/tasks/src/kernel.rs` (context orchestration) sit in DIFFERENT parts of the tree yet change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — 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 7 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109); `3b2f205b` feat(tasks): a yearly trigger, and the life-journal jobs that need it…; `699b049b` feat(tasks): let a task delete the conversation each run leaves behin… — run `git show` on any of them.
Boundary-crossing change coupling: data.ts ↔ data.ts desktop/shot/mock/data.ts:1— `desktop/shot/mock/data.ts` (context desktop) and `mobile/shot/mock/data.ts` (context mobile) sit in DIFFERENT parts of the tree yet 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 — 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 10 shared commits counted here, the most recent 3 are `b0e5c476` feat(choice): mark a card multi when its rows are one job; draw the s…; `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058); `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Boundary-crossing change coupling: help.rs ↔ REDACTED cli/src/help.rs:1— `cli/src/help.rs` (context cli) and `desktop/src-tauri/src/commands/tasks.rs` (context desktop) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin…; `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Boundary-crossing change coupling: data.ts ↔ TasksSettingsPage.tsx desktop/shot/mock/data.ts:1— `desktop/shot/mock/data.ts` (context desktop) and `mobile/src/features/settings/TasksSettingsPage.tsx` (context mobile) sit in DIFFERENT parts of the tree yet change together 53% of the time (10 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `135c0856` feat(tasks): keep the prompt-version history out of the app UIs (#1058); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin…; `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Boundary-crossing change coupling: session.rs ↔ command_policy.rs cli/src/commands/session.rs:1— `cli/src/commands/session.rs` (context cli) and `packages/rpc/src/command_policy.rs` (context rpc) 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 — 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 `eeb47ca9` feat(agent,cli): reclaim oversized run journals; wait for the remote …; `3de3395e` feat(session): reset a session's history in place, from the CLI (#1139); `9f301312` feat(session): make the system-prompt append segment persistent, read… — run `git show` on any of them.
AC2 · Forms & labels· <input> without a programmatic label · ×2
<input> without a programmatic label desktop/src/features/markdown/MarkdownContent.tsx:341— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label host/web/index.html:135— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <div> · ×2
Double-click handler on a non-interactive <div> desktop/src/features/filepreview/ImagePreview.tsx:279— This <div> binds mousedown, mouseup, mousemove, wheel and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Double-click handler on a non-interactive <div> desktop/src/features/vibe/VibeStage.tsx:1266— This <div> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Unlisted import '@expo/plist' scripts/tests/test-mobile-ios-project.cjs:8— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import '@expo/plist' mobile/plugins/withIosShareExtension.js:4— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'ws' harness/lib/cdp.mjs:15— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'ws' desktop/shot/terminal-server.mjs:14— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'expo-modules-core' mobile/modules/future-file-handler/index.ts:1— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'expo-modules-core' mobile/modules/future-share-intent/index.ts:1— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
AC2 · Forms & labels· <textarea> without a programmatic label · ×1
<textarea> without a programmatic label host/web/index.html:165— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×1
Hover-only interaction on <div> desktop/src/components/layout/AppShell.tsx:2086— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <header> · ×1
Double-click handler on a non-interactive <header> desktop/src/features/vibe/VibeStage.tsx:1032— This <header> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Unlisted import '@tauri-apps/cli' scripts/release/updater-signature.mjs:55— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'esbuild' harness/mobile-client/build.mjs:11— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'typescript' scripts/ci/remote-boundaries.mjs:77— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'xcode' scripts/tests/test-mobile-ios-project.cjs:7— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import '@expo/config-plugins' mobile/plugins/withFrameRateCap.js:1— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Hotspot: desktop/src/components/layout/ActivityRail.tsx desktop/src/components/layout/ActivityRail.tsx:276— desktop/src/components/layout/ActivityRail.tsx changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 290 in ActivityRail.ActivityRail at line 276. 27 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/components/layout/ActivityRail.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: desktop/src/components/layout/AppShell.tsx desktop/src/components/layout/AppShell.tsx:152— desktop/src/components/layout/AppShell.tsx changed 91 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 164 in AppShell.ReadyAppShell at line 152. 30 of those changes were fix/bug commits, and the other 61 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/components/layout/AppShell.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/src/screens/SessionList.tsx mobile/src/screens/SessionList.tsx:182— mobile/src/screens/SessionList.tsx changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 227 in SessionList.SessionList at line 182. 26 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/screens/SessionList.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/src/features/chat/ChatScreen.tsx mobile/src/features/chat/ChatScreen.tsx:72— mobile/src/features/chat/ChatScreen.tsx changed 72 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 120 in ChatScreen.ChatScreen at line 72. 27 of those changes were fix/bug commits, and the other 45 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/features/chat/ChatScreen.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/src/screens/SessionsScreen.tsx mobile/src/screens/SessionsScreen.tsx:98— mobile/src/screens/SessionsScreen.tsx changed 58 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 147 in SessionsScreen.SessionsScreen at line 98. 23 of those changes were fix/bug commits, and the other 35 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/screens/SessionsScreen.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: agent/src/agent/run_loop.rs agent/src/agent/run_loop.rs:248— agent/src/agent/run_loop.rs changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 163 in Loop::run_streaming_inner at line 248. 18 of those changes were fix/bug commits, and the other 21 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/agent/run_loop.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: agent/src/rpc/session_prompt.rs agent/src/rpc/session_prompt.rs:796— agent/src/rpc/session_prompt.rs changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in ServerSession::prompt_internal at line 796. 23 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/rpc/session_prompt.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: desktop/src/features/remote-peer/RemoteComposer.tsx desktop/src/features/remote-peer/RemoteComposer.tsx:230— desktop/src/features/remote-peer/RemoteComposer.tsx changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 154 in RemoteComposer.RemoteComposer at line 230. 16 of those changes were fix/bug commits, and the other 19 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/remote-peer/RemoteComposer.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: tui/src/workbench/mod.rs tui/src/workbench/mod.rs:2475— tui/src/workbench/mod.rs changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in Workbench::handle_overlay_key at line 2475. 15 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- tui/src/workbench/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: desktop/src/features/agent/Composer.tsx desktop/src/features/agent/Composer.tsx:233— desktop/src/features/agent/Composer.tsx changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 130 in Composer.ComposerImpl at line 233. 16 of those changes were fix/bug commits, and the other 22 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/agent/Composer.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: orchestration/goal/src/console.rs orchestration/goal/src/console.rs:2087— orchestration/goal/src/console.rs changed 58 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in future_goal::console::todo_add at line 2087. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- orchestration/goal/src/console.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: agent/src/rpc/commands/mod.rs agent/src/rpc/commands/mod.rs:44— agent/src/rpc/commands/mod.rs changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 124 in future_agent::rpc::commands::handle_command_internal at line 44. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/rpc/commands/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/src/remote/RemoteContext.tsx mobile/src/remote/RemoteContext.tsx:723— mobile/src/remote/RemoteContext.tsx changed 69 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in RemoteContext.RemoteProvider at line 723. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/remote/RemoteContext.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/shot/mock/RemoteContext.tsx mobile/shot/mock/RemoteContext.tsx:197— mobile/shot/mock/RemoteContext.tsx changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in RemoteContext.RemoteProvider at line 197. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/shot/mock/RemoteContext.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/src/features/chat/components/ComposerDock.tsx mobile/src/features/chat/components/ComposerDock.tsx:37— mobile/src/features/chat/components/ComposerDock.tsx changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in ComposerDock.ComposerDockView at line 37. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/features/chat/components/ComposerDock.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: tui/src/workbench/run.rs tui/src/workbench/run.rs:911— tui/src/workbench/run.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 82 in future_tui::workbench::run::quit at line 911. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- tui/src/workbench/run.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: desktop/src/features/agent/AgentThread.tsx desktop/src/features/agent/AgentThread.tsx:188— desktop/src/features/agent/AgentThread.tsx changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in AgentThread.AgentThread at line 188. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/agent/AgentThread.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: desktop/src/features/agent/MentionEditor.tsx desktop/src/features/agent/MentionEditor.tsx:192— desktop/src/features/agent/MentionEditor.tsx changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 144 in MentionEditor.MentionEditor at line 192. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/agent/MentionEditor.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: mobile/src/features/settings/SettingsScreen.tsx mobile/src/features/settings/SettingsScreen.tsx:105— mobile/src/features/settings/SettingsScreen.tsx changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in SettingsScreen.SettingsScreen at line 105. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/features/settings/SettingsScreen.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: tui/src/workbench/live.rs tui/src/workbench/live.rs:2414— tui/src/workbench/live.rs changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in Live::command at line 2414. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- tui/src/workbench/live.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cli/src/lib.rs cli/src/lib.rs:43— cli/src/lib.rs changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in future_cli::dispatch at line 43. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- cli/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: desktop/src/features/agent/MessageBlock.tsx desktop/src/features/agent/MessageBlock.tsx:78— desktop/src/features/agent/MessageBlock.tsx changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in MessageBlock.MessageBlockImpl at line 78. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/agent/MessageBlock.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:225— REDACTED changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 125 in liveApply.createProjector.processEvent at line 225. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cli/src/rpc.rs cli/src/rpc.rs:1197— cli/src/rpc.rs changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in RunClient::run at line 1197. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- cli/src/rpc.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: orchestration/goal/src/store.rs orchestration/goal/src/store.rs:1897— orchestration/goal/src/store.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in future_goal::store::apply at line 1897. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- orchestration/goal/src/store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
FunctionTooLong: SessionList.SessionList mobile/src/screens/SessionList.tsx:182— FunctionTooLong — SessionList runs 906 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 806 over it, 9.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useTimelineController.useTimelineController mobile/src/remote/useTimelineController.ts:75— FunctionTooLong — useTimelineController runs 622 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 522 over it, 6.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.
FunctionTooLong: AgentThread.AgentThread desktop/src/features/agent/AgentThread.tsx:188— FunctionTooLong — AgentThread runs 594 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 494 over it, 5.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useSessionCatalog.useSessionCatalog mobile/src/remote/useSessionCatalog.ts:64— FunctionTooLong — useSessionCatalog runs 552 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 452 over it, 5.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: CustomProviderDialog.CustomProviderDialog desktop/src/features/settings/CustomProviderDialog.tsx:100— FunctionTooLong — CustomProviderDialog runs 519 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 419 over it, 5.19× 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: ComposerDock.ComposerDockView mobile/src/features/chat/components/ComposerDock.tsx:37— FunctionTooLong — ComposerDockView runs 490 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 390 over it, 4.90× 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: Composer.ComposerImpl desktop/src/features/agent/Composer.tsx:233— FunctionTooLong — ComposerImpl runs 476 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 376 over it, 4.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: RemoteView.RemoteHostSection desktop/src/features/remote/RemoteView.tsx:82— FunctionTooLong — RemoteHostSection runs 464 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 364 over it, 4.64× 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: run.runCase harness/lib/run.mjs:82— FunctionTooLong — runCase runs 446 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 346 over it, 4.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: useDesktopConnection.useDesktopConnection mobile/src/remote/useDesktopConnection.ts:237— FunctionTooLong — useDesktopConnection runs 433 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 333 over it, 4.33× 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: useChatFiles.useChatFiles mobile/src/features/chat/files/useChatFiles.ts:92— FunctionTooLong — useChatFiles runs 421 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 321 over it, 4.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: RemoteContext.RemoteProvider mobile/src/remote/RemoteContext.tsx:723— FunctionTooLong — RemoteProvider runs 403 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 303 over it, 4.03× 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: useConversationController.useConversationController mobile/src/remote/useConversationController.ts:74— FunctionTooLong — useConversationController runs 399 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 299 over it, 3.99× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: CustomProviderPage.CustomProviderPage mobile/src/features/settings/CustomProviderPage.tsx:152— FunctionTooLong — CustomProviderPage runs 380 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 280 over it, 3.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: useThreadStore.useThreadStore desktop/src/components/layout/hooks/useThreadStore.ts:365— FunctionTooLong — useThreadStore runs 378 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× 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: future_channel::feishu::prompt_loop::run_prompt_loop channels/src/feishu/prompt_loop.rs:29— FunctionTooLong — future_channel::feishu::prompt_loop::run_prompt_loop runs 369 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 269 over it, 3.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: RemoteContext.RemoteProvider mobile/shot/mock/RemoteContext.tsx:197— FunctionTooLong — RemoteProvider runs 365 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
FunctionTooLong: usePromptOutbox.usePromptOutbox mobile/src/remote/usePromptOutbox.ts:237— FunctionTooLong — usePromptOutbox runs 358 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 258 over it, 3.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: future_tui::workbench::run::quit tui/src/workbench/run.rs:911— FunctionTooLong — future_tui::workbench::run::quit runs 357 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 257 over it, 3.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: liveApply.createProjector REDACTED:160— FunctionTooLong — createProjector runs 346 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 246 over it, 3.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: future_agent::rpc::commands::handle_command_internal agent/src/rpc/commands/mod.rs:44— FunctionTooLong — future_agent::rpc::commands::handle_command_internal runs 343 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 243 over it, 3.43× 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: future_host::fusion::execute host/src/fusion.rs:138— FunctionTooLong — future_host::fusion::execute runs 321 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 221 over it, 3.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: future_host::remote_host::business::history::execute host/src/remote_host/business/history.rs:108— FunctionTooLong — future_host::remote_host::business::history::execute runs 317 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 217 over it, 3.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useRemoteTimeline.useRemoteTimeline desktop/src/features/remote-peer/useRemoteTimeline.ts:268— FunctionTooLong — useRemoteTimeline runs 310 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 210 over it, 3.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: TerminalPanel.TerminalPanelShell desktop/src/features/terminal/TerminalPanel.tsx:100— FunctionTooLong — TerminalPanelShell runs 301 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 201 over it, 3.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.
FileTooLong: workbench/live.rs tui/src/workbench/live.rs— FileTooLong — 2854 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: Live (3 blocks, 166-5645), declaring 42 free functions. The bar is 500 significant lines; this is 2354 over it, 5.71× 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: workbench/screen.rs tui/src/workbench/screen.rs— FileTooLong — 2785 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 74 free functions. The bar is 500 significant lines; this is 2285 over it, 5.57× 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: workbench/mod.rs tui/src/workbench/mod.rs— FileTooLong — 2468 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: Workbench (3 blocks, 647-4372). The bar is 500 significant lines; this is 1968 over it, 4.94× 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: components/chat_area.rs tui/src/components/chat_area.rs— FileTooLong — 2138 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 73% of them inside a single declaration: ChatArea (3 blocks, 1098-4037), declaring 31 free functions. The bar is 500 significant lines; this is 1638 over it, 4.28× 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/runtime.rs packages/remote-client/src/runtime.rs— FileTooLong — 1860 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 76% of them inside a single declaration: Client (2 blocks, 1028-3505). The bar is 500 significant lines; this is 1360 over it, 3.72× 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: layout/ActivityRail.tsx desktop/src/components/layout/ActivityRail.tsx— FileTooLong — 1858 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1358 over it, 3.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: providers/email.rs channels/src/providers/email.rs— FileTooLong — 1670 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 62 free functions. The bar is 500 significant lines; this is 1170 over it, 3.34× 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: rpc/session_prompt.rs agent/src/rpc/session_prompt.rs— FileTooLong — 1631 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 91% of them inside a single declaration: ServerSession (206-2479). The bar is 500 significant lines; this is 1131 over it, 3.26× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: commands/remote.rs cli/src/commands/remote.rs— FileTooLong — 1603 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 58 free functions. The bar is 500 significant lines; this is 1103 over it, 3.21× 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: layout/AppShell.tsx desktop/src/components/layout/AppShell.tsx— FileTooLong — 1534 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1034 over it, 3.07× 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: rpc/session.rs agent/src/rpc/session.rs— FileTooLong — 1463 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: ServerSession (2 blocks, 93-2387). The bar is 500 significant lines; this is 963 over it, 2.93× 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: mock/data.ts desktop/shot/mock/data.ts— FileTooLong — 1444 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 944 over it, 2.89× 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: components/markdown.rs tui/src/components/markdown.rs— FileTooLong — 1387 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 887 over it, 2.77× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: workbench/run.rs tui/src/workbench/run.rs— FileTooLong — 1350 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 850 over it, 2.70× 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: agent/run_loop.rs agent/src/agent/run_loop.rs— FileTooLong — 1349 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: Loop (223-1963). The bar is 500 significant lines; this is 849 over it, 2.70× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/client.ts packages/remote-client/src/client.ts— FileTooLong — 1279 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: RemoteClient (130-1895). The bar is 500 significant lines; this is 779 over it, 2.56× 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: commands/task.rs cli/src/commands/task.rs— FileTooLong — 1215 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 31 free functions. The bar is 500 significant lines; this is 715 over it, 2.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: screens/SessionList.tsx mobile/src/screens/SessionList.tsx— FileTooLong — 1195 significant lines (blank, comment-only and punctuation-only lines excluded), about 76% of them inside a single declaration: SessionList (182-1671). The bar is 500 significant lines; this is 695 over it, 2.39× 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: commands/session.rs cli/src/commands/session.rs— FileTooLong — 1190 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 690 over it, 2.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/rpc.rs cli/src/rpc.rs— FileTooLong — 1138 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: RunClient (2 blocks, 75-1616). The bar is 500 significant lines; this is 638 over it, 2.28× 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: commands/tools.rs cli/src/commands/tools.rs— FileTooLong — 1092 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 34 free functions. The bar is 500 significant lines; this is 592 over it, 2.18× 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: mock/backend.ts desktop/shot/mock/backend.ts— FileTooLong — 1073 significant lines (blank, comment-only and punctuation-only lines excluded), about 61% of them inside a single declaration: handlers (795-1745). The bar is 500 significant lines; this is 573 over it, 2.15× 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: screens/SessionsScreen.tsx mobile/src/screens/SessionsScreen.tsx— FileTooLong — 1026 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 526 over it, 2.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: vibe/VibeStage.tsx desktop/src/features/vibe/VibeStage.tsx— FileTooLong — 1013 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 513 over it, 2.03× 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: rpc/grpc_client.rs tui/src/rpc/grpc_client.rs— FileTooLong — 960 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 460 over it, 1.92× 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.
future_agent::session::legacy_import::parse_sources (cognitive 108) agent/src/session/legacy_import.rs:446— future_agent::session::legacy_import::parse_sources has cognitive complexity 108 (threshold 15). Drivers by points: if/else 27 (90 pts), boolean chains 11, loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_agent::session::sqlite_store::transcript::insert_transcript_entries (cognitive 95) agent/src/session/sqlite_store/transcript.rs:291— future_agent::session::sqlite_store::transcript::insert_transcript_entries has cognitive complexity 95 (threshold 15). Drivers by points: if/else 35 (84 pts), match/switch 2 (6 pts), boolean chains 3, loops 2 (nesting depth added 53). 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.
future_agent::session::content::entries::prepare_owned (cognitive 94) agent/src/session/content/entries.rs:100— future_agent::session::content::entries::prepare_owned has cognitive complexity 94 (threshold 15). Drivers by points: if/else 28 (76 pts), loops 6 (14 pts), boolean chains 4 (nesting depth added 56). 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.
future_agent::session::reset::plan_reset (cognitive 70) agent/src/session/reset.rs:504— future_agent::session::reset::plan_reset has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (52 pts), loops 7 (13 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.
future_agent::rpc::commands::handle_command_internal (cognitive 68) agent/src/rpc/commands/mod.rs:44— future_agent::rpc::commands::handle_command_internal has cognitive complexity 68 (threshold 15). Drivers by points: if/else 35 (44 pts), match/switch 11 (17 pts), boolean chains 7 (nesting depth added 15). 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.
future_agent::session::entry_records::insert_entry_record (cognitive 68) REDACTED:118— future_agent::session::entry_records::insert_entry_record has cognitive complexity 68 (threshold 15). Drivers by points: if/else 33 (64 pts), boolean chains 2, loops 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.
future_agent::session::history::paging::materialize_display_page (cognitive 61) agent/src/session/history/paging.rs:369— future_agent::session::history::paging::materialize_display_page has cognitive complexity 61 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 4 (10 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.
future_agent::session::projection::entries_to_agent_messages (cognitive 58) agent/src/session/projection.rs:17— future_agent::session::projection::entries_to_agent_messages has cognitive complexity 58 (threshold 15). Drivers by points: if/else 11 (38 pts), match/switch 4 (10 pts), loops 3 (8 pts), boolean chains 2 (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.
future_agent::session::content::extensions::fields (cognitive 57) agent/src/session/content/extensions.rs:43— future_agent::session::content::extensions::fields has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 5 (15 pts), boolean chains 8 (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.
future_agent::rpc::commands::session_lifecycle::cmd_new_session (cognitive 56) agent/src/rpc/commands/session_lifecycle.rs:696— future_agent::rpc::commands::session_lifecycle::cmd_new_session has cognitive complexity 56 (threshold 15). Drivers by points: if/else 34 (51 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.
future_agent::session::repair::repair_dangling_tool_calls (cognitive 51) agent/src/session/repair.rs:124— future_agent::session::repair::repair_dangling_tool_calls has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 7 (12 pts), boolean chains 6 (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.
future_agent::compaction::semantic::call_summary_request (cognitive 50) agent/src/compaction/semantic.rs:601— future_agent::compaction::semantic::call_summary_request has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (30 pts), match/switch 5 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_agent::session::fork::build_fork_session_with_mapping (cognitive 43) agent/src/session/fork.rs:78— future_agent::session::fork::build_fork_session_with_mapping has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (37 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_agent::config::providers::apply_provider_upsert (cognitive 40) agent/src/config/providers.rs:458— future_agent::config::providers::apply_provider_upsert has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 5, loops 1 (3 pts), match/switch 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.
future_agent::session::title_preview::paged (cognitive 40) agent/src/session/title_preview.rs:218— future_agent::session::title_preview::paged has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 2 (6 pts), boolean chains 4 (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.
future_agent::rpc::broadcaster::journal_writer::run_event_batch_writer (cognitive 35) agent/src/rpc/broadcaster/journal_writer.rs:433— future_agent::rpc::broadcaster::journal_writer::run_event_batch_writer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (28 pts), match/switch 3 (5 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.
future_agent::config::providers::validate_provider_upsert (cognitive 34) agent/src/config/providers.rs:179— future_agent::config::providers::validate_provider_upsert has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 7, 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.
future_agent::rpc::broadcaster::journal_writer::flush_event_batch (cognitive 34) agent/src/rpc/broadcaster/journal_writer.rs:632— future_agent::rpc::broadcaster::journal_writer::flush_event_batch has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (8 pts), match/switch 3 (8 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.
future_agent::session::persistence::execute (cognitive 34) agent/src/session/persistence.rs:638— future_agent::session::persistence::execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (25 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
future_agent::agent::run_loop::assemble_assistant_parts (cognitive 33) agent/src/agent/run_loop.rs:87— future_agent::agent::run_loop::assemble_assistant_parts has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 4, loops 4, 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.
future_agent::models::enrich_user_models (cognitive 32) agent/src/models/mod.rs:892— future_agent::models::enrich_user_models has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 3 (6 pts), boolean chains 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.
future_agent::cli::run (cognitive 31) agent/src/cli.rs:392— future_agent::cli::run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 3 (5 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.
future_agent::models::load_user_models_with_overrides (cognitive 31) agent/src/models/mod.rs:593— future_agent::models::load_user_models_with_overrides has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 4 (11 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.
future_agent::compaction::semantic::plan (cognitive 30) agent/src/compaction/semantic.rs:120— future_agent::compaction::semantic::plan has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 10 (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.
future_agent::compaction::semantic::evidence::build (cognitive 30) agent/src/compaction/semantic/evidence.rs:182— future_agent::compaction::semantic::evidence::build has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 6 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MethodTooLong: Loop.run_streaming_inner agent/src/agent/run_loop.rs:248— MethodTooLong — run_streaming_inner runs 975 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 875 over it, 9.75× 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: ServerSession.prompt_internal agent/src/rpc/session_prompt.rs:796— MethodTooLong — prompt_internal runs 862 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 762 over it, 8.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SqliteStore.reclaim_settled_journals REDACTED:688— MethodTooLong — reclaim_settled_journals runs 376 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 276 over it, 3.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Workbench.handle_overlay_key tui/src/workbench/mod.rs:2475— MethodTooLong — handle_overlay_key runs 292 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 192 over it, 2.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: FutureAgentService.execute_command agent/src/grpc/mod.rs:255— MethodTooLong — execute_command runs 270 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 170 over it, 2.70× 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: Writer.encode agent/src/session/content/journal.rs:98— MethodTooLong — encode runs 269 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 169 over it, 2.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ServerSession.compact_with_policy agent/src/rpc/session.rs:1260— MethodTooLong — compact_with_policy runs 264 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 164 over it, 2.64× 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: OpenAiResponsesAdapter.decode_frame agent/src/llm/adapters/openai_responses.rs:144— MethodTooLong — decode_frame runs 247 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 147 over it, 2.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: Bridge.handle_slash_command channels/src/feishu/bridge.rs:525— MethodTooLong — handle_slash_command runs 238 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 138 over it, 2.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SqliteStore.recover_segmented_run agent/src/session/content/recovery.rs:231— MethodTooLong — recover_segmented_run runs 228 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 128 over it, 2.28× 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: FutureAgentService.stream_events agent/src/grpc/mod.rs:601— MethodTooLong — stream_events runs 215 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 115 over it, 2.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RunClient.run cli/src/rpc.rs:1197— MethodTooLong — run runs 211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Client.stream_model agent/src/llm/mod.rs:435— MethodTooLong — stream_model runs 208 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 108 over it, 2.08× 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: Bridge.handle_event channels/src/feishu/bridge.rs:160— MethodTooLong — handle_event runs 205 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 105 over it, 2.05× 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: ServerSession.enqueue_prompt_with_model_context agent/src/rpc/session_prompt.rs:255— MethodTooLong — enqueue_prompt_with_model_context runs 199 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 99 over it, 1.99× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Snapshot.page_impl agent/src/session/content/reader.rs:300— MethodTooLong — page_impl runs 199 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 99 over it, 1.99× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SqliteStore.compact_run_cancellable agent/src/session/journal_compaction.rs:566— MethodTooLong — compact_run_cancellable runs 198 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Supervisor.spawn_credential_refresh packages/remote-server/src/supervisor/transport.rs:147— MethodTooLong — spawn_credential_refresh runs 197 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 97 over it, 1.97× 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: Supervisor.catalog_loop packages/remote-server/src/supervisor/publisher.rs:363— MethodTooLong — catalog_loop runs 186 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 86 over it, 1.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: AnthropicMessagesAdapter.decode_frame agent/src/llm/adapters/anthropic.rs:127— MethodTooLong — decode_frame runs 176 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 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Live.command tui/src/workbench/live.rs:2414— MethodTooLong — command runs 174 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 74 over it, 1.74× 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: SqliteStore.import_legacy_cancellable agent/src/session/legacy_import.rs:205— MethodTooLong — import_legacy_cancellable runs 172 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 72 over it, 1.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Workbench.handle_surface_mouse tui/src/workbench/mod.rs:3541— MethodTooLong — handle_surface_mouse runs 172 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 72 over it, 1.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MarkdownRenderer.render_table tui/src/components/markdown.rs:1738— MethodTooLong — render_table runs 171 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 71 over it, 1.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MdParser.parse_block_start tui/src/components/markdown.rs:562— MethodTooLong — parse_block_start runs 165 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 65 over it, 1.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
future_tui::keys::matches_key (cognitive 171) tui/src/keys.rs:1003— future_tui::keys::matches_key has cognitive complexity 171 (threshold 15). Drivers by points: if/else 57 (122 pts), boolean chains 48, match/switch 1 (nesting depth added 65). 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.
future_tui::workbench::run::quit (cognitive 155) tui/src/workbench/run.rs:911— future_tui::workbench::run::quit has cognitive complexity 155 (threshold 15). Drivers by points: if/else 42 (99 pts), match/switch 15 (49 pts), loops 2 (5 pts), boolean chains 2 (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.
future_tui::workbench::run::event_loop (cognitive 132) tui/src/workbench/run.rs:248— future_tui::workbench::run::event_loop has cognitive complexity 132 (threshold 15). Drivers by points: if/else 34 (104 pts), match/switch 4 (12 pts), boolean chains 9, loops 3 (7 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.
future_tui::workbench::picker::rows (cognitive 84) tui/src/workbench/picker.rs:438— future_tui::workbench::picker::rows has cognitive complexity 84 (threshold 15). Drivers by points: if/else 23 (55 pts), loops 10 (20 pts), boolean chains 5, match/switch 3 (4 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.
future_tui::index::parse_args (cognitive 75) tui/src/index.rs:71— future_tui::index::parse_args has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (70 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 47). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
future_tui::index::apply_cli_options (cognitive 71) tui/src/index.rs:303— future_tui::index::apply_cli_options has cognitive complexity 71 (threshold 15). Drivers by points: if/else 38 (71 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.
future_tui::rpc::grpc_client::subscribe_stream (cognitive 63) tui/src/rpc/grpc_client.rs:1713— future_tui::rpc::grpc_client::subscribe_stream has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (47 pts), match/switch 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 37). 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.
future_tui::workbench::git_panel::draw (cognitive 62) tui/src/workbench/git_panel.rs:312— future_tui::workbench::git_panel::draw has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 7 (13 pts), boolean chains 6, match/switch 3 (6 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.
future_tui::rpc::grpc_client::spawn_stream_manager (cognitive 58) tui/src/rpc/grpc_client.rs:1555— future_tui::rpc::grpc_client::spawn_stream_manager has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (44 pts), match/switch 4 (11 pts), loops 2 (3 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.
future_tui::workbench::fusion::progress (cognitive 57) tui/src/workbench/fusion.rs:36— future_tui::workbench::fusion::progress has cognitive complexity 57 (threshold 15). Drivers by points: if/else 25 (37 pts), boolean chains 12, match/switch 3 (5 pts), loops 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.
future_tui::workbench::screen::compose (cognitive 55) tui/src/workbench/screen.rs:25— future_tui::workbench::screen::compose has cognitive complexity 55 (threshold 15). Drivers by points: if/else 28 (44 pts), loops 3 (5 pts), boolean chains 3, match/switch 2 (3 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.
future_tui::workbench::screen::git_box (cognitive 55) tui/src/workbench/screen.rs:2376— future_tui::workbench::screen::git_box has cognitive complexity 55 (threshold 15). Drivers by points: if/else 28 (42 pts), loops 6 (10 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.
future_tui::utils::extract_segments (cognitive 46) tui/src/utils.rs:1124— future_tui::utils::extract_segments has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 3 (5 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.
future_tui::index::run_print_mode (cognitive 45) tui/src/index.rs:633— future_tui::index::run_print_mode has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 2 (6 pts), loops 1 (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.
future_tui::keys::parse_key (cognitive 43) tui/src/keys.rs:532— future_tui::keys::parse_key has cognitive complexity 43 (threshold 15). Drivers by points: if/else 30 (34 pts), boolean chains 9 (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.
future_tui::workbench::screen::workflow_box (cognitive 41) tui/src/workbench/screen.rs:1341— future_tui::workbench::screen::workflow_box has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (32 pts), match/switch 3 (5 pts), loops 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.
future_tui::session_rows::rows_to_messages (cognitive 37) tui/src/session_rows.rs:86— future_tui::session_rows::rows_to_messages has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 3 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_tui::workbench::screen::conversation (cognitive 36) tui/src/workbench/screen.rs:905— future_tui::workbench::screen::conversation has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (5 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.
future_tui::workbench::panels::rows_with (cognitive 35) tui/src/workbench/panels.rs:189— future_tui::workbench::panels::rows_with has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 20). 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.
future_tui::workbench::launchpad::render (cognitive 33) tui/src/workbench/launchpad.rs:141— future_tui::workbench::launchpad::render has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 5 (7 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.
future_tui::workbench::run::paint_images (cognitive 33) tui/src/workbench/run.rs:2033— future_tui::workbench::run::paint_images has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (9 pts), loops 3 (6 pts), boolean chains 4 (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.
future_tui::workbench::screen::diff_review_box (cognitive 31) tui/src/workbench/screen.rs:2223— future_tui::workbench::screen::diff_review_box has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 3 (6 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.
future_tui::utils::extract_ansi_code (cognitive 30) tui/src/utils.rs:307— future_tui::utils::extract_ansi_code has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 2 (3 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.
future_tui::workbench::panels::render_with (cognitive 29) tui/src/workbench/panels.rs:391— future_tui::workbench::panels::render_with has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 7 (11 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.
future_tui::rpc::grpc_client::spawn_heartbeat (cognitive 28) tui/src/rpc/grpc_client.rs:1895— future_tui::rpc::grpc_client::spawn_heartbeat has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 2 (5 pts), 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.
future_cli::dispatch (cognitive 115) cli/src/lib.rs:43— future_cli::dispatch has cognitive complexity 115 (threshold 15). Drivers by points: if/else 56 (79 pts), boolean chains 26, match/switch 5 (10 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.
future_cli::commands::session::set_session_command (cognitive 84) cli/src/commands/session.rs:1303— future_cli::commands::session::set_session_command has cognitive complexity 84 (threshold 15). Drivers by points: if/else 31 (45 pts), match/switch 15 (32 pts), loops 3 (5 pts), boolean chains 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.
future_cli::commands::run::parse_run_args (cognitive 74) cli/src/commands/run.rs:168— future_cli::commands::run::parse_run_args has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (70 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_cli::commands::tools::tools_call (cognitive 73) cli/src/commands/tools.rs:1336— future_cli::commands::tools::tools_call has cognitive complexity 73 (threshold 15). Drivers by points: if/else 37 (58 pts), match/switch 5 (9 pts), boolean chains 5, 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.
future_cli::commands::data::finish_restore_with (cognitive 71) cli/src/commands/data.rs:768— future_cli::commands::data::finish_restore_with has cognitive complexity 71 (threshold 15). Drivers by points: if/else 24 (53 pts), boolean chains 9, loops 6 (9 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.
future_cli::commands::session_transcript::filter_entry (cognitive 66) cli/src/commands/session_transcript.rs:692— future_cli::commands::session_transcript::filter_entry has cognitive complexity 66 (threshold 15). Drivers by points: if/else 24 (48 pts), boolean chains 9, match/switch 3 (8 pts), 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.
future_cli::commands::session_transcript::parse (cognitive 62) cli/src/commands/session_transcript.rs:140— future_cli::commands::session_transcript::parse has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (42 pts), boolean chains 8, loops 3 (7 pts), match/switch 2 (5 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.
future_cli::commands::session_transcript::run (cognitive 53) cli/src/commands/session_transcript.rs:1086— future_cli::commands::session_transcript::run has cognitive complexity 53 (threshold 15). Drivers by points: if/else 25 (43 pts), boolean chains 7, loops 2 (3 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.
future_cli::headless::session (cognitive 49) cli/src/headless/mod.rs:333— future_cli::headless::session has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (32 pts), match/switch 4 (10 pts), boolean chains 6, 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.
future_cli::commands::configure::collect_custom_provider (cognitive 47) cli/src/commands/configure.rs:312— future_cli::commands::configure::collect_custom_provider has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 7 (9 pts), match/switch 4 (8 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_cli::commands::session_prune::run (cognitive 47) cli/src/commands/session_prune.rs:347— future_cli::commands::session_prune::run has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (29 pts), loops 5 (9 pts), boolean chains 6, match/switch 1 (3 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.
future_cli::commands::tools::format_image_result (cognitive 45) cli/src/commands/tools.rs:778— future_cli::commands::tools::format_image_result has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (39 pts), loops 3 (4 pts), 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.
future_cli::commands::skills::read_skill_md_version (cognitive 39) cli/src/commands/skills.rs:520— future_cli::commands::skills::read_skill_md_version has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 22). 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.
future_cli::commands::session_history::parse (cognitive 36) cli/src/commands/session_history.rs:44— future_cli::commands::session_history::parse has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 9, match/switch 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
future_cli::commands::model_settings::probe (cognitive 33) cli/src/commands/model_settings.rs:762— future_cli::commands::model_settings::probe has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 3, 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.
future_cli::commands::session::session (cognitive 33) cli/src/commands/session.rs:1586— future_cli::commands::session::session has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (27 pts), boolean chains 3, 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.
future_cli::commands::session_reset::parse (cognitive 32) cli/src/commands/session_reset.rs:79— future_cli::commands::session_reset::parse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (5 pts), match/switch 2 (5 pts), boolean chains 4 (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.
future_cli::commands::task::edit (cognitive 32) cli/src/commands/task.rs:1055— future_cli::commands::task::edit has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 4 (11 pts), loops 2 (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.
future_cli::commands::remote::switch (cognitive 31) cli/src/commands/remote.rs:1503— future_cli::commands::remote::switch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (21 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). 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.
future_cli::commands::doctor::check_providers (cognitive 30) cli/src/commands/doctor.rs:741— future_cli::commands::doctor::check_providers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (6 pts), match/switch 1 (5 pts), boolean chains 2 (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.
future_cli::commands::mcp_servers::mcp_status (cognitive 30) cli/src/commands/mcp_servers.rs:232— future_cli::commands::mcp_servers::mcp_status has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 4 (9 pts), loops 3 (8 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.
future_cli::commands::session::parse_session_options (cognitive 30) cli/src/commands/session.rs:761— future_cli::commands::session::parse_session_options has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 4 (11 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.
future_cli::commands::tools::format_search_paper (cognitive 29) cli/src/commands/tools.rs:548— future_cli::commands::tools::format_search_paper has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 2 (3 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.
future_cli::commands::browser_tools::browser_start (cognitive 28) cli/src/commands/browser_tools.rs:257— future_cli::commands::browser_tools::browser_start has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 3 (4 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.
future_cli::commands::models::models (cognitive 28) cli/src/commands/models.rs:109— future_cli::commands::models::models has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 4 (6 pts), match/switch 3 (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.
future_host::remote_host::business::history::execute (cognitive 105) host/src/remote_host/business/history.rs:108— future_host::remote_host::business::history::execute has cognitive complexity 105 (threshold 15). Drivers by points: if/else 29 (70 pts), match/switch 13 (28 pts), boolean chains 7 (nesting depth added 56). 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.
future_host::remote_host::business::catalog::execute (cognitive 99) REDACTED:7— future_host::remote_host::business::catalog::execute has cognitive complexity 99 (threshold 15). Drivers by points: match/switch 22 (55 pts), if/else 23 (43 pts), boolean chains 1 (nesting depth added 53). 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.
future_host::agent_bridge::stream::collect_agent_response (cognitive 72) host/src/agent_bridge/stream.rs:181— future_host::agent_bridge::stream::collect_agent_response has cognitive complexity 72 (threshold 15). Drivers by points: if/else 15 (45 pts), match/switch 6 (19 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_host::agent_bridge::observer::run_observer (cognitive 64) host/src/agent_bridge/observer.rs:775— future_host::agent_bridge::observer::run_observer has cognitive complexity 64 (threshold 15). Drivers by points: if/else 13 (38 pts), match/switch 8 (23 pts), loops 2 (3 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_host::agent_bridge::observer::handle_event_from (cognitive 62) host/src/agent_bridge/observer.rs:1089— future_host::agent_bridge::observer::handle_event_from has cognitive complexity 62 (threshold 15). Drivers by points: if/else 26 (56 pts), match/switch 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
future_host::git_history::draw (cognitive 62) host/src/git_history.rs:619— future_host::git_history::draw has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 7 (13 pts), boolean chains 6, match/switch 3 (6 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.
future_host::remote_host::business::settings::execute (cognitive 61) host/src/remote_host/business/settings.rs:7— future_host::remote_host::business::settings::execute has cognitive complexity 61 (threshold 15). Drivers by points: match/switch 15 (32 pts), if/else 13 (27 pts), boolean chains 2 (nesting depth added 31). 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.
future_host::fusion::with_retry (cognitive 56) host/src/fusion.rs:673— future_host::fusion::with_retry has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (44 pts), match/switch 4 (10 pts), boolean chains 1, loops 1 (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.
future_host::remote_host::business::tasks::execute (cognitive 55) REDACTED:322— future_host::remote_host::business::tasks::execute has cognitive complexity 55 (threshold 15). Drivers by points: match/switch 21 (45 pts), if/else 3 (7 pts), loops 1 (3 pts) (nesting depth added 30). 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.
future_host::fusion::execute (cognitive 53) host/src/fusion.rs:138— future_host::fusion::execute has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (37 pts), loops 4 (8 pts), boolean chains 5, match/switch 2 (3 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.
future_host::agent_providers::validate::validate_custom_provider (cognitive 50) host/src/agent_providers/validate.rs:194— future_host::agent_providers::validate::validate_custom_provider has cognitive complexity 50 (threshold 15). Drivers by points: if/else 29 (42 pts), boolean chains 4, loops 2 (3 pts), 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.
future_host::agent_bridge::queries::read_events_since (cognitive 46) host/src/agent_bridge/queries.rs:45— future_host::agent_bridge::queries::read_events_since has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (35 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_host::application::threads::read_thread_history (cognitive 42) host/src/application/threads.rs:518— future_host::application::threads::read_thread_history has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 4 (12 pts), boolean chains 6 (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.
future_host::fusion::serve (cognitive 39) host/src/fusion.rs:72— future_host::fusion::serve has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 5 (10 pts), match/switch 1 (4 pts) (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.
future_host::agent_bridge::approval::reconcile_pending_approvals (cognitive 31) host/src/agent_bridge/approval.rs:120— future_host::agent_bridge::approval::reconcile_pending_approvals has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (6 pts), 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.
future_host::agent_bridge::delete_outbox::reconcile_delete_outbox (cognitive 30) host/src/agent_bridge/delete_outbox.rs:5— future_host::agent_bridge::delete_outbox::reconcile_delete_outbox has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 3 (4 pts), boolean chains 2, loops 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.
future_host::agent_bridge::prompt::agent_prompt_inner (cognitive 29) host/src/agent_bridge/prompt.rs:230— future_host::agent_bridge::prompt::agent_prompt_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 3, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_host::agent_bridge::reconciliation::settle_queued_runs (cognitive 29) host/src/agent_bridge/reconciliation.rs:23— future_host::agent_bridge::reconciliation::settle_queued_runs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_host::store::threads::delete_thread_trees (cognitive 29) host/src/store/threads.rs:1034— future_host::store::threads::delete_thread_trees has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (8 pts), match/switch 2 (6 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.
future_host::agent_bridge::import::import_one (cognitive 28) host/src/agent_bridge/import.rs:464— future_host::agent_bridge::import::import_one has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 3, 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.
future_host::fusion::review::validate (cognitive 28) host/src/fusion/review.rs:123— future_host::fusion::review::validate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_host::tasks::execute (cognitive 27) host/src/tasks.rs:490— future_host::tasks::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 6 (12 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.
future_host::agent_bridge::session::synthesize_run_events_from_entries (cognitive 26) host/src/agent_bridge/session.rs:486— future_host::agent_bridge::session::synthesize_run_events_from_entries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 3 (6 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.
future_host::agent_bridge::run_control::abort_run_on_agent (cognitive 24) host/src/agent_bridge/run_control.rs:73— future_host::agent_bridge::run_control::abort_run_on_agent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (24 pts) (nesting depth added 13). 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.
future_host::remote_host::files::claim_uploads (cognitive 24) host/src/remote_host/files.rs:350— future_host::remote_host::files::claim_uploads has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6 (8 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.
Repeated repair: desktop/src-tauri/src/commands/threads.rs desktop/src-tauri/src/commands/threads.rs:3— desktop/src-tauri/src/commands/threads.rs changed 29 times in last 90 days and 15 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 futureos::commands::threads::close_thread_terminals at line 3), 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(desktop,mobile,host): queued-reply order, approval tier switching, and mobile list/batch defects (#1582)”; “fix: prevent storage waits from freezing conversations (#1483)”; “test(tui,host,cli,desktop,mobile,shell): coverage waves 1-12; remote and agent liveness fixes (#1452)”; “fix: persist sessions before use and complete missing-session deletions (#1206)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src-tauri/src/commands/threads.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: desktop/src/integrations/agent/agentClient.ts desktop/src/integrations/agent/agentClient.ts:329— desktop/src/integrations/agent/agentClient.ts changed 19 times in last 90 days and 11 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 agentClient.resolveInitialModelId at line 329), 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(desktop,mobile,host): queued-reply order, approval tier switching, and mobile list/batch defects (#1582)”; “fix(remote): one clock per decision, honest locks; CLI doctor, goal supervision, thinking levels (#1299)”; “fix(desktop): keep a run the Agent queued alive instead of failing it (#1093)”; “fix(thinking): default to medium everywhere, and a task's level follows its model (#942)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/integrations/agent/agentClient.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/features/agent/useAgentThreadState.ts desktop/src/features/agent/useAgentThreadState.ts:53— desktop/src/features/agent/useAgentThreadState.ts changed 14 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is useAgentThreadState.useAgentThreadState at line 53), 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(desktop,host,mobile): queued sends stream, and the archived list counts what it draws (#1566)”; “fix(desktop): an uncreated folder reads as empty; a rejected first message returns to its draft (#1568)”; “fix(desktop): latch a rejected first message instead of retrying it (#1218)”; “fix: persist new sessions before first prompt admission (#1204)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/agent/useAgentThreadState.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src-tauri/src/commands/files.rs desktop/src-tauri/src/commands/files.rs:165— desktop/src-tauri/src/commands/files.rs changed 17 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is futureos::commands::files::open_external_url_with at line 165), 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: “test(tui,host,cli,desktop,mobile,shell): coverage waves 1-12; remote and agent liveness fixes (#1452)”; “fix(desktop): attach a clipboard image pasted in the Linux WebView (#1405)”; “fix(desktop): harden embedded Agent ownership and update recovery (#1108)”; “fix(agent): make session forks atomic and durable (#737)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src-tauri/src/commands/files.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: agent/src/rpc/commands/run_control.rs agent/src/rpc/commands/run_control.rs:10— agent/src/rpc/commands/run_control.rs changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is future_agent::rpc::commands::run_control::handle_prompt at line 10), 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(agent,host,desktop,mobile): a queued edit keeps its place; host-remote store init retries (#1604)”; “fix(agent): heal from a transient journal failure; judge harness findings against the fixture (#1551)”; “fix: preserve historical databases and make session recovery resumable (#1186)”; “fix: preserve legacy history and recover failed sessions and forced exits (#1176)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/rpc/commands/run_control.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: agent/src/skills/mod.rs agent/src/skills/mod.rs:323— agent/src/skills/mod.rs changed 13 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is future_agent::skills::extract_metadata_version at line 323), 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(agent): key the skills cache on the resolved skill directories (#1605)”; “fix(agent): decouple readiness from skill discovery (#820)”; “fix(skills): fall back to metadata package version (#812)”; “fix: remediate verified bughunt findings across agent, clients and loop (#557)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/skills/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: agent/src/compaction/mod.rs agent/src/compaction/mod.rs:360— agent/src/compaction/mod.rs changed 11 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 7 (its worst body is future_agent::compaction::project_prompt_context at line 360), 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(agent,remote): repair paged hydration and replay; bound sessions; name a build and sync stage (#1401)”; “fix(agent): admit summaries by projection budget and report fallback outcomes (#718)”; “fix: remediate verified bughunt findings across agent, clients and loop (#557)”; “fix: harden runtime reliability and previews (#369)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/compaction/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: agent/src/service/mod.rs agent/src/service/mod.rs:432— agent/src/service/mod.rs changed 10 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 8 (its worst body is RunningAgent::serve at line 432), 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(desktop,mobile,host): queued-reply order, approval tier switching, and mobile list/batch defects (#1582)”; “fix(agent): make storage upgrades resilient and isolate failed recovery (#1411)”; “fix(agent): report startup progress and stop reconnecting during shutdown (#1396)”; “fix: recover Agent service safely and prevent IME Enter misfire (#1313)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/service/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/features/markdown/streamingMarkdownBlocks.ts desktop/src/features/markdown/streamingMarkdownBlocks.ts:114— desktop/src/features/markdown/streamingMarkdownBlocks.ts 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 14 (its worst body is streamingMarkdownBlocks.createStreamingMarkdownProjector at line 114), 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(markdown): recover a link whose angle destination is missing its `>` (#914)”; “fix(markdown): keep a `$$` block that shares its lines with the formula (#900)”; “fix(markdown): end a bare URL where the sentence ends, not at the next space (#815)”; “fix(markdown): render CJK emphasis next to punctuation (#675)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/markdown/streamingMarkdownBlocks.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: mobile/src/features/chat/useQuestionNav.ts mobile/src/features/chat/useQuestionNav.ts:132— mobile/src/features/chat/useQuestionNav.ts 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 8 (its worst body is useQuestionNav.useQuestionNav at line 132), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mobile): walk back to prompts with ↑, and land the last reply at its top (#1057)”; “fix(mobile): land a reply jump on the answer's last output, not its first (#1055)”; “fix(mobile): land a question jump on the answer's top, not its end (#1034)”; “fix(mobile): land question jumps where the answer ends, and step on every press (#1025)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/features/chat/useQuestionNav.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: agent/src/rpc/commands/session_title.rs agent/src/rpc/commands/session_title.rs:20— agent/src/rpc/commands/session_title.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 10 (its worst body is future_agent::rpc::commands::session_title::first_exchanges at line 20), 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(agent): write generated titles in the interface's language (#1549)”; “test(tui,host,cli,desktop,mobile,shell): coverage waves 1-12; remote and agent liveness fixes (#1452)”; “fix(agent): make storage upgrades resilient and isolate failed recovery (#1411)”; “fix(session-titles): keep a chosen name, and keep a truncated title response (#1120)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/rpc/commands/session_title.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: agent/src/session/queued_receipts.rs agent/src/session/queued_receipts.rs:171— agent/src/session/queued_receipts.rs changed 8 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 SqliteStore::recover_queued_receipts_cancellable at line 171), 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(agent,host,desktop,mobile): a queued edit keeps its place; host-remote store init retries (#1604)”; “fix(desktop,host,mobile): queued sends stream, and the archived list counts what it draws (#1566)”; “fix: prevent storage waits from freezing conversations (#1483)”; “fix(agent): make storage upgrades resilient and isolate failed recovery (#1411)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- agent/src/session/queued_receipts.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: mobile/src/remote/desktopStatus.ts mobile/src/remote/desktopStatus.ts:55— mobile/src/remote/desktopStatus.ts 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 5 (its worst body is desktopStatus.peerMachineStatus at line 55), 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(desktop,mobile): never display a device name the wire mangled (#1589)”; “fix(host): bound startup waits, relay per launch;mobile drops a taken-over machine's chats (#1267)”; “fix(mobile): a desktop in standby turns the status dot yellow (#1229)”; “fix(mobile): let one answering desktop keep the phone out of "no connection" (#1062)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/remote/desktopStatus.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/features/agent/useSendMessage.ts desktop/src/features/agent/useSendMessage.ts:135— desktop/src/features/agent/useSendMessage.ts 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 10 (its worst body is useSendMessage.useSendMessage.handleSend at line 135), 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(desktop): clean up thread layout and async lifecycles (#962)”; “fix(desktop): release a send the watchdog abandons (#882)”; “fix: harden main conversation flows and desktop streaming (#651)”; “fix(desktop): reconcile streaming lifecycle and parse table updates incrementally (#570)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/agent/useSendMessage.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: mobile/src/features/chat/questionNav.ts mobile/src/features/chat/questionNav.ts:36— mobile/src/features/chat/questionNav.ts changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is questionNav.previousQuestion at line 36), 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(mobile): walk back to prompts with ↑, and land the last reply at its top (#1057)”; “fix(mobile): land a reply jump on the answer's last output, not its first (#1055)”; “fix(mobile): land a question jump on the answer's top, not its end (#1034)”; “fix(mobile): land question jumps where the answer ends, and step on every press (#1025)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- mobile/src/features/chat/questionNav.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/components/layout/RailRow.tsx desktop/src/components/layout/RailRow.tsx:272— desktop/src/components/layout/RailRow.tsx changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is RailRow.RunIndicator at line 272), 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(desktop,mobile,tasks): make empty states, notices and task names say what they mean (#1550)”; “fix(desktop,mobile,docs): legible rail type scale; drop the stale one-phone pairing note (#1317)”; “fix(remote): a group's own place, the host's forks, and the transcript's inset (#1002)”; “fix(remote): make a remote conversation look like this app's own (#997)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/components/layout/RailRow.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/integrations/agent/agentStatus.ts desktop/src/integrations/agent/agentStatus.ts:26— desktop/src/integrations/agent/agentStatus.ts changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is agentStatus.subscribeShutdownProgress at line 26), 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(agent): report startup progress and stop reconnecting during shutdown (#1396)”; “fix: recover Agent service safely and prevent IME Enter misfire (#1313)”; “fix(desktop): harden embedded Agent ownership and update recovery (#1108)”; “fix(desktop): recover owned agent once (#725)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/integrations/agent/agentStatus.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: host/src/fusion/resilience.rs host/src/fusion/resilience.rs:163— host/src/fusion/resilience.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is Runtime::observe_failure at line 163), 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(fusion): bound waiting for remaining panelists (#1579)”; “fix(fusion): harden deliberation and add reasoning benchmarks (#1494)”; “fix(fusion): stabilize report generation, validation and discussion details (#1465)”; “fix(fusion): preserve independent review and budget context; repair Linux smoke checks (#1462)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- host/src/fusion/resilience.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: orchestration/fusion/src/resilience.rs orchestration/fusion/src/resilience.rs:28— orchestration/fusion/src/resilience.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is FailureKind::classify at line 28), 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(fusion): bound waiting for remaining panelists (#1579)”; “fix(fusion): harden deliberation and add reasoning benchmarks (#1494)”; “fix(fusion): stabilize report generation, validation and discussion details (#1465)”; “fix(fusion): preserve independent review and budget context; repair Linux smoke checks (#1462)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- orchestration/fusion/src/resilience.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: desktop/src/integrations/storage/files.ts desktop/src/integrations/storage/files.ts:104— desktop/src/integrations/storage/files.ts 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 2 (its worst body is files.prepareImagePreviewUrl at line 104), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(desktop): attach a clipboard image pasted in the Linux WebView (#1405)”; “fix(agent): make session forks atomic and durable (#737)”; “fix: preserve native clipboard file paths (#523)”; “fix: harden runtime reliability and previews (#369)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/integrations/storage/files.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/components/layout/RailChrome.tsx desktop/src/components/layout/RailChrome.tsx:149— desktop/src/components/layout/RailChrome.tsx 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 4 (its worst body is RailChrome.RailGroupHeader at line 149), 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(desktop,mobile,docs): legible rail type scale; drop the stale one-phone pairing note (#1317)”; “fix(desktop): reveal a workspace heading's controls with that heading (#1047)”; “fix(remote): make a remote conversation look like this app's own (#997)”; “fix(remote): a reply you can watch, a pin in the right place, and a rename (#996)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/components/layout/RailChrome.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/components/layout/hooks/useRailSelection.ts desktop/src/components/layout/hooks/useRailSelection.ts:38— desktop/src/components/layout/hooks/useRailSelection.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is useRailSelection.useRailSelection at line 38), 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(desktop,host,mobile): queued sends stream, and the archived list counts what it draws (#1566)”; “fix(remote): open on the newest page, and make the list's controls work (#994)”; “fix(desktop,mobile): keep pinned conversations out of batch selection (#691)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/components/layout/hooks/useRailSelection.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: desktop/src/features/remote-peer/RemoteWorkspaceMenu.tsx desktop/src/features/remote-peer/RemoteWorkspaceMenu.tsx:31— desktop/src/features/remote-peer/RemoteWorkspaceMenu.tsx changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is RemoteWorkspaceMenu.RemoteWorkspaceMenu at line 31), 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(desktop): reveal a workspace heading's controls with that heading (#1047)”; “fix(remote): a reply you can watch, a pin in the right place, and a rename (#996)”; “fix(remote): open on the newest page, and make the list's controls work (#994)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- desktop/src/features/remote-peer/RemoteWorkspaceMenu.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: orchestration/fusion/src/store.rs orchestration/fusion/src/store.rs:404— orchestration/fusion/src/store.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is Store::record_issues at line 404), 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(fusion): harden deliberation and add reasoning benchmarks (#1494)”; “fix(fusion): stabilize report generation, validation and discussion details (#1465)”; “fix(fusion): preserve independent review and budget context; repair Linux smoke checks (#1462)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- orchestration/fusion/src/store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: host/src/agent_client.rs host/src/agent_client.rs:24— host/src/agent_client.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 AgentClient::execute_command at line 24), 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: prevent storage waits from freezing conversations (#1483)”; “test(tui,host,cli,desktop,mobile,shell): coverage waves 1-12; remote and agent liveness fixes (#1452)”; “fix(host,tui): an idempotent Agent channel runtime; one row per keypress (#1366)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 00:43:02 +08:00' --until='2026-11-17 00:43:02 +08:00' --full-history --no-merges -- host/src/agent_client.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.
Sync-over-async blocking harness/lib/cli-driver.mjs:102— `mkdirSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:114— `appendFileSync` in `note` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:123— `existsSync` in `queryDb` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:202— `writeFileSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:203— `writeFileSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:287— `mkdirSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:294— `rmSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/cli-driver.mjs:351— `writeFileSync` in `runCliCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:27— `mkdirSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:28— `existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:29— `readFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:31— `existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:42— `copyFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:44— `execFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:53— `statSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:64— `existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:65— `copyFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:70— `mkdirSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:73— `existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:74— `copyFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:77— `existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:78— `cpSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:80— `existsSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:81— `copyFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking harness/lib/data.mjs:83— `writeFileSync` in `prepare` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
future_agent::rpc::commands::handle_command_internal (cyclomatic 124) agent/src/rpc/commands/mod.rs:44— future_agent::rpc::commands::handle_command_internal has cyclomatic complexity 124 (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.
future_agent::session::sqlite_store::transcript::insert_transcript_entries (cyclomatic 41) agent/src/session/sqlite_store/transcript.rs:291— future_agent::session::sqlite_store::transcript::insert_transcript_entries 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.
future_agent::session::legacy_import::parse_sources (cyclomatic 40) agent/src/session/legacy_import.rs:446— future_agent::session::legacy_import::parse_sources 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.
future_agent::session::reset::plan_reset (cyclomatic 36) agent/src/session/reset.rs:504— future_agent::session::reset::plan_reset 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.
future_agent::rpc::commands::session_lifecycle::cmd_new_session (cyclomatic 35) agent/src/rpc/commands/session_lifecycle.rs:696— future_agent::rpc::commands::session_lifecycle::cmd_new_session 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.
future_agent::session::content::entries::prepare_owned (cyclomatic 33) agent/src/session/content/entries.rs:100— future_agent::session::content::entries::prepare_owned 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.
future_agent::rpc::prompt_helpers::run_event_to_sse (cyclomatic 32) agent/src/rpc/prompt_helpers.rs:87— future_agent::rpc::prompt_helpers::run_event_to_sse has cyclomatic complexity 32 (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.
future_agent::compaction::semantic::call_summary_request (cyclomatic 30) agent/src/compaction/semantic.rs:601— future_agent::compaction::semantic::call_summary_request 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.
future_agent::session::entry_records::insert_entry_record (cyclomatic 29) REDACTED:118— future_agent::session::entry_records::insert_entry_record 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.
future_agent::compaction::semantic::plan (cyclomatic 27) agent/src/compaction/semantic.rs:120— future_agent::compaction::semantic::plan 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.
future_agent::config::providers::validate_provider_upsert (cyclomatic 27) agent/src/config/providers.rs:179— future_agent::config::providers::validate_provider_upsert 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.
future_agent::config::providers::apply_provider_upsert (cyclomatic 26) agent/src/config/providers.rs:458— future_agent::config::providers::apply_provider_upsert 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.
future_agent::session::repair::repair_dangling_tool_calls (cyclomatic 26) agent/src/session/repair.rs:124— future_agent::session::repair::repair_dangling_tool_calls 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.
future_agent::session::content::extensions::fields (cyclomatic 25) agent/src/session/content/extensions.rs:43— future_agent::session::content::extensions::fields 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.
future_agent::session::fork::build_fork_session_with_mapping (cyclomatic 25) agent/src/session/fork.rs:78— future_agent::session::fork::build_fork_session_with_mapping 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.
future_agent::session::persistence::execute (cyclomatic 24) agent/src/session/persistence.rs:638— future_agent::session::persistence::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.
future_agent::session::history::paging::materialize_display_page (cyclomatic 23) agent/src/session/history/paging.rs:369— future_agent::session::history::paging::materialize_display_page 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.
future_agent::session::history::display_projection::project_entries (cyclomatic 22) agent/src/session/history/display_projection.rs:4— future_agent::session::history::display_projection::project_entries 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.
future_agent::session::projection::entries_to_agent_messages (cyclomatic 22) agent/src/session/projection.rs:17— future_agent::session::projection::entries_to_agent_messages 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.
future_agent::cli::run_from_args (cyclomatic 21) agent/src/cli.rs:202— future_agent::cli::run_from_args 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.
future_agent::session::database::connection::initialize_connection (cyclomatic 21) agent/src/session/database/connection.rs:62— future_agent::session::database::connection::initialize_connection 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.
future_agent::agent::run_loop::assemble_assistant_parts (cyclomatic 19) agent/src/agent/run_loop.rs:87— future_agent::agent::run_loop::assemble_assistant_parts 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.
future_agent::compaction::semantic::evidence::build (cyclomatic 19) agent/src/compaction/semantic/evidence.rs:182— future_agent::compaction::semantic::evidence::build 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.
future_agent::llm::schema::parse_chat_config (cyclomatic 19) agent/src/llm/schema.rs:1105— future_agent::llm::schema::parse_chat_config 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.
future_agent::tools::shell::execution::spawn_shell_impl (cyclomatic 19) agent/src/tools/shell/execution.rs:411— future_agent::tools::shell::execution::spawn_shell_impl 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.
future_cli::dispatch (cyclomatic 89) cli/src/lib.rs:43— future_cli::dispatch has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_cli::commands::session::set_session_command (cyclomatic 49) cli/src/commands/session.rs:1303— future_cli::commands::session::set_session_command has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_cli::commands::run::parse_run_args (cyclomatic 46) cli/src/commands/run.rs:168— future_cli::commands::run::parse_run_args 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.
future_cli::commands::session_transcript::parse (cyclomatic 43) cli/src/commands/session_transcript.rs:140— future_cli::commands::session_transcript::parse 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.
future_cli::commands::task::edit (cyclomatic 43) cli/src/commands/task.rs:1055— future_cli::commands::task::edit 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.
future_cli::commands::tools::tools_call (cyclomatic 43) cli/src/commands/tools.rs:1336— future_cli::commands::tools::tools_call 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.
future_cli::commands::session_transcript::filter_entry (cyclomatic 39) cli/src/commands/session_transcript.rs:692— future_cli::commands::session_transcript::filter_entry has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_cli::commands::data::finish_restore_with (cyclomatic 35) cli/src/commands/data.rs:768— future_cli::commands::data::finish_restore_with 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.
future_cli::commands::configure::collect_custom_provider (cyclomatic 34) cli/src/commands/configure.rs:312— future_cli::commands::configure::collect_custom_provider 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.
future_cli::commands::session::session (cyclomatic 34) cli/src/commands/session.rs:1586— future_cli::commands::session::session has cyclomatic complexity 34 (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.
future_cli::commands::session_history::parse (cyclomatic 34) cli/src/commands/session_history.rs:44— future_cli::commands::session_history::parse has cyclomatic complexity 34 (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.
future_cli::commands::task::add (cyclomatic 34) cli/src/commands/task.rs:746— future_cli::commands::task::add 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.
future_cli::commands::session_prune::run (cyclomatic 31) cli/src/commands/session_prune.rs:347— future_cli::commands::session_prune::run 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.
future_cli::commands::session_transcript::run (cyclomatic 29) cli/src/commands/session_transcript.rs:1086— future_cli::commands::session_transcript::run 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.
future_cli::headless::session (cyclomatic 29) cli/src/headless/mod.rs:333— future_cli::headless::session 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.
future_cli::commands::session::parse_session_options (cyclomatic 27) cli/src/commands/session.rs:761— future_cli::commands::session::parse_session_options 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.
future_cli::commands::model_settings::provider_set (cyclomatic 22) cli/src/commands/model_settings.rs:247— future_cli::commands::model_settings::provider_set 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.
future_cli::commands::browser_tools::browser_start (cyclomatic 21) cli/src/commands/browser_tools.rs:257— future_cli::commands::browser_tools::browser_start 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.
future_cli::commands::model_settings::model_set (cyclomatic 21) cli/src/commands/model_settings.rs:500— future_cli::commands::model_settings::model_set 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.
future_cli::commands::session_control::parse (cyclomatic 21) cli/src/commands/session_control.rs:94— future_cli::commands::session_control::parse 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.
future_cli::commands::session_journal::run (cyclomatic 21) cli/src/commands/session_journal.rs:290— future_cli::commands::session_journal::run 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.
future_cli::commands::session_reset::parse (cyclomatic 21) cli/src/commands/session_reset.rs:79— future_cli::commands::session_reset::parse 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.
future_cli::commands::tools::format_image_result (cyclomatic 21) cli/src/commands/tools.rs:778— future_cli::commands::tools::format_image_result 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.
future_cli::commands::model_settings::probe (cyclomatic 20) cli/src/commands/model_settings.rs:762— future_cli::commands::model_settings::probe 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.
future_cli::commands::remote::switch (cyclomatic 20) cli/src/commands/remote.rs:1503— future_cli::commands::remote::switch 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.
Duplicated block (7 lines × 2) agent/src/rpc/session.rs:530— agent/src/rpc/session.rs:530-536 | agent/src/rpc/session.rs:678-684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/session.rs:530` it does not close everything it opens, so those 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 `&mut` in one and `super) fn flush_cancelled_receipts_when_idle(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 2) agent/src/rpc/session_prompt.rs:917— agent/src/rpc/session_prompt.rs:917-923 | agent/src/rpc/session_prompt.rs:2083-2089 — both copies are in the same file, so extract the 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 lines × 2) agent/src/session/database/connection.rs:33— agent/src/session/database/connection.rs:33-39 | agent/src/skills/registry.rs:174-180 — 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) agent/src/skills/mod.rs:324— agent/src/skills/mod.rs:324-330 | agent/src/skills/mod.rs:363-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 `agent/src/skills/mod.rs:324` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) cli/src/commands/mcp_servers.rs:771— cli/src/commands/mcp_servers.rs:771-777 | cli/src/commands/mcp_servers.rs:892-898 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/mcp_servers.rs:771` 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) cli/src/commands/tools.rs:403— cli/src/commands/tools.rs:403-409 | cli/src/commands/tools.rs:476-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 `cli/src/commands/tools.rs:403` it begins part-way through the construct above it, so those exact lines 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) packages/remote-server/src/supervisor/shutdown.rs:63— packages/remote-server/src/supervisor/shutdown.rs:63-69 | packages/remote-server/src/supervisor/shutdown.rs:429-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.
Duplicated block (7 lines × 2) tui/src/components/chat_area.rs:643— tui/src/components/chat_area.rs:643-649 | tui/src/terminal_image.rs:278-284 — 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 `tui/src/components/chat_area.rs:643` it does not close everything it opens, so those exact lines 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) agent/src/config/providers.rs:169— agent/src/config/providers.rs:169-175 | agent/src/config/providers.rs:194-200 — both copies are in the same file, so extract the 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) agent/src/session/history/display_index.rs:352— agent/src/session/history/display_index.rs:352-358 | agent/src/session/history/display_index.rs:423-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 (7 lines × 2) channels/src/providers/email.rs:1833— channels/src/providers/email.rs:1833-1839 | tui/src/workbench/links.rs:315-321 — 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 `channels/src/providers/email.rs:1833` it begins part-way through the construct above it, so those exact lines 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) tui/src/skills_cli.rs:852— tui/src/skills_cli.rs:852-858 | tui/src/subprocess.rs:170-176 — before extracting anything, compare `tui/src/skills_cli.rs` and `tui/src/subprocess.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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) agent/src/config/providers.rs:147— agent/src/config/providers.rs:147-153 | cli/src/commands/configure.rs:809-815 — 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) agent/src/rpc/export_html.rs:540— agent/src/rpc/export_html.rs:540-546 | cli/src/utils/string.rs:10-17 — 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) agent/src/utils/mod.rs:281— agent/src/utils/mod.rs:281-287 | packages/rpc/src/home.rs:68-74 — 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 `agent/src/utils/mod.rs:281` it begins part-way through the construct above it, so those exact lines 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) channels/src/providers/wecom.rs:175— channels/src/providers/wecom.rs:175-181 | cli/src/relay/sign.rs:42-48 — 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) cli/src/commands/remote.rs:553— cli/src/commands/remote.rs:553-559 | cli/src/commands/remote_peers.rs:368-374 — before extracting anything, compare `cli/src/commands/remote.rs` and `cli/src/commands/remote_peers.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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) cli/src/commands/session_journal.rs:118— cli/src/commands/session_journal.rs:118-124 | cli/src/commands/session_status.rs:104-110 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) cli/src/commands/settings.rs:48— cli/src/commands/settings.rs:48-54 | packages/app-settings/src/lib.rs:658-664 — 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) orchestration/tasks/src/kernel.rs:118— orchestration/tasks/src/kernel.rs:118-124 | tui/src/workbench/mod.rs:4541-4547 — 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) packages/remote-client/src/tasks.rs:39— packages/remote-client/src/tasks.rs:39-45 | packages/remote-server/src/tasks.rs:40-46 — before extracting anything, compare `packages/remote-client/src/tasks.rs` and `packages/remote-server/src/tasks.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.
Duplicated block (7 lines × 2) agent/src/llm/adapters/openai_responses.rs:224— agent/src/llm/adapters/openai_responses.rs:224-232 | agent/src/llm/adapters/openai_responses.rs:249-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/llm/adapters/openai_responses.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 (7 lines × 2) cli/src/commands/remote.rs:741— cli/src/commands/remote.rs:741-747 | cli/src/commands/remote.rs:1680-1687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) cli/src/commands/task.rs:1366— cli/src/commands/task.rs:1366-1372 | cli/src/commands/task.rs:1605-1612 — both copies are in the same file, so extract the 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 lines × 2) cli/src/browser/chromium/chromium_session.rs:559— cli/src/browser/chromium/chromium_session.rs:559-565 | cli/src/browser/chromium/chromium_session.rs:567-573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
+ 10 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×35
No test reaches this file desktop/shot/mock/data.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/shot/mock/backend.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file mobile/shot/mock/data.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file mobile/shot/mock/RemoteContext.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/shot/mock/remoteStream.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file harness/cli.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 mobile/shot/mock/parserSession.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file harness/mobile-client/entry.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 harness/scripts/visual-regression.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 desktop/shot/terminal-server.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 harness/scripts/som-element-picker.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 desktop/shot/main.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/shot/mock/core.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file mobile/shot/mock/leanRender.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/scripts/profile-streaming-worker.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 desktop/scripts/stabilize-dist-mtimes.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 mobile/jest.environment.js: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 harness/scripts/assert-no-pollution.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 mobile/shot/mock/smallestType.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file mobile/plugins/withFrameRateCap.js: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 desktop/shot/prefs.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file desktop/shot/mock/event.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file mobile/shot/mock/shareIntent.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file harness/mobile-client/build.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 desktop/scripts/check-streaming-worker.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.
future_tui::keys::matches_key (cyclomatic 123) tui/src/keys.rs:1003— future_tui::keys::matches_key has cyclomatic complexity 123 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_tui::workbench::run::quit (cyclomatic 82) tui/src/workbench/run.rs:911— future_tui::workbench::run::quit has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_tui::workbench::run::event_loop (cyclomatic 58) tui/src/workbench/run.rs:248— future_tui::workbench::run::event_loop has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_tui::index::parse_args (cyclomatic 52) tui/src/index.rs:71— future_tui::index::parse_args has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_tui::workbench::fusion::progress (cyclomatic 50) tui/src/workbench/fusion.rs:36— future_tui::workbench::fusion::progress 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.
future_tui::workbench::screen::compose (cyclomatic 41) tui/src/workbench/screen.rs:25— future_tui::workbench::screen::compose 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.
future_tui::workbench::picker::rows (cyclomatic 40) tui/src/workbench/picker.rs:438— future_tui::workbench::picker::rows 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.
future_tui::keys::parse_key (cyclomatic 39) tui/src/keys.rs:532— future_tui::keys::parse_key has cyclomatic complexity 39 (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: future_tui::keys::legacy_sequence_key_id (cyclomatic 66) 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.
future_tui::rpc::grpc_client::subscribe_stream (cyclomatic 32) tui/src/rpc/grpc_client.rs:1713— future_tui::rpc::grpc_client::subscribe_stream 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.
future_tui::index::apply_cli_options (cyclomatic 30) tui/src/index.rs:303— future_tui::index::apply_cli_options 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.
future_tui::workbench::screen::git_box (cyclomatic 30) tui/src/workbench/screen.rs:2376— future_tui::workbench::screen::git_box 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.
future_tui::workbench::git_panel::draw (cyclomatic 28) tui/src/workbench/git_panel.rs:312— future_tui::workbench::git_panel::draw 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.
future_tui::workbench::screen::workflow_box (cyclomatic 27) tui/src/workbench/screen.rs:1341— future_tui::workbench::screen::workflow_box 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.
future_tui::rpc::grpc_client::spawn_stream_manager (cyclomatic 25) tui/src/rpc/grpc_client.rs:1555— future_tui::rpc::grpc_client::spawn_stream_manager 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.
future_tui::keys::format_parsed_key (cyclomatic 24) tui/src/keys.rs:454— future_tui::keys::format_parsed_key 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. This is NOT this file's highest cyclomatic complexity: future_tui::keys::legacy_sequence_key_id (cyclomatic 66) 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.
future_tui::workbench::screen::conversation (cyclomatic 23) tui/src/workbench/screen.rs:905— future_tui::workbench::screen::conversation 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.
future_tui::workbench::screen::preferences_box (cyclomatic 23) tui/src/workbench/screen.rs:3260— future_tui::workbench::screen::preferences_box has cyclomatic complexity 23 (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.
future_tui::rpc::provider_types::validate_provider_input (cyclomatic 21) tui/src/rpc/provider_types.rs:542— future_tui::rpc::provider_types::validate_provider_input 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.
future_tui::utils::extract_ansi_code (cyclomatic 21) tui/src/utils.rs:307— future_tui::utils::extract_ansi_code 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.
future_tui::workbench::launchpad::render (cyclomatic 21) tui/src/workbench/launchpad.rs:141— future_tui::workbench::launchpad::render 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.
future_tui::session_rows::rows_to_messages (cyclomatic 20) tui/src/session_rows.rs:86— future_tui::session_rows::rows_to_messages 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.
future_tui::utils::extract_segments (cyclomatic 20) tui/src/utils.rs:1124— future_tui::utils::extract_segments 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.
future_tui::workbench::run::paint_images (cyclomatic 19) tui/src/workbench/run.rs:2033— future_tui::workbench::run::paint_images 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.
future_tui::index::run_print_mode (cyclomatic 18) tui/src/index.rs:633— future_tui::index::run_print_mode 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.
future_tui::workbench::panels::render_with (cyclomatic 18) tui/src/workbench/panels.rs:391— future_tui::workbench::panels::render_with 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.
Duplicated block (8 lines × 2) agent/src/session/content/entries.rs:563— agent/src/session/content/entries.rs:563-570 | REDACTED:412-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 `agent/src/session/content/entries.rs:563` 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) agent/src/session/content/mod.rs:384— agent/src/session/content/mod.rs:384-391 | agent/src/session/content/stream_body.rs:78-85 — 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 `agent/src/session/content/mod.rs:384` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) channels/src/feishu/feishu_ws.rs:371— channels/src/feishu/feishu_ws.rs:371-378 | channels/src/feishu/feishu_ws.rs:566-573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) channels/src/providers/linq.rs:749— channels/src/providers/linq.rs:749-756 | channels/src/providers/whatsapp.rs:756-763 — before extracting anything, compare `channels/src/providers/linq.rs` and `channels/src/providers/whatsapp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) channels/src/providers/whatsapp.rs:508— channels/src/providers/whatsapp.rs:508-515 | channels/src/providers/whatsapp.rs:534-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/whatsapp.rs:508` it begins part-way through the construct above it, so those exact lines 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) cli/src/browser/chromium/cdp_connection.rs:337— cli/src/browser/chromium/cdp_connection.rs:337-344 | cli/src/browser/chromium/cdp_connection.rs:405-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.
Duplicated block (8 lines × 2) cli/src/browser/chromium/chromium_manager.rs:62— cli/src/browser/chromium/chromium_manager.rs:62-69 | cli/src/browser/safari/safari_manager.rs:420-427 — 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 (8 lines × 2) cli/src/commands/archive.rs:134— cli/src/commands/archive.rs:134-141 | cli/src/commands/pin.rs:201-208 — 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.
Duplicated block (8 lines × 2) cli/src/commands/browser_tools.rs:397— cli/src/commands/browser_tools.rs:397-404 | cli/src/commands/browser_tools.rs:421-428 — both copies are in the same file, so extract the 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) cli/src/commands/mcp_servers.rs:541— cli/src/commands/mcp_servers.rs:541-548 | cli/src/commands/task.rs:536-543 — 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 `cli/src/commands/mcp_servers.rs:541` it begins part-way through the construct above it, so those 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) cli/src/commands/session_status.rs:60— cli/src/commands/session_status.rs:60-67 | cli/src/commands/session_transcript.rs:152-159 — 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 `cli/src/commands/session_status.rs:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cli/src/commands/session_transcript.rs:160` calls `insert`, `Err` and `cli/src/commands/session_status.rs:68` 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) cli/src/commands/tools.rs:1358— cli/src/commands/tools.rs:1358-1365 | cli/src/commands/tools.rs:1367-1374 — both copies are in the same file, so extract the 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) host/src/home.rs:24— host/src/home.rs:24-31 | host/src/tasks/service.rs:13-20 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 × 2) REDACTED:427— REDACTED:427-434 | REDACTED:494-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 `REDACTED:427` it does not close everything it opens, so those exact lines 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) host/src/store/threads.rs:1171— host/src/store/threads.rs:1171-1178 | REDACTED:558-565 — 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 `host/src/store/threads.rs:1171` 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) packages/rpc/src/decode.rs:321— packages/rpc/src/decode.rs:321-328 | packages/rpc/src/encode.rs:58-65 — before extracting anything, compare `packages/rpc/src/decode.rs` and `packages/rpc/src/encode.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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) packages/rpc/src/decode.rs:534— packages/rpc/src/decode.rs:534-541 | packages/rpc/src/encode.rs:275-282 — before extracting anything, compare `packages/rpc/src/decode.rs` and `packages/rpc/src/encode.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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) tui/src/workbench/git_panel.rs:766— tui/src/workbench/git_panel.rs:766-780 | tui/src/workbench/git_panel.rs:841-848 — both copies are in the same file, so extract the 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) tui/src/components/input.rs:1091— tui/src/components/input.rs:1091-1098 | tui/src/components/input.rs:1121-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/input.rs:1091` 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) channels/src/providers/email.rs:350— channels/src/providers/email.rs:350-357 | channels/src/providers/irc.rs:294-301 — before extracting anything, compare `channels/src/providers/email.rs` and `channels/src/providers/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) cli/src/headless/agent.rs:181— cli/src/headless/agent.rs:181-188 | desktop/src-tauri/src/agent_host.rs:5-12 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) REDACTED:38— REDACTED:38-45 | host/src/remote_host/business/history.rs:373-383 — 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 `REDACTED:38` it begins part-way through the construct above it, so those exact lines 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) cli/src/commands/remote_peers.rs:792— cli/src/commands/remote_peers.rs:792-799 | cli/src/commands/remote_peers.rs:886-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.
Duplicated block (8 lines × 2) host/src/agent_providers/write.rs:74— host/src/agent_providers/write.rs:74-81 | host/src/agent_providers/write.rs:185-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_providers/write.rs:74` it begins part-way through the construct above it, so those 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) agent/src/session/journal_compaction.rs:218— agent/src/session/journal_compaction.rs:218-225 | agent/src/session/sqlite_store/events.rs:340-348 — 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 `agent/src/session/journal_compaction.rs:218` it does not close everything it opens, so those exact lines 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) agent/src/rpc/session_prompt.rs:448— agent/src/rpc/session_prompt.rs:448-452 | agent/src/rpc/session_prompt.rs:578-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 `agent/src/rpc/session_prompt.rs:448` it begins part-way through the construct above it, so those 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) agent/src/session/content/journal.rs:1036— agent/src/session/content/journal.rs:1036-1040 | agent/src/session/content/reader.rs:431-435 — 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 `agent/src/session/content/journal.rs:1036` it does not close everything it opens, so those exact lines 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) agent/src/session/content/journal.rs:1042— agent/src/session/content/journal.rs:1042-1046 | agent/src/session/content/reader.rs:434-438 — 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 `agent/src/session/content/journal.rs:1042` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) agent/src/session/identity.rs:109— agent/src/session/identity.rs:109-113 | agent/src/session/identity.rs:190-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/identity.rs:109` 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) REDACTED:256— REDACTED:256-260 | REDACTED:505-509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:256` it begins part-way through the construct above it, so those exact lines 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) channels/src/providers/email.rs:2014— channels/src/providers/email.rs:2014-2018 | channels/src/providers/slack.rs:486-490 — 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 `channels/src/providers/email.rs:2014` it does not close everything it opens, so those exact lines 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) cli/src/commands/model_settings.rs:253— cli/src/commands/model_settings.rs:253-258 | cli/src/commands/model_settings.rs:383-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/model_settings.rs:253` it begins part-way through the construct above it, so those exact lines 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) host/src/application/approvals.rs:54— host/src/application/approvals.rs:54-58 | host/src/application/approvals.rs:71-75 — both copies are in the same file, so extract the 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 `input` to `SaveApprovalRuleInput` in one and `SaveApprovalRulesInput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) REDACTED:147— REDACTED:147-151 | host/src/remote_host/business/settings.rs:131-135 — 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 `REDACTED: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.
Duplicated block (5 lines × 2) tui/src/workbench/syntax.rs:974— tui/src/workbench/syntax.rs:974-978 | tui/src/workbench/syntax.rs:1066-1070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/workbench/syntax.rs:974` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) host/src/remote_peer/platform.rs:169— host/src/remote_peer/platform.rs:169-173 | packages/http/src/dns/config.rs:326-330 — 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) packages/remote-client/src/tasks.rs:25— packages/remote-client/src/tasks.rs:25-29 | packages/remote-server/src/tasks.rs:26-30 — before extracting anything, compare `packages/remote-client/src/tasks.rs` and `packages/remote-server/src/tasks.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.
Duplicated block (5 lines × 2) channels/src/feishu/feishu_ws.rs:516— channels/src/feishu/feishu_ws.rs:516-521 | channels/src/feishu/feishu_ws.rs:598-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.
Duplicated block (5 lines × 2) cli/src/commands/remote.rs:2502— cli/src/commands/remote.rs:2502-2507 | cli/src/commands/remote.rs:2537-2541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/remote.rs:2502` it begins part-way through the construct above it, so those 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 (5 lines × 2) agent/src/session/content/fork.rs:143— agent/src/session/content/fork.rs:143-148 | agent/src/session/content/reset.rs:237-241 — 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 `agent/src/session/content/fork.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 (5 lines × 2) agent/src/session/fork.rs:244— agent/src/session/fork.rs:244-248 | agent/src/session/fork.rs:259-263 — both copies are in the same file, so extract the 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, `agent/src/session/fork.rs:241` calls `filter`, `is_empty` and `agent/src/session/fork.rs:255` 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) REDACTED:361— REDACTED:361-365 | REDACTED:568-572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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: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 (5 lines × 2) REDACTED:330— REDACTED:330-334 | REDACTED:564-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:330` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) cli/src/commands/task.rs:1341— cli/src/commands/task.rs:1341-1345 | cli/src/commands/task.rs:1422-1426 — both copies are in the same file, so extract the 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) agent/src/session/reset.rs:420— agent/src/session/reset.rs:420-424 | agent/src/session/reset.rs:435-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.
Duplicated block (5 lines × 2) channels/src/providers/email.rs:439— channels/src/providers/email.rs:439-443 | channels/src/providers/irc.rs:324-328 — before extracting anything, compare `channels/src/providers/email.rs` and `channels/src/providers/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `channels/src/providers/email.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.
Duplicated block (5 lines × 2) channels/src/providers/email.rs:643— channels/src/providers/email.rs:643-647 | channels/src/providers/email.rs:1271-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. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/email.rs:643` it does not close everything it opens, so those 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 `config` to `&SmtpConfig` in one and `&ImapConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) channels/src/providers/irc.rs:410— channels/src/providers/irc.rs:410-414 | channels/src/providers/irc.rs:428-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/irc.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 (5 lines × 2) cli/src/commands/task.rs:497— cli/src/commands/task.rs:497-501 | REDACTED:178-182 — 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 `cli/src/commands/task.rs:497` it does not close everything it opens, so those exact lines 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) cli/src/commands/task.rs:879— cli/src/commands/task.rs:879-883 | cli/src/commands/task.rs:1186-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 `cli/src/commands/task.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 (6 lines × 2) agent/src/session/content/checkpoint.rs:144— agent/src/session/content/checkpoint.rs:144-149 | agent/src/session/content/checkpoint.rs:394-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/content/checkpoint.rs:144` 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 before the matched lines, `agent/src/session/content/checkpoint.rs:393` calls `clone` and `agent/src/session/content/checkpoint.rs:143` 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) REDACTED:931— REDACTED:931-936 | REDACTED:950-955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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: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 (6 lines × 2) cli/src/commands/session_journal.rs:291— cli/src/commands/session_journal.rs:291-296 | cli/src/commands/session_status.rs:368-373 — 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) cli/src/commands/session_prune.rs:348— cli/src/commands/session_prune.rs:348-353 | cli/src/commands/session_transcript.rs:1087-1092 — 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) host/src/files.rs:49— host/src/files.rs:49-54 | packages/app-workspaces/src/lib.rs:702-707 — 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 `host/src/files.rs:49` it does not close everything it opens, so those 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 `path` to `&Path` in one and `PathBuf` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 2) tui/src/stderr_log.rs:71— tui/src/stderr_log.rs:71-76 | tui/src/stderr_log.rs:135-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/stderr_log.rs:71` it begins part-way through the construct above it, so those exact lines 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) tui/src/utils.rs:68— tui/src/utils.rs:68-73 | tui/src/utils.rs:75-80 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) agent/src/llm/adapters/openai_responses.rs:930— agent/src/llm/adapters/openai_responses.rs:930-935 | agent/src/llm/adapters/openai_responses.rs:945-950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/llm/adapters/openai_responses.rs:930` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) REDACTED:58— REDACTED:58-63 | REDACTED:334-339 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:58` it begins part-way through the construct above it, so those exact lines 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) cli/src/browser/chromium/chromium_page.rs:76— cli/src/browser/chromium/chromium_page.rs:76-81 | cli/src/browser/chromium/chromium_page.rs:128-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/browser/chromium/chromium_page.rs:76` it does not close everything it opens, so those 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) cli/src/commands/session.rs:1134— cli/src/commands/session.rs:1134-1139 | cli/src/commands/session.rs:1148-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 `cli/src/commands/session.rs:1134` it begins part-way through the construct above it, so those 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 × 2) tui/src/terminal_windows.rs:206— tui/src/terminal_windows.rs:206-211 | tui/src/terminal_windows.rs:223-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/terminal_windows.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. 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 × 2) agent/src/llm/adapters/openai_chat.rs:360— agent/src/llm/adapters/openai_chat.rs:360-365 | agent/src/llm/adapters/openai_responses.rs:920-925 — 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) channels/src/dingtalk/mod.rs:21— channels/src/dingtalk/mod.rs:21-26 | channels/src/feishu/mod.rs:24-29 — `channels/src/dingtalk/mod.rs` and `channels/src/feishu/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (6 lines × 2) cli/src/commands/desktop.rs:95— cli/src/commands/desktop.rs:95-100 | host/src/store/util.rs:62-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) cli/src/commands/remote.rs:1846— cli/src/commands/remote.rs:1846-1851 | packages/remote-server/src/pairing.rs:73-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) tui/src/skills_cli.rs:843— tui/src/skills_cli.rs:843-848 | tui/src/subprocess.rs:161-166 — before extracting anything, compare `tui/src/skills_cli.rs` and `tui/src/subprocess.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.
Duplicated block (6 lines × 2) agent/src/session/content/compress.rs:51— agent/src/session/content/compress.rs:51-56 | agent/src/session/journal_compaction.rs:111-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) agent/src/session/sqlite_store/transcript.rs:194— agent/src/session/sqlite_store/transcript.rs:194-199 | agent/src/session/sqlite_store/transcript.rs:215-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/sqlite_store/transcript.rs:215` it begins part-way through the construct above it, so those exact lines 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) cli/src/commands/doctor.rs:636— cli/src/commands/doctor.rs:636-644 | cli/src/commands/doctor.rs:714-719 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/doctor.rs:636` 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) REDACTED:504— REDACTED:504-511 | host/src/tasks/service.rs:386-391 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) channels/src/providers/linq.rs:752— channels/src/providers/linq.rs:752-759 | channels/src/providers/wecom.rs:608-613 — 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 `channels/src/providers/linq.rs:752` it begins part-way through the construct above it, so those exact lines 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) cli/src/browser/input.rs:63— cli/src/browser/input.rs:63-68 | cli/src/browser/input.rs:110-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/browser/input.rs:110` it begins part-way through the construct above it, so those exact lines 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) cli/src/browser/chromium/chromium_manager.rs:43— cli/src/browser/chromium/chromium_manager.rs:43-48 | cli/src/browser/safari/safari_manager.rs:391-396 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) agent/src/compaction/semantic.rs:635— agent/src/compaction/semantic.rs:635-640 | agent/src/compaction/semantic.rs:703-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/compaction/semantic.rs:635` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ClassTooLong: Live tui/src/workbench/live.rs:166— ClassTooLong — 2222 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 156 methods, 3 blocks, lines 166-5645. The bar is 400 significant lines; this is 1822 over it, 5.56× 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: Workbench tui/src/workbench/mod.rs:647— ClassTooLong — 2043 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 104 methods, 3 blocks, lines 647-4372. The bar is 400 significant lines; this is 1643 over it, 5.11× 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: ChatArea tui/src/components/chat_area.rs:1098— ClassTooLong — 1556 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 115 methods, 3 blocks, lines 1098-4037. The bar is 400 significant lines; this is 1156 over it, 3.89× 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: ServerSession agent/src/rpc/session.rs:93— ClassTooLong — 1423 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 83 methods, 2 blocks, lines 93-2387. The bar is 400 significant lines; this is 1023 over it, 3.56× 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: Client packages/remote-client/src/runtime.rs:1028— ClassTooLong — 1422 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 64 methods, 2 blocks, lines 1028-3505. The bar is 400 significant lines; this is 1022 over it, 3.56× 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: RemoteClient packages/remote-client/src/client.ts:130— ClassTooLong — 1167 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 767 over it, 2.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: RunClient cli/src/rpc.rs:75— ClassTooLong — 968 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 2 blocks, lines 75-1616. The bar is 400 significant lines; this is 568 over it, 2.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SessionList mobile/src/screens/SessionList.tsx:1— ClassTooLong — 906 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 506 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: Bridge channels/src/feishu/bridge.rs:26— ClassTooLong — 837 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, 2 blocks, lines 26-1214. The bar is 400 significant lines; this is 437 over it, 2.09× 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: Input tui/src/components/input.rs:187— ClassTooLong — 749 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 52 methods, 7 blocks, lines 187-1447. The bar is 400 significant lines; this is 349 over it, 1.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: Snapshot agent/src/session/content/reader.rs:14— ClassTooLong — 665 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 35 methods, 2 blocks, lines 14-993. The bar is 400 significant lines; this is 265 over it, 1.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: useTimelineController mobile/src/remote/useTimelineController.ts:1— ClassTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 222 over it, 1.56× 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: MarkdownRenderer tui/src/components/markdown.rs:1097— ClassTooLong — 603 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, 4 blocks, lines 1097-2014. The bar is 400 significant lines; this is 203 over it, 1.51× 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: AgentThread desktop/src/features/agent/AgentThread.tsx:1— ClassTooLong — 594 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 194 over it, 1.49× 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: AssistantRunProjection REDACTED:16— ClassTooLong — 568 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 168 over it, 1.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: useSessionCatalog mobile/src/remote/useSessionCatalog.ts:1— ClassTooLong — 552 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 152 over it, 1.38× 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: ApprovalGate agent/src/rpc/approval.rs:28— ClassTooLong — 525 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 16 methods, 2 blocks, lines 28-808. The bar is 400 significant lines; this is 125 over it, 1.31× 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: CustomProviderDialog desktop/src/features/settings/CustomProviderDialog.tsx:1— ClassTooLong — 519 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 119 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.
ClassTooLong: SkillManager agent/src/skills/manager.rs:107— ClassTooLong — 510 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods, 2 blocks, lines 107-832. The bar is 400 significant lines; this is 110 over it, 1.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: FutureAgentService agent/src/grpc/mod.rs:144— ClassTooLong — 491 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, 2 blocks, lines 144-885. The bar is 400 significant lines; this is 91 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MdParser tui/src/components/markdown.rs:385— ClassTooLong — 485 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 12 methods, 2 blocks, lines 385-1093. The bar is 400 significant lines; this is 85 over it, 1.21× 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: InMemoryRunQueue agent/src/runtime/scheduler_queue.rs:310— ClassTooLong — 467 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 310-1065. The bar is 400 significant lines; this is 67 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.
ClassTooLong: Client agent/src/llm/mod.rs:105— ClassTooLong — 446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 10 methods, 3 blocks, lines 105-792. The bar is 400 significant lines; this is 46 over it, 1.12× 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: useDesktopConnection mobile/src/remote/useDesktopConnection.ts:1— ClassTooLong — 433 significant lines (blank, comment-only and punctuation-only lines excluded), 14 methods. The bar is 400 significant lines; this is 33 over it, 1.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: Scan tui/src/workbench/syntax.rs:814— ClassTooLong — 421 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 2 blocks, lines 814-1446. The bar is 400 significant lines; this is 21 over it, 1.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (9 lines × 2) agent/src/llm/adapters/openai_responses.rs:320— agent/src/llm/adapters/openai_responses.rs:320-328 | agent/src/llm/adapters/openai_responses.rs:334-342 — both copies are in the same file, so extract the 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) agent/src/rpc/mod.rs:806— agent/src/rpc/mod.rs:806-814 | REDACTED:381-389 — 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 `agent/src/rpc/mod.rs:806` it does not close everything it opens, so those exact lines 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) agent/src/session/content/reader.rs:473— agent/src/session/content/reader.rs:473-481 | agent/src/session/content/reader.rs:602-610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/content/reader.rs:473` it begins part-way through the construct above it, so those exact lines 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) channels/src/dingtalk/bridge.rs:269— channels/src/dingtalk/bridge.rs:269-277 | channels/src/feishu/bridge.rs:680-688 — `channels/src/dingtalk/bridge.rs` and `channels/src/feishu/bridge.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 33 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/dingtalk/bridge.rs:269` it does not close everything it opens, so those 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, `channels/src/feishu/bridge.rs:692` calls `is_empty` and `channels/src/dingtalk/bridge.rs:280` 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) cli/src/headless/agent.rs:194— cli/src/headless/agent.rs:194-202 | desktop/src-tauri/src/agent_host.rs:18-26 — 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 `cli/src/headless/agent.rs:194` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) desktop/src-tauri/src/commands/update_linux.rs:98— desktop/src-tauri/src/commands/update_linux.rs:98-106 | desktop/src-tauri/src/commands/update_macos.rs:192-200 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `desktop/src-tauri/src/commands/update_linux.rs:98` it begins part-way through the construct above it, so those exact lines 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) host/src/agent_bridge/import.rs:529— host/src/agent_bridge/import.rs:529-537 | host/src/agent_bridge/import.rs:589-597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_bridge/import.rs:529` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) host/src/agent_bridge/reconciliation.rs:191— host/src/agent_bridge/reconciliation.rs:191-199 | host/src/agent_bridge/reconciliation.rs:302-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.
Duplicated block (9 lines × 2) packages/remote-client/src/session.rs:1275— packages/remote-client/src/session.rs:1275-1283 | packages/remote-server/src/connection.rs:36-44 — 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 `packages/remote-client/src/session.rs:1275` it begins part-way through the construct above it, so those 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 (9 lines × 2) tui/src/index.rs:389— tui/src/index.rs:389-397 | tui/src/index.rs:418-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/index.rs:389` it begins part-way through the construct above it, so those exact lines 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) tui/src/workbench/live.rs:4008— tui/src/workbench/live.rs:4008-4016 | tui/src/workbench/live.rs:4027-4035 — both copies are in the same file, so extract the 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) tui/src/workbench/run.rs:1377— tui/src/workbench/run.rs:1377-1385 | tui/src/workbench/run.rs:1821-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 `tui/src/workbench/run.rs:1377` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) channels/src/feishu/bridge.rs:650— channels/src/feishu/bridge.rs:650-658 | channels/src/feishu/bridge.rs:740-748 — both copies are in the same file, so extract the 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) cli/src/commands/task.rs:668— cli/src/commands/task.rs:668-676 | REDACTED:99-107 — 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 `cli/src/commands/task.rs:668` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cli/src/commands/task.rs:667` calls `task_timezone`, `name` and `REDACTED:98` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) host/src/agent_bridge/persist.rs:312— host/src/agent_bridge/persist.rs:312-320 | host/src/agent_bridge/persist.rs:472-480 — both copies are in the same file, so extract the 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) REDACTED:397— REDACTED:397-414 | REDACTED:495-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:397` it does not close everything it opens, so those 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 × 2) host/src/remote_host/business/history.rs:345— host/src/remote_host/business/history.rs:345-353 | host/src/remote_host/business/history.rs:377-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/remote_host/business/history.rs:345` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) channels/src/providers/telegram.rs:435— channels/src/providers/telegram.rs:435-443 | channels/src/providers/telegram.rs:467-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. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/telegram.rs:467` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) channels/src/providers/mattermost.rs:528— channels/src/providers/mattermost.rs:528-536 | channels/src/providers/slack.rs:731-739 — 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 `channels/src/providers/mattermost.rs:528` it begins part-way through the construct above it, so those exact lines 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) host/src/agent_bridge/session_events.rs:113— host/src/agent_bridge/session_events.rs:113-121 | host/src/agent_bridge/session_events.rs:184-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 `host/src/agent_bridge/session_events.rs:113` it begins part-way through the construct above it, so those exact lines 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) cli/src/commands/tools.rs:1447— cli/src/commands/tools.rs:1447-1455 | cli/src/commands/tools.rs:1461-1469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/tools.rs:1447` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) cli/src/commands/doctor.rs:587— cli/src/commands/doctor.rs:587-595 | cli/src/commands/doctor.rs:637-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. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/doctor.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.
Duplicated block (9 lines × 2) cli/src/commands/remote.rs:956— cli/src/commands/remote.rs:956-964 | cli/src/commands/remote.rs:1514-1522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/remote.rs:956` 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 matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) agent/src/rpc/commands/session_lifecycle.rs:1121— agent/src/rpc/commands/session_lifecycle.rs:1121-1129 | agent/src/rpc/commands/session_lifecycle.rs:1172-1180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/commands/session_lifecycle.rs:1121` it begins part-way through the construct above it, so those exact lines 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) cli/src/commands/remote.rs:490— cli/src/commands/remote.rs:490-498 | cli/src/commands/remote_peers.rs:346-354 — before extracting anything, compare `cli/src/commands/remote.rs` and `cli/src/commands/remote_peers.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. If that is what happened, the fix is to keep one copy and have the 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 `cli/src/commands/remote.rs:490` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
future_host::remote_host::business::catalog::execute (cyclomatic 56) REDACTED:7— future_host::remote_host::business::catalog::execute has cyclomatic complexity 56 (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.
future_host::remote_host::business::history::execute (cyclomatic 52) host/src/remote_host/business/history.rs:108— future_host::remote_host::business::history::execute has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_host::remote_host::business::settings::execute (cyclomatic 46) host/src/remote_host/business/settings.rs:7— future_host::remote_host::business::settings::execute has cyclomatic complexity 46 (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.
future_host::remote_host::business::tasks::execute (cyclomatic 38) REDACTED:322— future_host::remote_host::business::tasks::execute has cyclomatic complexity 38 (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.
future_host::fusion::execute (cyclomatic 35) host/src/fusion.rs:138— future_host::fusion::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.
future_host::agent_providers::validate::validate_custom_provider (cyclomatic 34) host/src/agent_providers/validate.rs:194— future_host::agent_providers::validate::validate_custom_provider 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.
future_host::agent_bridge::observer::handle_event_from (cyclomatic 31) host/src/agent_bridge/observer.rs:1089— future_host::agent_bridge::observer::handle_event_from 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.
future_host::agent_bridge::stream::collect_agent_response (cyclomatic 28) host/src/agent_bridge/stream.rs:181— future_host::agent_bridge::stream::collect_agent_response 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.
future_host::git_history::draw (cyclomatic 28) host/src/git_history.rs:619— future_host::git_history::draw 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.
future_host::agent_bridge::observer::run_observer (cyclomatic 25) host/src/agent_bridge/observer.rs:775— future_host::agent_bridge::observer::run_observer 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.
future_host::fusion::with_retry (cyclomatic 24) host/src/fusion.rs:673— future_host::fusion::with_retry 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.
future_host::agent_bridge::prompt::agent_prompt_inner (cyclomatic 23) host/src/agent_bridge/prompt.rs:230— future_host::agent_bridge::prompt::agent_prompt_inner 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.
future_host::agent_bridge::queries::read_events_since (cyclomatic 22) host/src/agent_bridge/queries.rs:45— future_host::agent_bridge::queries::read_events_since 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.
future_host::application::threads::read_thread_history (cyclomatic 22) host/src/application/threads.rs:518— future_host::application::threads::read_thread_history 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.
future_host::fusion::review::validate (cyclomatic 22) host/src/fusion/review.rs:123— future_host::fusion::review::validate 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.
future_host::remote_host::business::prompt::execute (cyclomatic 22) REDACTED:7— future_host::remote_host::business::prompt::execute 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.
future_host::agent_bridge::import::import_one (cyclomatic 20) host/src/agent_bridge/import.rs:464— future_host::agent_bridge::import::import_one 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.
future_host::agent_bridge::reconciliation::settle_queued_runs (cyclomatic 20) host/src/agent_bridge/reconciliation.rs:23— future_host::agent_bridge::reconciliation::settle_queued_runs 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.
future_host::agent_bridge::delete_outbox::reconcile_delete_outbox (cyclomatic 18) host/src/agent_bridge/delete_outbox.rs:5— future_host::agent_bridge::delete_outbox::reconcile_delete_outbox 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.
future_host::remote_host::files::claim_uploads (cyclomatic 16) host/src/remote_host/files.rs:350— future_host::remote_host::files::claim_uploads 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 is NOT this file's highest cyclomatic complexity: future_host::remote_host::files::mime_type_for_name (cyclomatic 63) 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.
future_host::store::markdown_refs::resolve::resolve_markdown_reference (cyclomatic 16) host/src/store/markdown_refs/resolve.rs:36— future_host::store::markdown_refs::resolve::resolve_markdown_reference 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.
future_host::tasks::execute (cyclomatic 16) host/src/tasks.rs:490— future_host::tasks::execute 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.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×20
Edited copy of a member (9 corresponding lines) agent/src/llm/mod.rs:761— agent/src/llm/mod.rs:761-769 | agent/src/llm/mod.rs:773-781 — 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) host/src/home.rs:23— host/src/home.rs:23-31 | host/src/tasks/service.rs:12-20 — 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) agent/src/sandbox/windows/capability.rs:256— agent/src/sandbox/windows/capability.rs:256-265 | channels/src/transport/signature.rs:44-52 — 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) cli/src/commands/browser_tools.rs:1261— cli/src/commands/browser_tools.rs:1261-1269 | cli/src/commands/browser_tools.rs:1274-1286 — 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) cli/src/browser/chromium/chromium_manager.rs:61— cli/src/browser/chromium/chromium_manager.rs:61-69 | cli/src/browser/safari/safari_manager.rs:419-427 — 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) packages/rpc/src/decode.rs:403— packages/rpc/src/decode.rs:403-411 | packages/rpc/src/encode.rs:122-130 — 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) REDACTED:834— REDACTED:834-842 | REDACTED: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) host/src/store/threads.rs:542— host/src/store/threads.rs:542-554 | host/src/store/threads.rs:916-924 — 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) channels/src/providers/email.rs:405— channels/src/providers/email.rs:405-413 | channels/src/providers/irc.rs:342-350 — 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) agent/src/skills/manager.rs:866— agent/src/skills/manager.rs:866-878 | agent/src/skills/mod.rs:313-321 — 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) tui/src/skills_cli.rs:819— tui/src/skills_cli.rs:819-827 | tui/src/subprocess.rs:145-153 — 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) packages/remote-client/src/runtime.rs:1042— packages/remote-client/src/runtime.rs:1042-1055 | host/src/agent_bridge/observer.rs:550-558 — 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) packages/rpc/src/decode.rs:453— packages/rpc/src/decode.rs:453-461 | packages/rpc/src/encode.rs:167-175 — 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) cli/src/commands/models.rs:11— cli/src/commands/models.rs:11-19 | cli/src/commands/session.rs:135-143 — 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) cli/src/commands/session.rs:124— cli/src/commands/session.rs:124-132 | orchestration/goal/src/decision/mod.rs:734-742 — 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) channels/src/providers/linq.rs:576— channels/src/providers/linq.rs:576-584 | channels/src/providers/whatsapp.rs:477-485 — 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) cli/src/commands/session_journal.rs:138— cli/src/commands/session_journal.rs:138-150 | cli/src/commands/session_prune.rs:180-188 — 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) cli/src/commands/model_settings.rs:734— cli/src/commands/model_settings.rs:734-742 | cli/src/commands/settings.rs:56-64 — 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) agent/src/approval_review/evidence.rs:541— agent/src/approval_review/evidence.rs:541-550 | agent/src/types/mod.rs:549-557 — 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) scripts/measure/measure-live-lane.py:25— scripts/measure/measure-live-lane.py:25-34 | scripts/measure/verify-e2e-bytes.py:178-186 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×20
Edited copy of a member (10 corresponding lines) agent/src/llm/adapters/anthropic.rs:504— agent/src/llm/adapters/anthropic.rs:504-513 | agent/src/llm/adapters/openai_responses.rs:927-937 — 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) host/src/agent_bridge/delete_outbox.rs:135— host/src/agent_bridge/delete_outbox.rs:135-144 | host/src/agent_bridge/observer.rs:424-433 — 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) agent/src/agent/run_loop.rs:60— agent/src/agent/run_loop.rs:60-71 | agent/src/agent/run_loop.rs:76-85 — 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) host/src/cli_tool.rs:202— host/src/cli_tool.rs:202-212 | host/src/git_history.rs:293-302 — 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) tui/src/workbench/live.rs:3707— tui/src/workbench/live.rs:3707-3716 | tui/src/workbench/live.rs:3720-3730 — 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) packages/rpc/src/decode.rs:587— packages/rpc/src/decode.rs:587-596 | packages/rpc/src/encode.rs:371-380 — 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) agent/src/session/history/paging.rs:125— agent/src/session/history/paging.rs:125-134 | agent/src/utils/mod.rs:25-35 — 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) host/src/remote_host/command_diagnostics.rs:77— host/src/remote_host/command_diagnostics.rs:77-88 | host/src/remote_host/command_diagnostics.rs:93-102 — 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) channels/src/status.rs:169— channels/src/status.rs:169-178 | channels/src/status.rs:181-191 — 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) agent/src/service/work.rs:45— agent/src/service/work.rs:45-56 | agent/src/service/work.rs:58-67 — 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) agent/src/sandbox/paths.rs:122— agent/src/sandbox/paths.rs:122-132 | orchestration/goal/src/agents/workspace_guard.rs:65-74 — 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) channels/src/grpc_client.rs:415— channels/src/grpc_client.rs:415-432 | tui/src/rpc/grpc_client.rs:973-982 — 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) tui/src/workbench/live.rs:4941— tui/src/workbench/live.rs:4941-4950 | packages/remote-server/src/wire_limits.rs:422-431 — 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) channels/src/feishu/card.rs:294— channels/src/feishu/card.rs:294-305 | REDACTED:17-26 — 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) REDACTED:566— REDACTED:566-575 | host/src/store/markdown_refs/resolve.rs:236-249 — 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) host/src/store/artifacts.rs:274— host/src/store/artifacts.rs:274-283 | host/src/store/markdown_refs/resolve.rs:127-139 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) agent/src/session/content/mod.rs:101— agent/src/session/content/mod.rs:101-110 | packages/app-workspaces/src/lib.rs:628-637 — 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) scripts/measure/measure-sync-browser.py:30— scripts/measure/measure-sync-browser.py:30-39 | scripts/perf/remote-commands/measure-remote-latency.py:77-86 — 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) agent/src/sandbox/linux/plan.rs:410— agent/src/sandbox/linux/plan.rs:410-421 | agent/src/sandbox/linux/plan.rs:434-443 — 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) agent/src/sandbox/linux/request.rs:220— agent/src/sandbox/linux/request.rs:220-230 | agent/src/sandbox/linux/plan.rs:333-342 — 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.
Duplicated block (10 lines × 2) agent/src/agent/run_loop.rs:539— agent/src/agent/run_loop.rs:539-548 | agent/src/agent/run_loop.rs:809-818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/agent/run_loop.rs:808` calls `Some`, `clone` and `agent/src/agent/run_loop.rs:538` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) agent/src/llm/adapters/anthropic.rs:136— agent/src/llm/adapters/anthropic.rs:136-145 | agent/src/llm/adapters/openai_responses.rs:153-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/llm/adapters/anthropic.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.
Duplicated block (10 lines × 2) agent/src/rpc/mod.rs:46— agent/src/rpc/mod.rs:46-55 | packages/rpc/src/decode.rs:618-627 — 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 `agent/src/rpc/mod.rs:46` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) agent/src/rpc/session.rs:764— agent/src/rpc/session.rs:764-773 | agent/src/rpc/session.rs:872-881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/session.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.
Duplicated block (10 lines × 2) agent/src/session/content/journal.rs:767— agent/src/session/content/journal.rs:767-776 | agent/src/session/content/reader.rs:1030-1039 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) channels/src/providers/email.rs:2630— channels/src/providers/email.rs:2630-2639 | channels/src/providers/irc.rs:1049-1059 — before extracting anything, compare `channels/src/providers/email.rs` and `channels/src/providers/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `channels/src/providers/email.rs:2630` it does not close everything it opens, so those exact lines 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) cli/src/commands/model_settings.rs:619— cli/src/commands/model_settings.rs:619-628 | cli/src/commands/model_settings.rs:708-717 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/model_settings.rs:619` 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 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) cli/src/commands/pin.rs:176— cli/src/commands/pin.rs:176-185 | cli/src/commands/pin.rs:223-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 `cli/src/commands/pin.rs:176` it begins part-way through the construct above it, so those exact lines 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) host/src/agent_bridge/delete_outbox.rs:18— host/src/agent_bridge/delete_outbox.rs:18-27 | host/src/agent_bridge/delete_outbox.rs:29-38 — both copies are in the same file, so extract the 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 (10 lines × 2) host/src/agent_bridge/queries.rs:337— host/src/agent_bridge/queries.rs:337-346 | host/src/agent_bridge/queries.rs:353-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_bridge/queries.rs:337` it begins part-way through the construct above it, so those exact lines 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) host/src/agent_bridge/stream.rs:234— host/src/agent_bridge/stream.rs:234-243 | host/src/agent_bridge/stream.rs:428-437 — both copies are in the same file, so extract the 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) tui/src/components/markdown.rs:776— tui/src/components/markdown.rs:776-785 | tui/src/components/markdown.rs:896-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/markdown.rs:776` it does not close everything it opens, so those exact lines 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) tui/src/workbench/panels.rs:425— tui/src/workbench/panels.rs:425-434 | tui/src/workbench/panels.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 lines × 2) channels/src/dingtalk/bridge.rs:70— channels/src/dingtalk/bridge.rs:70-79 | channels/src/feishu/bridge.rs:132-141 — `channels/src/dingtalk/bridge.rs` and `channels/src/feishu/bridge.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 33 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/dingtalk/bridge.rs:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `DingtalkEvent` in one and `FeishuEvent` 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) channels/src/transport/signature.rs:61— channels/src/transport/signature.rs:61-70 | desktop/src-tauri/src/terminal/server.rs:908-917 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) agent/src/session/content/compress.rs:72— agent/src/session/content/compress.rs:72-81 | agent/src/session/content/rechunk.rs:52-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) host/src/remote_host/files.rs:1128— host/src/remote_host/files.rs:1128-1137 | host/src/remote_host/files.rs:1146-1155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/remote_host/files.rs:1128` 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) agent/src/session/database_backup.rs:66— agent/src/session/database_backup.rs:66-75 | agent/src/session/database_backup.rs:85-94 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/database_backup.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.
Duplicated block (10 lines × 2) cli/src/commands/session.rs:1103— cli/src/commands/session.rs:1103-1112 | cli/src/commands/session.rs:1237-1246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/session.rs:1103` it does not close everything it opens, so those exact lines 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) scripts/measure/measure-lean-history.py:116— scripts/measure/measure-lean-history.py:116-125 | scripts/measure/verify-e2e-bytes.py:190-199 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) agent/src/agent/run_loop.rs:517— agent/src/agent/run_loop.rs:517-528 | agent/src/agent/run_loop.rs:785-796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/agent/run_loop.rs:517` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) channels/src/dingtalk/mod.rs:115— channels/src/dingtalk/mod.rs:115-126 | channels/src/feishu/mod.rs:90-101 — `channels/src/dingtalk/mod.rs` and `channels/src/feishu/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/dingtalk/mod.rs:115` 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) channels/src/feishu/prompt_loop.rs:241— channels/src/feishu/prompt_loop.rs:241-252 | channels/src/feishu/prompt_loop.rs:278-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/prompt_loop.rs:241` 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) channels/src/providers/whatsapp.rs:534— channels/src/providers/whatsapp.rs:534-545 | channels/src/providers/whatsapp.rs:561-572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/whatsapp.rs:534` it begins part-way through the construct above it, so those exact lines 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) cli/src/browser/chromium/chromium_page.rs:280— cli/src/browser/chromium/chromium_page.rs:280-291 | cli/src/browser/chromium/chromium_session.rs:183-194 — 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 `cli/src/browser/chromium/chromium_page.rs:280` it begins part-way through the construct above it, so those exact lines 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) cli/src/commands/desktop.rs:196— cli/src/commands/desktop.rs:196-207 | cli/src/commands/settings.rs:260-271 — before extracting anything, compare `cli/src/commands/desktop.rs` and `cli/src/commands/settings.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/desktop.rs:196` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) cli/src/commands/mcp.rs:65— cli/src/commands/mcp.rs:65-76 | cli/src/commands/mcp.rs:163-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. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/mcp.rs:65` it does not close everything it opens, so those 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, `cli/src/commands/mcp.rs:61` calls `Some`, `insert`, `to_string` and `cli/src/commands/mcp.rs:161` 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) cli/src/commands/run.rs:196— cli/src/commands/run.rs:196-207 | tui/src/index.rs:76-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. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/run.rs:196` it begins part-way through the construct above it, so those exact lines 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) cli/src/rpc.rs:307— cli/src/rpc.rs:307-318 | tui/src/rpc/grpc_client.rs:648-659 — before extracting anything, compare `cli/src/rpc.rs` and `tui/src/rpc/grpc_client.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 83 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) packages/rpc/src/transport.rs:614— packages/rpc/src/transport.rs:614-625 | packages/rpc/src/transport.rs:643-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. Read the line range as the matched WINDOW rather than a finished unit: at `packages/rpc/src/transport.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 (12 lines × 2) tui/src/components/chat_area.rs:1934— tui/src/components/chat_area.rs:1934-1945 | tui/src/components/chat_area.rs:1971-1982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/chat_area.rs:1934` 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) tui/src/workbench/screen.rs:1067— tui/src/workbench/screen.rs:1067-1078 | tui/src/workbench/screen.rs:1084-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 `tui/src/workbench/screen.rs:1067` it does not close everything it opens, so those exact lines 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) cli/src/commands/remote_peers.rs:749— cli/src/commands/remote_peers.rs:749-760 | cli/src/commands/remote_peers.rs:857-868 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/remote_peers.rs:749` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) channels/src/providers/discord.rs:424— channels/src/providers/discord.rs:424-435 | channels/src/providers/qq.rs:463-474 — 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 (12 lines × 2) tui/src/utils.rs:324— tui/src/utils.rs:324-335 | tui/src/utils.rs:342-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. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/utils.rs:324` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) desktop/src-tauri/src/commands/update_windows.rs:131— desktop/src-tauri/src/commands/update_windows.rs:131-142 | desktop/src-tauri/src/commands/update_windows.rs:152-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `desktop/src-tauri/src/commands/update_windows.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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) host/src/remote_host/business/providers.rs:49— host/src/remote_host/business/providers.rs:49-60 | host/src/remote_host/business/providers.rs:78-89 — both copies are in the same file, so extract the 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) channels/src/providers/irc.rs:149— channels/src/providers/irc.rs:149-160 | channels/src/providers/signal.rs:171-182 — 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 `channels/src/providers/irc.rs: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.
Duplicated block (12 lines × 2) scripts/docs/generate_models.py:399— scripts/docs/generate_models.py:399-410 | scripts/docs/generate_models.py:421-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC2 · Forms & labels· <TextInput> field component without a label · ×16
<TextInput> field component without a label desktop/src/features/agent/ApprovalPrompt.tsx:243— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label desktop/src/features/agent/NewConversationWorkspaceForm.tsx:63— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label desktop/src/features/artifacts/ArtifactsPanel.tsx:91— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label desktop/src/features/settings/ModelsPage.tsx:90— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label desktop/src/features/vibe/AddToVibeDialog.tsx:178— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/components/ActionMenu.tsx:103— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/components/SelectionSheet.tsx:65— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/features/chat/components/ComposerDock.tsx:592— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/features/chat/components/RenameModal.tsx:97— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/features/chat/components/SendQueuePanel.tsx:203— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/features/settings/TimezoneField.tsx:71— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/screens/DesktopLabelDialog.tsx:95— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/screens/PairingScreen.tsx:334— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/screens/SessionList.tsx:1531— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/screens/SessionsScreen.tsx:1304— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<TextInput> field component without a label mobile/src/screens/SessionsScreen.tsx:1315— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
TooManyMethods: Live tui/src/workbench/live.rs:166— TooManyMethods — 156 methods. The bar is 30 methods; this is 126 over it, 5.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Supervisor packages/remote-server/src/supervisor.rs:99— TooManyMethods — 118 methods, declared across 8 files: src/supervisor.rs (46), supervisor/start.rs (22), supervisor/shutdown.rs (21), supervisor/runtime.rs (11), +4 more file(s). The bar is 30 methods; this is 88 over it, 3.93× 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: ChatArea tui/src/components/chat_area.rs:1098— TooManyMethods — 115 methods. The bar is 30 methods; this is 85 over it, 3.83× 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: Workbench tui/src/workbench/mod.rs:647— TooManyMethods — 104 methods. The bar is 30 methods; this is 74 over it, 3.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.
TooManyMethods: SqliteStore agent/src/session/sqlite_store/mod.rs:12— TooManyMethods — 85 methods, declared across 18 files: sqlite_store/events.rs (13), sqlite_store/mod.rs (13), content/recovery.rs (7), sqlite_store/transcript.rs (7), +14 more file(s). The bar is 30 methods; this is 55 over it, 2.83× 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: Manager agent/src/session/manager/mod.rs:17— TooManyMethods — 84 methods, declared across 16 files: manager/mod.rs (31), manager/loading.rs (9), session/queued_receipts.rs (7), session/summary.rs (5), +12 more file(s). The bar is 30 methods; this is 54 over it, 2.80× 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: ServerSession agent/src/rpc/session.rs:93— TooManyMethods — 83 methods, declared across 2 files: rpc/session.rs (67), rpc/session_prompt.rs (16). The bar is 30 methods; this is 53 over it, 2.77× 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: GrpcClient tui/src/rpc/grpc_client.rs:185— TooManyMethods — 80 methods. The bar is 30 methods; this is 50 over it, 2.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RemoteClient packages/remote-client/src/client.ts:130— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RunClient cli/src/rpc.rs:75— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.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.
TooManyMethods: Client packages/remote-client/src/runtime.rs:1028— TooManyMethods — 64 methods, declared across 2 files: src/runtime.rs (61), src/transfer.rs (3). The bar is 30 methods; this is 34 over it, 2.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: Input tui/src/components/input.rs:187— TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SseBroadcaster agent/src/rpc/broadcaster/mod.rs:135— TooManyMethods — 49 methods, declared across 3 files: broadcaster/journal.rs (22), broadcaster/mod.rs (18), broadcaster/replay.rs (9). The bar is 30 methods; this is 19 over it, 1.63× 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: Snapshot agent/src/session/content/reader.rs:14— TooManyMethods — 35 methods, declared across 5 files: content/reader.rs (27), content/reader_recall.rs (3), content/reader_summary.rs (3), content/reader_derived.rs (1), +1 more file(s). The bar is 30 methods; this is 5 over it, 1.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: SyncEngine packages/remote-client/src/syncEngine.ts:197— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.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: Store orchestration/fusion/src/store.rs:8— 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.
Off the main sequence: @future-os/git-graph — @future-os/git-graph: 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: @future-os/json-preview — @future-os/json-preview: 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: @future-os/markdown — @future-os/markdown: 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: @future-os/peer-icons — @future-os/peer-icons: 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: future-app-settings — future-app-settings: 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: future-http — future-http: 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: future-logging — future-logging: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
Off the main sequence: future-remote-crypto — future-remote-crypto: 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: future-rpc — future-rpc: abstractness 0.01, instability 0.00, distance 0.99 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
Off the main sequence: @future-os/thread-projection — @future-os/thread-projection: abstractness 0.10, instability 0.00, distance 0.90 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: future-share-intent — future-share-intent: abstractness 0.13, instability 0.00, distance 0.88 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: future-file-handler — future-file-handler: abstractness 0.17, instability 0.00, distance 0.83 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: future-fusion — future-fusion: abstractness 0.00, instability 0.20, distance 0.80 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: future-remote-protocol — future-remote-protocol: abstractness 0.00, instability 0.20, distance 0.80 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: future-app-workspaces — future-app-workspaces: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: future-tasks — future-tasks: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Change coupling: REDACTED ↔ TasksView.tsx desktop/src-tauri/src/commands/tasks.rs:1— `desktop/src-tauri/src/commands/tasks.rs` and `desktop/src/features/tasks/TasksView.tsx` change together 100% of the time (11 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin…; `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) — run `git show` on any of them.
Change coupling: TasksView.tsx ↔ REDACTED desktop/src/features/tasks/TasksView.tsx:1— `desktop/src/features/tasks/TasksView.tsx` and `REDACTED` change together 85% of the time (11 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `22ad7180` refactor!: remove task dependencies (#1109) (at that commit the file was still `desktop/src-tauri/src/remote_host/business/tasks.rs`); `699b049b` feat(tasks): let a task delete the conversation each run leaves behin… (at that commit the file was still `desktop/src-tauri/src/remote_host/business/tasks.rs`); `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) (at that commit the file was still `desktop/src-tauri/src/remote_host/business/tasks.rs`) — run `git show` on any of them.
Change coupling: GeneralPage.tsx ↔ app_settings.rs desktop/src/features/settings/GeneralPage.tsx:1— `desktop/src/features/settings/GeneralPage.tsx` and `host/src/store/app_settings.rs` 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 — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `442b57fa` feat(desktop): pull the skill-recommendation toggle from Settings (#791) (at that commit the file was still `desktop/src-tauri/src/store/app_settings.rs`); `834ac2b4` refactor(desktop): remove the thinking visibility setting (#688) (at that commit the file was still `desktop/src-tauri/src/store/app_settings.rs`); `babaedaa` fix(desktop): generate first-answer titles instead of compacting cont… (at that commit the file was still `desktop/src-tauri/src/store/app_settings.rs`) — run `git show` on any of them.
Change coupling: RemoteConversationView.tsx ↔ useRemoteTimeline.ts desktop/src/features/remote-peer/RemoteConversationView.tsx:1— `desktop/src/features/remote-peer/RemoteConversationView.tsx` and `desktop/src/features/remote-peer/useRemoteTimeline.ts` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency 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 `028fca83` fix(remote): read older history from the walk, not from a permanent p…; `e2f98dcc` perf(remote-peer): open a remote conversation in the phone's three co…; `1886164d` fix(remote): a reply that is already in the transcript, drawn once (#… — run `git show` on any of them.
Change coupling: mod.rs ↔ transfer.rs desktop/src-tauri/src/remote/mod.rs:1— `desktop/src-tauri/src/remote/mod.rs` and `host/src/remote/transfer.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 — 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 `ca5037cf` Harden remote connection recovery (#323) (at that commit the file was still `desktop/src-tauri/src/remote/transfer.rs`); `1a49f4ac` Fix remote attachment preview resilience (#312) (at that commit the file was still `desktop/src-tauri/src/remote/transfer.rs`); `3b2274f2` feat: improve mobile remote reliability (#257) (at that commit the file was still `desktop/src-tauri/src/remote/transfer.rs`) — run `git show` on any of them.
Change coupling: commands.rs ↔ types.ts host/src/remote/commands.rs:1— `host/src/remote/commands.rs` and `mobile/src/remote/types.ts` change together 59% of the time (29 of the 49 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 29 shared commits counted here, the most recent 3 are `7032b19d` feat(remote): connecting is not taking over (#1179) (at that commit the file was still `desktop/src-tauri/src/remote/commands.rs`); `2a9b11e4` feat(remote): let a host say what connected to it (#970) (at that commit the file was still `desktop/src-tauri/src/remote/commands.rs`); `e9184896` feat(mobile): create a workspace from the phone (#950) (at that commit the file was still `desktop/src-tauri/src/remote/commands.rs`) — run `git show` on any of them.
Change coupling: parity.rs ↔ payloads.rs packages/rpc/src/parity.rs:1— `packages/rpc/src/parity.rs` and `packages/rpc/src/payloads.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `5e8503f6` feat(mobile,host,agent): show and edit a queued message's files (#1576); `0f83828b` feat(tui,agent,rpc): order the rail by when a conversation was create…; `8449acf6` fix(agent): keep a session writable after a manual compaction (#1149) — run `git show` on any of them.
Change coupling: ChatScreen.tsx ↔ useConversationController.ts mobile/src/features/chat/ChatScreen.tsx:1— `mobile/src/features/chat/ChatScreen.tsx` and `mobile/src/remote/useConversationController.ts` change together 57% of the time (8 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `52328e80` feat(mobile): fork a conversation from a reply, like the desktop (#903); `0fe03191` perf(remote): fetch a lean shell row's command on tap (#851) (#851); `fb883888` feat(usage): make the spend entry an icon and read it on open (#730) — run `git show` on any of them.
Change coupling: MessageBlock.tsx ↔ attachments.ts desktop/src/features/agent/MessageBlock.tsx:1— `desktop/src/features/agent/MessageBlock.tsx` and `desktop/src/features/agent/attachments.ts` change together 56% of the time (9 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency 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 `00c5426d` Harden GUI attachment handling (at that commit the files were still `gui/src/features/agent/MessageBlock.tsx` and `gui/src/features/agent/attachments.ts`); `3f03f89f` refactor(attachment): generate thumbnails in Rust; SVG as file; drop … (at that commit the files were still `gui/src/features/agent/MessageBlock.tsx` and `gui/src/features/agent/attachments.ts`); `35aefea9` feat(attachment): reference local files by path instead of inlining c… (at that commit the files were still `gui/src/features/agent/MessageBlock.tsx` and `gui/src/features/agent/attachments.ts`) — run `git show` on any of them.
Change coupling: DesktopsScreen.tsx ↔ SessionsScreen.tsx mobile/src/screens/DesktopsScreen.tsx:1— `mobile/src/screens/DesktopsScreen.tsx` and `mobile/src/screens/SessionsScreen.tsx` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `1d8a972c` feat(tui,mobile,agent): a new-session screen; named and gated desktop…; `bfefdfff` feat(mobile): give each paired desktop its own settings page (#1041); `c1adb032` fix(mobile): align dialogs and preserve usable remote connections (#599) — run `git show` on any of them.
Change coupling: backend.ts ↔ REDACTED desktop/shot/mock/backend.ts:1— `desktop/shot/mock/backend.ts` and `REDACTED` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `699b049b` feat(tasks): let a task delete the conversation each run leaves behin… (at that commit the file was still `desktop/src-tauri/src/remote_host/business/tasks.rs`); `67b9bd01` refactor(tasks): remove the prompt-suggestion pass (#932) (at that commit the file was still `desktop/src-tauri/src/remote_host/business/tasks.rs`); `97d1794a` refactor(tasks): dependency is a trigger choice, not a second section… (at that commit the file was still `desktop/src-tauri/src/remote_host/business/tasks.rs`) — run `git show` on any of them.
Change coupling: commands.rs ↔ useConversationController.ts host/src/remote/commands.rs:1— `host/src/remote/commands.rs` and `mobile/src/remote/useConversationController.ts` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `52328e80` feat(mobile): fork a conversation from a reply, like the desktop (#903) (at that commit the file was still `desktop/src-tauri/src/remote/commands.rs`); `0fe03191` perf(remote): fetch a lean shell row's command on tap (#851) (#851) (at that commit the file was still `desktop/src-tauri/src/remote/commands.rs`); `c7c4ebaf` feat(mobile): trigger manual context compaction from the slash menu (… (at that commit the file was still `desktop/src-tauri/src/remote/commands.rs`) — run `git show` on any of them.
Change coupling: Composer.tsx ↔ files.ts desktop/src/features/agent/Composer.tsx:1— `desktop/src/features/agent/Composer.tsx` and `desktop/src/integrations/storage/files.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `46ae6705` fix(desktop): attach a clipboard image pasted in the Linux WebView (#…; `6b7717e5` fix: preserve native clipboard file paths (#523); `00c5426d` Harden GUI attachment handling (at that commit the files were still `gui/src/features/agent/Composer.tsx` and `gui/src/integrations/storage/files.ts`) — run `git show` on any of them.
Change coupling: AppShell.tsx ↔ GeneralPage.tsx desktop/src/components/layout/AppShell.tsx:1— `desktop/src/components/layout/AppShell.tsx` and `desktop/src/features/settings/GeneralPage.tsx` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `834ac2b4` refactor(desktop): remove the thinking visibility setting (#688); `5be372e8` feat(tui,desktop): completion bell when an agent run finishes (#412); `a54da63b` feat(gui/skills): auto-upgrade setting + manual "Upgrade all" (at that commit the files were still `gui/src/components/layout/AppShell.tsx` and `gui/src/features/settings/GeneralPage.tsx`) — run `git show` on any of them.
Change coupling: RunInspectPanel.tsx ↔ RunsPanel.tsx desktop/src/features/runs/RunInspectPanel.tsx:1— `desktop/src/features/runs/RunInspectPanel.tsx` and `desktop/src/features/runs/RunsPanel.tsx` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 5 shared commits counted here, the most recent 3 are `a235f706` fix(agent): harden responses replay and refine context panels (#430); `fbb0767d` feat(gui): show runs at tool-call granularity with per-tool detail (at that commit the files were still `gui/src/features/runs/RunInspectPanel.tsx` and `gui/src/features/runs/RunsPanel.tsx`); `7e77d480` refactor(gui): M-4 — share tool-input JSON parsing across runs/markdown (at that commit the files were still `gui/src/features/runs/RunInspectPanel.tsx` and `gui/src/features/runs/RunsPanel.tsx`) — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×15
Edited copy of a member (8 corresponding lines) orchestration/tasks/src/kernel.rs:281— orchestration/tasks/src/kernel.rs:281-288 | orchestration/tasks/src/kernel.rs:305-315 — 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) tui/src/skills_cli.rs:851— tui/src/skills_cli.rs:851-858 | tui/src/subprocess.rs:169-176 — 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) channels/src/status.rs:202— channels/src/status.rs:202-209 | channels/src/status.rs:212-219 — 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) tui/src/workbench/syntax.rs:1051— tui/src/workbench/syntax.rs:1051-1058 | tui/src/workbench/syntax.rs:1060-1070 — 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) cli/src/commands/mcp_http.rs:399— cli/src/commands/mcp_http.rs:399-406 | tui/src/skills_cli.rs:539-549 — 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) agent/src/config/providers.rs:360— agent/src/config/providers.rs:360-369 | agent/src/sandbox/rules.rs:407-414 — 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) tui/src/workbench/state.rs:343— tui/src/workbench/state.rs:343-355 | tui/src/workbench/state.rs:366-373 — 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) agent/src/session/content/checkpoint_retirement.rs:20— agent/src/session/content/checkpoint_retirement.rs:20-27 | agent/src/session/content/reset.rs:14-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) tui/src/worktree.rs:206— tui/src/worktree.rs:206-213 | tui/src/worktree.rs:216-223 — 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) desktop/src-tauri/src/commands/git_history.rs:22— desktop/src-tauri/src/commands/git_history.rs:22-32 | desktop/src-tauri/src/commands/review.rs:27-34 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) desktop/src-tauri/src/commands/git_history.rs:39— desktop/src-tauri/src/commands/git_history.rs:39-46 | desktop/src-tauri/src/commands/review.rs:15-22 — 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) agent/src/rpc/export_html.rs:529— agent/src/rpc/export_html.rs:529-536 | agent/src/skill_reco/mod.rs:870-878 — 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) cli/src/headless/mod.rs:988— cli/src/headless/mod.rs:988-995 | desktop/src-tauri/src/agent_bridge/client.rs:6-25 — 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) host/src/store/paging.rs:329— host/src/store/paging.rs:329-338 | packages/app-workspaces/src/lib.rs:407-414 — 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) channels/src/providers/discord.rs:235— channels/src/providers/discord.rs:235-243 | host/src/conversations.rs:73-80 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×14
Edited copy of a member (7 corresponding lines) tui/src/components/markdown.rs:270— tui/src/components/markdown.rs:270-277 | tui/src/components/markdown.rs:2027-2033 — 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) agent/src/session/sqlite_store/mod.rs:39— agent/src/session/sqlite_store/mod.rs:39-45 | agent/src/session/sqlite_store/mod.rs:160-172 — 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) cli/src/commands/model_settings.rs:239— cli/src/commands/model_settings.rs:239-245 | cli/src/commands/model_settings.rs:474-480 — 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) cli/src/commands/browser_tools.rs:1288— cli/src/commands/browser_tools.rs:1288-1296 | cli/src/commands/browser_tools.rs:1305-1311 — 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) host/src/tasks/service.rs:222— host/src/tasks/service.rs:222-228 | host/src/tasks/service.rs:395-401 — 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) tui/src/home.rs:11— orchestration/goal/src/compat.rs:314-322 | tui/src/home.rs:11-17 — 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) packages/app-settings/src/lib.rs:126— packages/app-settings/src/lib.rs:126-133 | packages/app-workspaces/src/lib.rs:36-42 — 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) desktop/src-tauri/src/terminal/ticket.rs:111— desktop/src-tauri/src/terminal/ticket.rs:111-120 | desktop/src-tauri/src/terminal/server.rs:975-981 — 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) agent/src/llm/mod.rs:95— agent/src/llm/mod.rs:95-101 | orchestration/goal/src/state.rs:1053-1059 — 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) agent/src/compaction/semantic.rs:879— agent/src/compaction/semantic.rs:879-885 | cli/src/axi.rs:164-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) agent/src/session/reset.rs:218— agent/src/session/reset.rs:218-225 | agent/src/types/mod.rs:510-516 — 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) packages/app-settings/src/lib.rs:137— packages/app-settings/src/lib.rs:137-144 | packages/app-workspaces/src/lib.rs:46-52 — 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) packages/remote-client/src/credentials.rs:98— packages/remote-client/src/credentials.rs:98-104 | packages/remote-server/src/credentials.rs:29-36 — 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) agent/src/sandbox/linux/helper.rs:678— agent/src/sandbox/linux/helper.rs:678-684 | agent/src/sandbox/linux/helper.rs:686-692 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (11 lines × 2) agent/src/rpc/session_prompt.rs:867— agent/src/rpc/session_prompt.rs:867-877 | agent/src/rpc/session_prompt.rs:892-902 — both copies are in the same file, so extract the 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) channels/src/feishu/feishu_rest.rs:139— channels/src/feishu/feishu_rest.rs:139-149 | channels/src/feishu/feishu_rest.rs:343-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. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/feishu_rest.rs:139` it does not close everything it opens, so those exact lines 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) channels/src/providers/discord.rs:661— channels/src/providers/discord.rs:661-671 | channels/src/providers/qq.rs:631-641 — 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 `channels/src/providers/discord.rs:661` it does not close everything it opens, so those exact lines 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) cli/src/browser/safari/webdriver_client.rs:282— cli/src/browser/safari/webdriver_client.rs:282-292 | cli/src/browser/safari/webdriver_client.rs:332-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/browser/safari/webdriver_client.rs:282` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) cli/src/commands/remote.rs:255— cli/src/commands/remote.rs:255-265 | cli/src/commands/remote_peers.rs:171-181 — before extracting anything, compare `cli/src/commands/remote.rs` and `cli/src/commands/remote_peers.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. If that is what happened, the fix is to keep one copy and have the 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 `cli/src/commands/remote.rs:255` 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) cli/src/commands/skills.rs:145— cli/src/commands/skills.rs:145-155 | cli/src/commands/skills.rs:304-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) REDACTED:10— REDACTED:10-20 | REDACTED:100-110 — both copies are in the same file, so extract the 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) tui/src/notifications.rs:496— tui/src/notifications.rs:496-506 | tui/src/notifications.rs:525-535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/notifications.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 (11 lines × 2) tui/src/workbench/panels.rs:864— tui/src/workbench/panels.rs:864-874 | tui/src/workbench/panels.rs:884-894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/workbench/panels.rs:864` 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) tui/src/workbench/run.rs:458— tui/src/workbench/run.rs:458-468 | tui/src/workbench/run.rs:481-491 — both copies are in the same file, so extract the 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) tui/src/components/chat_area.rs:3913— tui/src/components/chat_area.rs:3913-3923 | tui/src/components/chat_area.rs:3929-3939 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/chat_area.rs:3913` it does not close everything it opens, so those exact lines 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) channels/src/feishu/bridge.rs:550— channels/src/feishu/bridge.rs:550-560 | channels/src/feishu/bridge.rs:803-816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/bridge.rs:550` 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 lines × 2) channels/src/feishu/feishu_rest.rs:64— channels/src/feishu/feishu_rest.rs:64-74 | channels/src/feishu/feishu_rest.rs:349-359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/feishu_rest.rs:64` it begins part-way through the construct above it, so those 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) cli/src/commands/task.rs:895— cli/src/commands/task.rs:895-905 | cli/src/commands/task.rs:1202-1212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/task.rs:895` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
future_channel::feishu::prompt_loop::run_prompt_loop (cognitive 214) channels/src/feishu/prompt_loop.rs:29— future_channel::feishu::prompt_loop::run_prompt_loop has cognitive complexity 214 (threshold 15). Drivers by points: if/else 66 (182 pts), match/switch 9 (25 pts), boolean chains 5, loops 2 (nesting depth added 132). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_channel::providers::discord::run_gateway (cognitive 64) channels/src/providers/discord.rs:621— future_channel::providers::discord::run_gateway has cognitive complexity 64 (threshold 15). Drivers by points: if/else 9 (39 pts), match/switch 6 (24 pts), 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.
future_channel::providers::qq::run_gateway (cognitive 63) channels/src/providers/qq.rs:588— future_channel::providers::qq::run_gateway has cognitive complexity 63 (threshold 15). Drivers by points: if/else 10 (38 pts), match/switch 6 (23 pts), boolean chains 1, loops 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_channel::feishu::feishu_ws::is_bot_mentioned (cognitive 51) channels/src/feishu/feishu_ws.rs:481— future_channel::feishu::feishu_ws::is_bot_mentioned has cognitive complexity 51 (threshold 15). Drivers by points: if/else 7 (30 pts), loops 2 (10 pts), match/switch 3 (10 pts), boolean chains 1 (nesting depth added 38). Of this number, 49 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
future_channel::dingtalk::bridge::run_prompt_loop (cognitive 48) channels/src/dingtalk/bridge.rs:425— future_channel::dingtalk::bridge::run_prompt_loop has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (41 pts), match/switch 2 (4 pts), boolean chains 2, 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.
future_channel::bridge::turn::run_turn (cognitive 29) channels/src/bridge/turn.rs:50— future_channel::bridge::turn::run_turn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_channel::providers::slack::socket_mode_session (cognitive 27) channels/src/providers/slack.rs:716— future_channel::providers::slack::socket_mode_session has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 4 (10 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.
future_channel::providers::imessage::macos::run_polling (cognitive 22) channels/src/providers/imessage.rs:436— future_channel::providers::imessage::macos::run_polling has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (12 pts), match/switch 2 (5 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.
future_channel::providers::irc::parse_line (cognitive 21) channels/src/providers/irc.rs:403— future_channel::providers::irc::parse_line has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 5 (9 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.
future_channel::providers::mattermost::websocket_session (cognitive 21) channels/src/providers/mattermost.rs:495— future_channel::providers::mattermost::websocket_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 4 (10 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.
future_channel::transport::text::chunk (cognitive 19) channels/src/transport/text.rs:80— future_channel::transport::text::chunk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 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.
future_channel::feishu::feishu_ws::extract_text_content (cognitive 18) channels/src/feishu/feishu_ws.rs:420— future_channel::feishu::feishu_ws::extract_text_content has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (8 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
future_channel::providers::linq::parts_of (cognitive 18) channels/src/providers/linq.rs:419— future_channel::providers::linq::parts_of has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×13
Edited copy of a member (15 corresponding lines) host/src/agent_bridge/persist.rs:311— host/src/agent_bridge/persist.rs:311-326 | host/src/agent_bridge/persist.rs:471-485 — 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) host/src/agent_bridge/queries.rs:328— host/src/agent_bridge/queries.rs:328-346 | host/src/agent_bridge/queries.rs:348-362 — 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) tui/src/workbench/live.rs:3732— tui/src/workbench/live.rs:3732-3747 | tui/src/workbench/live.rs:3749-3763 — 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) cli/src/rpc.rs:306— cli/src/rpc.rs:306-321 | tui/src/rpc/grpc_client.rs:647-661 — 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) agent/src/compaction/semantic.rs:863— agent/src/compaction/semantic.rs:863-877 | agent/src/compaction/semantic/evidence.rs:124-138 — 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) host/src/agent_bridge/queries.rs:649— host/src/agent_bridge/queries.rs:649-664 | host/src/agent_bridge/queries.rs:667-681 — 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) packages/rpc/src/decode.rs:743— packages/rpc/src/decode.rs:743-757 | packages/rpc/src/encode.rs:706-722 — 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) agent/src/session/entry.rs:131— agent/src/session/entry.rs:131-145 | agent/src/session/entry.rs:147-161 — 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) channels/src/providers/imessage.rs:291— channels/src/providers/imessage.rs:291-306 | channels/src/providers/imessage.rs:308-322 — 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) host/src/crash_log.rs:159— host/src/crash_log.rs:159-173 | tui/src/crash.rs:275-289 — 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) channels/src/bridge/mod.rs:606— channels/src/bridge/mod.rs:606-620 | host/src/store/artifacts.rs:247-262 — 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) channels/src/feishu/feishu_rest.rs:371— channels/src/feishu/feishu_rest.rs:371-385 | channels/src/feishu/feishu_rest.rs:523-537 — 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) scripts/compaction_experiment/harness.py:165— scripts/compaction_experiment/harness.py:165-179 | scripts/compaction_experiment/run_open_book.py:79-94 — 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.
Boundary violation [package:relative-cross-package] harness/mobile-client/entry.mjs:24— harness/mobile-client/entry.mjs:24 reaches into another package with a relative path (../../mobile/src/remote/pairing.ts) — import the package by name instead.
Boundary violation [package:relative-cross-package] harness/mobile-client/entry.mjs:25— harness/mobile-client/entry.mjs:25 reaches into another package with a relative path (../../mobile/src/remote/client.ts) — import the package by name instead.
Boundary violation [package:third-party-deep-import] mobile/jest.environment.js:32— mobile/jest.environment.js:32 imports jest-expo/src/preset/nativeEnvironment, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:test-cross-package-internals] mobile/src/components/__tests__/MarkdownText.test.ts:11— mobile/src/components/__tests__/MarkdownText.test.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../../../../packages/markdown/src/parseFutureMarkdown) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-mobile-performance.ts:5— scripts/measure/measure-mobile-performance.ts:5 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-mobile-performance.ts:7— scripts/measure/measure-mobile-performance.ts:7 reaches into another package with a relative path (../../packages/markdown/src/types) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-sync-browser.ts:9— scripts/measure/measure-sync-browser.ts:9 reaches into another package with a relative path (../../mobile/src/remote/client) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-sync-browser.ts:10— scripts/measure/measure-sync-browser.ts:10 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-sync-snapshot.ts:7— scripts/measure/measure-sync-snapshot.ts:7 reaches into another package with a relative path (../../mobile/src/remote/client) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-sync-snapshot.ts:8— scripts/measure/measure-sync-snapshot.ts:8 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-sync-warm.ts:10— scripts/measure/measure-sync-warm.ts:10 reaches into another package with a relative path (../../mobile/src/remote/client) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/measure/measure-sync-warm.ts:11— scripts/measure/measure-sync-warm.ts:11 reaches into another package with a relative path (../../mobile/src/remote/types) — import the package by name instead.
Boundary violation [package:test-cross-package-internals] scripts/tests/test-mobile-ios-project.cjs:9— scripts/tests/test-mobile-ios-project.cjs:9 reaches past another workspace package's public entry into its internals with a relative path (../../mobile/plugins/withIosShareExtension) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
SqliteStore::recover_segmented_run (cognitive 142) agent/src/session/content/recovery.rs:231— SqliteStore::recover_segmented_run has cognitive complexity 142 (threshold 15). Drivers by points: if/else 28 (117 pts), loops 4 (11 pts), match/switch 2 (10 pts), boolean chains 4 (nesting depth added 104). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SqliteStore::reclaim_settled_journals (cognitive 78) REDACTED:688— SqliteStore::reclaim_settled_journals has cognitive complexity 78 (threshold 15). Drivers by points: if/else 36 (54 pts), boolean chains 13, match/switch 2 (6 pts), 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.
SqliteStore::import_legacy_cancellable (cognitive 67) agent/src/session/legacy_import.rs:205— SqliteStore::import_legacy_cancellable has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (38 pts), loops 8 (18 pts), match/switch 4 (7 pts), boolean chains 4 (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.
SqliteStore::compact_run_cancellable (cognitive 45) agent/src/session/journal_compaction.rs:566— SqliteStore::compact_run_cancellable has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 5, loops 3 (4 pts), match/switch 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.
SqliteStore::append_stream_entry (cognitive 43) agent/src/session/content/stream_entry.rs:173— SqliteStore::append_stream_entry has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (2 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.
SqliteStore::recover_queued_receipts_cancellable (cognitive 25) agent/src/session/queued_receipts.rs:171— SqliteStore::recover_queued_receipts_cancellable has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SqliteStore::publish_segmented_metadata (cognitive 24) agent/src/session/content/metadata.rs:129— SqliteStore::publish_segmented_metadata has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 6 (9 pts), boolean chains 3, match/switch 1 (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.
SqliteStore::discard_hidden_fork_cancellable (cognitive 21) agent/src/session/content/fork.rs:77— SqliteStore::discard_hidden_fork_cancellable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 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.
SqliteStore::pin_reset_fields (cognitive 19) agent/src/session/content/reset.rs:110— SqliteStore::pin_reset_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (6 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.
SqliteStore::segmented_replay (cognitive 18) agent/src/session/content/journal.rs:892— SqliteStore::segmented_replay 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.
SqliteStore::pricing_event_payloads (cognitive 17) agent/src/session/sqlite_store/events.rs:78— SqliteStore::pricing_event_payloads has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (8 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.
SqliteStore::cleanup_operation_cancellable (cognitive 16) agent/src/session/content/reset.rs:199— SqliteStore::cleanup_operation_cancellable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 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.
Snapshot::page_impl (cognitive 62) agent/src/session/content/reader.rs:300— Snapshot::page_impl has cognitive complexity 62 (threshold 15). Drivers by points: if/else 26 (50 pts), loops 6 (11 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.
Snapshot::query (cognitive 47) orchestration/fusion/src/files.rs:255— Snapshot::query has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 4 (10 pts), boolean chains 2, match/switch 1 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Snapshot::entry_impl (cognitive 35) agent/src/session/content/reader.rs:570— Snapshot::entry_impl has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 2 (3 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.
Snapshot::readable_fields (cognitive 32) agent/src/session/content/reader_recall.rs:267— Snapshot::readable_fields has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (5 pts), match/switch 1 (4 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.
Snapshot::blocks (cognitive 29) agent/src/session/content/reader.rs:810— Snapshot::blocks has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (3 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.
Snapshot::batch_summaries (cognitive 23) agent/src/session/content/reader_summary.rs:33— Snapshot::batch_summaries has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, 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.
Snapshot::capture (cognitive 22) orchestration/fusion/src/files.rs:33— Snapshot::capture has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 7 (10 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.
Snapshot::verify_existing_intent (cognitive 21) agent/src/session/content/reader_intent.rs:7— Snapshot::verify_existing_intent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 2 (3 pts), match/switch 1 (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.
Snapshot::summary (cognitive 19) agent/src/session/content/reader_summary.rs:187— Snapshot::summary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (19 pts) (nesting depth added 11). 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.
Snapshot::search (cognitive 17) agent/src/session/content/reader_recall.rs:148— Snapshot::search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 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.
Snapshot::column (cognitive 16) agent/src/session/content/reader.rs:748— Snapshot::column has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×11
Edited copy of a member (11 corresponding lines) host/src/shadow_review/repository.rs:21— host/src/shadow_review/repository.rs:21-31 | packages/config/src/lib.rs:41-52 — 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) cli/src/browser/chromium/cdp_connection.rs:330— cli/src/browser/chromium/cdp_connection.rs:330-351 | cli/src/browser/chromium/cdp_connection.rs:404-414 — 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) cli/src/commands/task.rs:496— cli/src/commands/task.rs:496-507 | host/src/tasks/service.rs:203-213 — 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) host/src/agent_bridge/queries.rs:762— host/src/agent_bridge/queries.rs:762-772 | host/src/agent_bridge/queries.rs:791-801 — 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) host/src/store/deletions.rs:74— host/src/store/deletions.rs:74-84 | host/src/store/threads.rs:937-951 — 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) agent/src/agent/run_loop.rs:2016— agent/src/agent/run_loop.rs:2016-2026 | agent/src/agent/run_loop.rs:2036-2046 — 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) host/src/remote/supervisor/state.rs:16— host/src/remote/supervisor/state.rs:16-40 | host/src/remote_peer/host.rs:33-43 — 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) cli/src/browser/chromium/chromium_session.rs:340— cli/src/browser/chromium/chromium_session.rs:340-358 | cli/src/browser/chromium/chromium_page.rs:366-376 — 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) REDACTED:244— REDACTED:244-264 | REDACTED:543-553 — 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) packages/rpc/src/decode.rs:598— packages/rpc/src/decode.rs:598-608 | packages/rpc/src/encode.rs:382-392 — 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) agent/src/compaction/mod.rs:497— agent/src/compaction/mod.rs:497-507 | agent/src/rpc/commands/session_title.rs:173-184 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×11
Edited copy of a member (14 corresponding lines) agent/src/session/content/recovery.rs:558— agent/src/session/content/recovery.rs:558-571 | agent/src/session/sqlite_store/transcript.rs:10-24 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) channels/src/providers/mattermost.rs:572— channels/src/providers/mattermost.rs:572-585 | channels/src/providers/slack.rs:793-809 — 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) tui/src/components/chat_area.rs:1610— tui/src/components/chat_area.rs:1610-1625 | tui/src/components/chat_area.rs:1748-1761 — 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) packages/rpc/src/decode.rs:532— packages/rpc/src/decode.rs:532-545 | packages/rpc/src/encode.rs:273-286 — 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) agent/src/rpc/mod.rs:42— agent/src/rpc/mod.rs:42-55 | packages/rpc/src/decode.rs:610-627 — 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) desktop/src-tauri/src/commands/runs.rs:4— desktop/src-tauri/src/commands/runs.rs:4-17 | desktop/src-tauri/src/commands/threads.rs:38-51 — 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) tui/src/components/chat_area.rs:1767— tui/src/components/chat_area.rs:1767-1788 | tui/src/components/chat_area.rs:1790-1803 — 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) host/src/git_history.rs:526— host/src/git_history.rs:526-539 | tui/src/workbench/diff_review.rs:141-154 — 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) cli/src/commands/configure.rs:650— cli/src/commands/configure.rs:650-663 | cli/src/commands/configure.rs:794-807 — 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) packages/app-workspaces/src/lib.rs:213— packages/app-workspaces/src/lib.rs:213-226 | packages/app-workspaces/src/lib.rs:230-243 — 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) host/src/store/threads.rs:332— host/src/store/threads.rs:332-345 | host/src/store/threads.rs:407-420 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×11
Edited copy of a member (12 corresponding lines) tui/src/workbench/live.rs:4183— tui/src/workbench/live.rs:4183-4194 | tui/src/workbench/live.rs:4374-4385 — 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) host/src/agent_bridge/import.rs:24— host/src/agent_bridge/import.rs:24-35 | host/src/shadow_review/load.rs:20-35 — 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) tui/src/components/input.rs:997— tui/src/components/input.rs:997-1011 | tui/src/components/input.rs:1013-1024 — 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) channels/src/transport/cipher.rs:154— channels/src/transport/cipher.rs:154-165 | channels/src/transport/cipher.rs:167-179 — 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) desktop/src-tauri/src/commands/ipc_harness.rs:42— desktop/src-tauri/src/commands/ipc_harness.rs:42-53 | desktop/src-tauri/src/commands/ipc_harness.rs:65-76 — 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) tui/src/workbench/live.rs:816— tui/src/workbench/live.rs:816-827 | tui/src/workbench/live.rs:860-876 — 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) tui/src/rpc/grpc_client.rs:473— tui/src/rpc/grpc_client.rs:473-488 | tui/src/rpc/grpc_client.rs:491-502 — 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) packages/remote-crypto/src/lib.rs:92— packages/remote-crypto/src/lib.rs:92-103 | packages/remote-crypto/src/lib.rs:104-115 — 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) tui/src/workbench/launchpad.rs:116— tui/src/workbench/launchpad.rs:116-127 | tui/src/workbench/live.rs:5018-5030 — 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) channels/src/grpc_client.rs:441— channels/src/grpc_client.rs:441-452 | orchestration/goal/src/agent_client.rs:466-478 — 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) channels/src/grpc_client.rs:455— channels/src/grpc_client.rs:455-466 | orchestration/goal/src/agent_client.rs:251-262 — 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.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×11
Edited copy of a member (6 corresponding lines) host/src/store/deletions.rs:48— host/src/store/deletions.rs:48-55 | REDACTED:732-737 — 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) tui/src/components/chat_area.rs:4087— tui/src/components/chat_area.rs:4087-4092 | tui/src/components/markdown.rs:2019-2024 — 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) channels/src/providers/irc.rs:759— channels/src/providers/irc.rs:759-768 | channels/src/providers/email.rs:543-548 — 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) host/src/remote_host/business/mod.rs:232— host/src/remote_host/business/mod.rs:232-237 | host/src/remote_host/business/terminal.rs:263-268 — 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) desktop/src-tauri/src/terminal/server.rs:678— desktop/src-tauri/src/terminal/server.rs:678-683 | tui/src/workbench/layout.rs:324-330 — 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) channels/src/providers/email.rs:1472— channels/src/providers/email.rs:1472-1477 | channels/src/providers/irc.rs:384-389 — 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) channels/src/providers/email.rs:398— channels/src/providers/email.rs:398-403 | channels/src/providers/irc.rs:335-340 — 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) channels/src/providers/wecom.rs:369— channels/src/providers/wecom.rs:369-374 | packages/remote-client/src/runtime.rs:959-966 — 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) cli/src/commands/tools.rs:176— cli/src/commands/tools.rs:176-181 | orchestration/goal/src/quota/slot_accounting.rs:102-108 — 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) cli/src/utils/time.rs:9— cli/src/utils/time.rs:9-14 | orchestration/goal/src/state.rs:1641-1646 — 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) agent/src/skills/manager.rs:39— agent/src/skills/manager.rs:39-44 | channels/src/bridge/dedup.rs:89-95 — 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.
AC2 · Forms & labels· <Select> field component without a label · ×10
<Select> field component without a label desktop/src/components/layout/OnboardingGate.tsx:302— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/components/layout/OnboardingGate.tsx:318— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/settings/EnvironmentPage.tsx:72— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/settings/GeneralPage.tsx:60— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/settings/GeneralPage.tsx:77— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/settings/GeneralPage.tsx:100— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/settings/GeneralPage.tsx:117— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/settings/GeneralPage.tsx:140— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/tasks/TasksView.tsx:596— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label desktop/src/features/tasks/TasksView.tsx:708— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AXH1 · Runtime security headers· Runtime security header not set · ×10
Runtime security header not set: content-security-policy — The live app's responses did not include content-security-policy (restricts the sources a page may load — mitigates XSS/injection). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: cross-origin-embedder-policy — The live app's responses did not include cross-origin-embedder-policy (recommended by the OWASP Secure Headers Project (value: require-corp)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: cross-origin-opener-policy — The live app's responses did not include cross-origin-opener-policy (recommended by the OWASP Secure Headers Project (value: same-origin)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: cross-origin-resource-policy — The live app's responses did not include cross-origin-resource-policy (recommended by the OWASP Secure Headers Project (value: same-origin)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: permissions-policy — The live app's responses did not include permissions-policy (restricts powerful browser features (camera, geolocation, …)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: referrer-policy — The live app's responses did not include referrer-policy (limits referrer leakage to third parties). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: strict-transport-security — The live app's responses did not include strict-transport-security (forces HTTPS on subsequent requests — mitigates downgrade/MITM). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: x-dns-prefetch-control — The live app's responses did not include x-dns-prefetch-control (recommended by the OWASP Secure Headers Project (value: off)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: x-frame-options — The live app's responses did not include x-frame-options (blocks clickjacking via framing (or use CSP frame-ancestors)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
Runtime security header not set: x-permitted-cross-domain-policies — The live app's responses did not include x-permitted-cross-domain-policies (recommended by the OWASP Secure Headers Project (value: none)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×9
Edited copy of a member (5 corresponding lines) host/src/agent_bridge/persist.rs:435— host/src/agent_bridge/persist.rs:435-439 | REDACTED:1219-1223 — 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) orchestration/fusion/src/store.rs:154— orchestration/fusion/src/store.rs:154-158 | orchestration/fusion/src/store.rs:161-172 — 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) REDACTED:134— REDACTED:134-138 | REDACTED:140-144 — 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) host/src/fusion/resilience.rs:203— host/src/fusion/resilience.rs:203-207 | host/src/fusion/resilience.rs:208-215 — 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) agent/src/session/content/stream_body.rs:34— agent/src/session/content/stream_body.rs:34-41 | agent/src/session/content/stream_body.rs:104-108 — 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) agent/src/session/content/compress.rs:58— agent/src/session/content/compress.rs:58-62 | agent/src/session/journal_compaction.rs:105-109 — 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) channels/src/providers/email.rs:2616— channels/src/providers/email.rs:2616-2622 | channels/src/providers/signal.rs:493-497 — 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) scripts/perf/remote-commands/scale/build_scale_data.py:53— scripts/perf/remote-commands/scale/build_scale_data.py:53-63 | scripts/perf/remote-commands/scale/run_scale_sweep.py:44-48 — 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) scripts/measure/mutation/analyze-queue.py:30— scripts/measure/mutation/analyze-queue.py:30-35 | scripts/measure/mutation/verify-attribution.py:38-42 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 2) agent/src/session/persistence.rs:437— agent/src/session/persistence.rs:437-450 | agent/src/session/persistence.rs:475-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/persistence.rs:437` it does not close everything it opens, so those exact lines 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) channels/src/feishu/feishu_rest.rs:228— channels/src/feishu/feishu_rest.rs:228-241 | channels/src/feishu/feishu_rest.rs:269-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/feishu_rest.rs:228` it begins part-way through the construct above it, so those exact lines 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) channels/src/providers/linq.rs:768— channels/src/providers/linq.rs:768-781 | channels/src/providers/whatsapp.rs:778-792 — before extracting anything, compare `channels/src/providers/linq.rs` and `channels/src/providers/whatsapp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/linq.rs:768` it begins part-way through the construct above it, so those exact lines 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) channels/src/providers/telegram.rs:392— channels/src/providers/telegram.rs:392-405 | channels/src/providers/telegram.rs:411-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/telegram.rs:392` it begins part-way through the construct above it, so those 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) cli/src/commands/session_history.rs:56— cli/src/commands/session_history.rs:56-69 | cli/src/commands/session_transcript.rs:154-167 — before extracting anything, compare `cli/src/commands/session_history.rs` and `cli/src/commands/session_transcript.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/session_history.rs:56` it does not close everything it opens, so those 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) cli/src/commands/tools.rs:591— cli/src/commands/tools.rs:591-604 | cli/src/commands/tools.rs:648-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/tools.rs:591` it does not close everything it opens, so those exact lines 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) host/src/agent_bridge/observer.rs:1142— host/src/agent_bridge/observer.rs:1142-1155 | host/src/agent_bridge/observer.rs:1346-1359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_bridge/observer.rs:1142` it begins part-way through the construct above it, so those exact lines 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) tui/src/stdin_buffer.rs:242— tui/src/stdin_buffer.rs:242-255 | tui/src/stdin_buffer.rs:272-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/stdin_buffer.rs:242` it begins part-way through the construct above it, so those 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) packages/remote-server/src/commands.rs:488— packages/remote-server/src/commands.rs:488-501 | packages/remote-server/src/commands.rs:713-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. Read the line range as the matched WINDOW rather than a finished unit: at `packages/remote-server/src/commands.rs:488` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ServerSession::prompt_internal (cognitive 137) agent/src/rpc/session_prompt.rs:796— ServerSession::prompt_internal has cognitive complexity 137 (threshold 15). Drivers by points: if/else 85 (114 pts), boolean chains 12, match/switch 9 (11 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.
ServerSession::enqueue_prompt_with_model_context (cognitive 49) agent/src/rpc/session_prompt.rs:255— ServerSession::enqueue_prompt_with_model_context has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (39 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerSession::compact_with_policy (cognitive 47) agent/src/rpc/session.rs:1260— ServerSession::compact_with_policy has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (41 pts), match/switch 4 (5 pts), boolean chains 1 (nesting depth added 22). 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.
ServerSession::restore_session (cognitive 45) agent/src/rpc/session.rs:2154— ServerSession::restore_session has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (42 pts), match/switch 1 (3 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.
ServerSession::replay_cost_split (cognitive 22) agent/src/rpc/session.rs:1964— ServerSession::replay_cost_split has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (4 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.
ServerSession::execute_shell_at (cognitive 21) agent/src/rpc/session.rs:1768— ServerSession::execute_shell_at has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 2, loops 2 (nesting depth added 10). Of this number, 18 points are the body's own statements and 3 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.
ServerSession::on_scheduled_run_finished (cognitive 19) agent/src/rpc/session.rs:518— ServerSession::on_scheduled_run_finished has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (4 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.
ServerSession::start_next_scheduled_at (cognitive 19) agent/src/rpc/session_prompt.rs:616— ServerSession::start_next_scheduled_at has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Workbench::handle_overlay_key (cognitive 94) tui/src/workbench/mod.rs:2475— Workbench::handle_overlay_key has cognitive complexity 94 (threshold 15). Drivers by points: if/else 23 (56 pts), match/switch 14 (32 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Workbench::handle_surface_mouse (cognitive 82) tui/src/workbench/mod.rs:3541— Workbench::handle_surface_mouse has cognitive complexity 82 (threshold 15). Drivers by points: if/else 31 (73 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 46). 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.
Workbench::handle_key (cognitive 47) tui/src/workbench/mod.rs:1404— Workbench::handle_key has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (36 pts), match/switch 4 (6 pts), boolean chains 5 (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.
Workbench::click (cognitive 43) tui/src/workbench/mod.rs:3862— Workbench::click has cognitive complexity 43 (threshold 15). Drivers by points: if/else 30 (40 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.
Workbench::handle_workflow_key (cognitive 31) tui/src/workbench/mod.rs:3129— Workbench::handle_workflow_key has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, match/switch 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Workbench::handle_mouse (cognitive 27) tui/src/workbench/mod.rs:3417— Workbench::handle_mouse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 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.
Workbench::handle_git_key (cognitive 19) tui/src/workbench/mod.rs:2949— Workbench::handle_git_key has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (7 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.
Workbench::submit_draft (cognitive 18) tui/src/workbench/mod.rs:4299— Workbench::submit_draft has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (2 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.
futureos::agent_supervisor::spawn_agent_watchdog (cognitive 27) desktop/src-tauri/src/agent_supervisor.rs:74— futureos::agent_supervisor::spawn_agent_watchdog has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 1, loops 1, 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.
futureos::commands::update::install_app_update_inner (cognitive 26) desktop/src-tauri/src/commands/update.rs:1768— futureos::commands::update::install_app_update_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 5, match/switch 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.
futureos::commands::update_linux::worker (cognitive 26) desktop/src-tauri/src/commands/update_linux.rs:118— futureos::commands::update_linux::worker has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 7, 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.
futureos::gui::set_windows_taskbar_icon (cognitive 22) REDACTED:278— futureos::gui::set_windows_taskbar_icon has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 1, match/switch 1 (nesting depth added 6). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (find_best_entry, hicon_from_ico_entry). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
futureos::skills_bootstrap::drain_skill_events (cognitive 19) desktop/src-tauri/src/skills_bootstrap.rs:41— futureos::skills_bootstrap::drain_skill_events has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, 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.
futureos::commands::update_journal::confirm_startup (cognitive 16) desktop/src-tauri/src/commands/update_journal.rs:250— futureos::commands::update_journal::confirm_startup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
futureos::gui::gui_builder (cognitive 16) REDACTED:875— futureos::gui::gui_builder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
futureos::linux_power::listen (cognitive 16) desktop/src-tauri/src/linux_power.rs:21— futureos::linux_power::listen has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 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.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×7
Modal dialog does not manage focus desktop/src/components/ui/Dialog.tsx:33— This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus desktop/src/features/agent/composer/ChoicePopover.tsx:73— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus desktop/src/features/palette/CommandPalette.tsx:134— This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus desktop/src/features/palette/ShortcutCheatSheet.tsx:54— This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus desktop/src/features/remote-peer/RemoteUsageDialog.tsx:37— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus desktop/src/features/settings/SettingsDialog.tsx:132— This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus desktop/src/features/vibe/AddToVibeDialog.tsx:122— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Workbench::handle_overlay_key (cyclomatic 95) tui/src/workbench/mod.rs:2475— Workbench::handle_overlay_key has cyclomatic complexity 95 (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.
Workbench::handle_key (cyclomatic 71) tui/src/workbench/mod.rs:1404— Workbench::handle_key has cyclomatic complexity 71 (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.
Workbench::handle_surface_mouse (cyclomatic 52) tui/src/workbench/mod.rs:3541— Workbench::handle_surface_mouse has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Workbench::handle_workflow_key (cyclomatic 37) tui/src/workbench/mod.rs:3129— Workbench::handle_workflow_key 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.
Workbench::handle_git_key (cyclomatic 32) tui/src/workbench/mod.rs:2949— Workbench::handle_git_key has cyclomatic complexity 32 (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.
Workbench::click (cyclomatic 32) tui/src/workbench/mod.rs:3862— Workbench::click 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.
Workbench::handle_mouse (cyclomatic 18) tui/src/workbench/mod.rs:3417— Workbench::handle_mouse 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.
future_remote_server::commands::command_loop_with_ready (cognitive 153) packages/remote-server/src/commands.rs:458— future_remote_server::commands::command_loop_with_ready has cognitive complexity 153 (threshold 15). Drivers by points: if/else 29 (123 pts), match/switch 5 (25 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 115). 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.
future_remote_server::wire_limits::truncated_event_data (cognitive 51) packages/remote-server/src/wire_limits.rs:243— future_remote_server::wire_limits::truncated_event_data has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (35 pts), loops 5 (14 pts), boolean chains 2 (nesting depth added 33). 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.
future_remote_server::lean::lean_entries (cognitive 45) packages/remote-server/src/lean.rs:557— future_remote_server::lean::lean_entries has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (37 pts), loops 2 (4 pts), match/switch 1 (4 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.
future_remote_server::commands::handle_command_inner (cognitive 27) packages/remote-server/src/commands.rs:861— future_remote_server::commands::handle_command_inner has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 3, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_remote_server::lean::lean_replay_page (cognitive 23) packages/remote-server/src/lean.rs:444— future_remote_server::lean::lean_replay_page has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (5 pts), 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.
future_remote_server::wire_limits::cap_remote_item (cognitive 21) packages/remote-server/src/wire_limits.rs:363— future_remote_server::wire_limits::cap_remote_item has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 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.
future_remote_server::wire_limits::truncate_message_content (cognitive 17) packages/remote-server/src/wire_limits.rs:323— future_remote_server::wire_limits::truncate_message_content has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change-coupling hub: TasksSettingsPage.tsx → REDACTED, REDACTED, REDACTED, kernel.rs mobile/src/features/settings/TasksSettingsPage.tsx— `mobile/src/features/settings/TasksSettingsPage.tsx` changes together with 4 other files — `desktop/src-tauri/src/commands/tasks.rs`, `desktop/src-tauri/src/tasks.rs`, `REDACTED`, `orchestration/tasks/src/kernel.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: locales.ts → REDACTED, transfer.rs, REDACTED, ChatScreen.tsx, SettingsScreen.tsx, TasksSettingsPage.tsx, taskTypes.ts, types.ts, DesktopsScreen.tsx, SessionsScreen.tsx, kernel.rs mobile/src/i18n/locales.ts— `mobile/src/i18n/locales.ts` changes together with 11 other files — `desktop/src-tauri/src/commands/tasks.rs`, `host/src/remote/transfer.rs`, `REDACTED`, `mobile/src/features/chat/ChatScreen.tsx`, `mobile/src/features/settings/SettingsScreen.tsx`, `mobile/src/features/settings/TasksSettingsPage.tsx`, `mobile/src/remote/taskTypes.ts`, `mobile/src/remote/types.ts`, `mobile/src/screens/DesktopsScreen.tsx`, `mobile/src/screens/SessionsScreen.tsx`, `orchestration/tasks/src/kernel.rs` — none of which declares a dependency on it: one file is the hub of 11 separate couplings, not 11 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 11.
Change-coupling hub: REDACTED → ProvidersPage.tsx, files.ts, threads.ts REDACTED— `REDACTED` changes together with 3 other files — `desktop/src/features/settings/ProvidersPage.tsx`, `desktop/src/integrations/storage/files.ts`, `desktop/src/integrations/storage/threads.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: taskTypes.ts → task.rs, help.rs, REDACTED, REDACTED, REDACTED, data.ts, kernel.rs mobile/src/remote/taskTypes.ts— `mobile/src/remote/taskTypes.ts` changes together with 7 other files — `cli/src/commands/task.rs`, `cli/src/help.rs`, `desktop/src-tauri/src/commands/tasks.rs`, `desktop/src-tauri/src/tasks.rs`, `REDACTED`, `mobile/shot/mock/data.ts`, `orchestration/tasks/src/kernel.rs` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 7.
Change-coupling hub: useTasks.ts → task.rs, backend.ts, data.ts, REDACTED, REDACTED, kernel.rs desktop/src/features/tasks/useTasks.ts— `desktop/src/features/tasks/useTasks.ts` changes together with 6 other files — `cli/src/commands/task.rs`, `desktop/shot/mock/backend.ts`, `desktop/shot/mock/data.ts`, `desktop/src-tauri/src/tasks.rs`, `REDACTED`, `orchestration/tasks/src/kernel.rs` — none of which declares a dependency on it: one file is the hub of 6 separate couplings, not 6 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 6.
Change-coupling hub: RemoteContext.tsx → transfer.rs, mod.rs, useConversationController.ts mobile/src/remote/RemoteContext.tsx— `mobile/src/remote/RemoteContext.tsx` changes together with 3 other files — `host/src/remote/transfer.rs`, `host/src/remote_host/business/mod.rs`, `mobile/src/remote/useConversationController.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: data.ts → REDACTED, REDACTED, kernel.rs desktop/shot/mock/data.ts— `desktop/shot/mock/data.ts` changes together with 3 other files — `desktop/src-tauri/src/commands/tasks.rs`, `desktop/src-tauri/src/tasks.rs`, `orchestration/tasks/src/kernel.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.
Duplicated block (13 lines × 2) agent/src/agent/run_loop.rs:487— agent/src/agent/run_loop.rs:487-499 | agent/src/agent/run_loop.rs:765-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 `agent/src/agent/run_loop.rs:487` it begins part-way through the construct above it, so those exact lines 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) agent/src/rpc/broadcaster/replay.rs:95— agent/src/rpc/broadcaster/replay.rs:95-107 | agent/src/rpc/broadcaster/replay.rs:339-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/broadcaster/replay.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/rpc/broadcaster/replay.rs:335` calls `then`, `capture`, `clone` and `agent/src/rpc/broadcaster/replay.rs:94` 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) agent/src/rpc/session.rs:572— agent/src/rpc/session.rs:572-584 | agent/src/rpc/session_prompt.rs:512-524 — 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 (13 lines × 2) agent/src/session/content/reader.rs:540— agent/src/session/content/reader.rs:540-552 | agent/src/session/content/reader.rs:659-671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/content/reader.rs:540` 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) cli/src/commands/desktop.rs:104— cli/src/commands/desktop.rs:104-116 | cli/src/commands/settings.rs:194-206 — before extracting anything, compare `cli/src/commands/desktop.rs` and `cli/src/commands/settings.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) cli/src/commands/remote.rs:404— cli/src/commands/remote.rs:404-416 | cli/src/commands/remote_peers.rs:286-298 — before extracting anything, compare `cli/src/commands/remote.rs` and `cli/src/commands/remote_peers.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. If that is what happened, the fix is to keep one copy and have the 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 (13 lines × 2) host/src/agent_providers/validate.rs:270— host/src/agent_providers/validate.rs:270-282 | host/src/agent_providers/write.rs:83-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 both call sites, so a change lands once.
Focus outline removed inline desktop/src/components/layout/ConversationSearch.tsx:97— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/features/agent/MentionEditor.tsx:1039— <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/features/agent/SendQueuePanel.tsx:302— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/features/agent/search/ThreadSearch.tsx:267— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/features/palette/CommandPalette.tsx:142— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline desktop/src/features/remote-peer/RemoteComposer.tsx:1486— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
future_channel::feishu::prompt_loop::run_prompt_loop (cyclomatic 86) channels/src/feishu/prompt_loop.rs:29— future_channel::feishu::prompt_loop::run_prompt_loop has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
future_channel::dingtalk::bridge::run_prompt_loop (cyclomatic 29) channels/src/dingtalk/bridge.rs:425— future_channel::dingtalk::bridge::run_prompt_loop 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.
future_channel::providers::discord::run_gateway (cyclomatic 27) channels/src/providers/discord.rs:621— future_channel::providers::discord::run_gateway 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.
future_channel::providers::qq::run_gateway (cyclomatic 27) channels/src/providers/qq.rs:588— future_channel::providers::qq::run_gateway 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.
future_channel::bridge::turn::run_turn (cyclomatic 26) channels/src/bridge/turn.rs:50— future_channel::bridge::turn::run_turn 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.
future_channel::feishu::feishu_ws::is_bot_mentioned (cyclomatic 17) channels/src/feishu/feishu_ws.rs:481— future_channel::feishu::feishu_ws::is_bot_mentioned has cyclomatic complexity 17 (threshold 15). Of this number, 14 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.
SqliteStore::recover_segmented_run (cyclomatic 43) agent/src/session/content/recovery.rs:231— SqliteStore::recover_segmented_run 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.
SqliteStore::reclaim_settled_journals (cyclomatic 41) REDACTED:688— SqliteStore::reclaim_settled_journals 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.
SqliteStore::import_legacy_cancellable (cyclomatic 38) agent/src/session/legacy_import.rs:205— SqliteStore::import_legacy_cancellable 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.
SqliteStore::compact_run_cancellable (cyclomatic 32) agent/src/session/journal_compaction.rs:566— SqliteStore::compact_run_cancellable 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.
SqliteStore::publish_segmented_metadata (cyclomatic 17) agent/src/session/content/metadata.rs:129— SqliteStore::publish_segmented_metadata 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.
SqliteStore::append_stream_entry (cyclomatic 17) agent/src/session/content/stream_entry.rs:173— SqliteStore::append_stream_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.
No assertions: accepts full nightly, test, and plain release versions scripts/tests/updater-signature.test.mjs:19— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: measures authenticated record roundtrips for %i-byte payloads packages/remote-crypto/tests/secureChannel.perf.test.ts:7— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: does not report an unobserved rejection when nothing awaits the catalogue desktop/src/integrations/skills/skillsClient.test.ts:78— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: prefetch and revalidate tolerate nulls and swallow rejections desktop/src/integrations/agent/agentStateCache.test.ts:258— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: ignores malformed payloads desktop/src/integrations/agent/agentStateCache.test.ts:312— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: clears pending cooldown and render work on unmount desktop/src/features/agent/useMessagePagingHook.test.ts:565— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
Supervisor::catalog_loop (cognitive 127) packages/remote-server/src/supervisor/publisher.rs:363— Supervisor::catalog_loop has cognitive complexity 127 (threshold 15). Drivers by points: if/else 23 (91 pts), match/switch 4 (20 pts), loops 3 (9 pts), boolean chains 7 (nesting depth added 90). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Supervisor::spawn_credential_refresh (cognitive 70) packages/remote-server/src/supervisor/transport.rs:147— Supervisor::spawn_credential_refresh has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (58 pts), match/switch 3 (6 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Supervisor::start_generation (cognitive 25) packages/remote-server/src/supervisor/start.rs:182— Supervisor::start_generation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, match/switch 3 (4 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.
Supervisor::publish_event (cognitive 20) packages/remote-server/src/supervisor/publisher.rs:103— Supervisor::publish_event has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 1 (2 pts), boolean chains 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.
Supervisor::start_slot (cognitive 19) packages/remote-server/src/supervisor/start.rs:551— Supervisor::start_slot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), match/switch 3 (4 pts), boolean chains 3 (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.
Supervisor::watch_generation (cognitive 19) packages/remote-server/src/supervisor/start.rs:1074— Supervisor::watch_generation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 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.
ChatArea::format_tool_call (cognitive 32) tui/src/components/chat_area.rs:3827— ChatArea::format_tool_call has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 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.
ChatArea::render_assistant_message (cognitive 20) tui/src/components/chat_area.rs:3333— ChatArea::render_assistant_message has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, loops 1, 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.
ChatArea::render_system_message (cognitive 20) tui/src/components/chat_area.rs:3975— ChatArea::render_system_message has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (9 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.
ChatArea::fold_reply_segment (cognitive 18) tui/src/components/chat_area.rs:2429— ChatArea::fold_reply_segment has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, loops 2, match/switch 1 (2 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatArea::layout (cognitive 18) tui/src/components/chat_area.rs:2568— ChatArea::layout has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (3 pts), 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.
ChatArea::render_pictures (cognitive 16) tui/src/components/chat_area.rs:3277— ChatArea::render_pictures has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TooManyFields: Workbench tui/src/workbench/mod.rs:647— TooManyFields — 69 stored fields beside 104 methods. The bar is 30 stored fields; this is 39 over it, 2.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Live tui/src/workbench/live.rs:166— TooManyFields — 67 stored fields beside 156 methods. The bar is 30 stored fields; this is 37 over it, 2.23× 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: ServerSession agent/src/rpc/session.rs:93— TooManyFields — 53 stored fields beside 83 methods. The bar is 30 stored fields; this is 23 over it, 1.77× 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: RpcCommand agent/src/rpc/protocol.rs:8— TooManyFields — 52 stored fields. The bar is 30 stored fields; this is 22 over it, 1.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Supervisor packages/remote-server/src/supervisor.rs:99— TooManyFields — 38 stored fields beside 118 methods. The bar is 30 stored fields; this is 8 over it, 1.27× 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: GetStatePayload packages/rpc/src/payloads.rs:18— TooManyFields — 37 stored fields. The bar is 30 stored fields; this is 7 over it, 1.23× 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· Edited copy of a member (16 corresponding lines) · ×6
Edited copy of a member (16 corresponding lines) agent/src/session/persistence.rs:436— agent/src/session/persistence.rs:436-470 | agent/src/session/persistence.rs:474-498 — 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) host/src/agent_bridge/queries.rs:966— host/src/agent_bridge/queries.rs:966-987 | host/src/agent_bridge/queries.rs:1006-1021 — 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) host/src/agent_bridge/config_observer.rs:40— host/src/agent_bridge/config_observer.rs:40-56 | host/src/agent_bridge/session_events.rs:51-66 — 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) channels/src/providers/linq.rs:661— channels/src/providers/linq.rs:661-678 | channels/src/providers/signal.rs:864-879 — 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) cli/src/browser/chromium/chromium_manager.rs:15— cli/src/browser/chromium/chromium_manager.rs:15-30 | cli/src/browser/safari/safari_manager.rs:401-417 — 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) channels/src/providers/wecom.rs:350— channels/src/providers/wecom.rs:350-366 | channels/src/providers/whatsapp.rs:424-439 — 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 (18 corresponding lines) · ×6
Edited copy of a member (18 corresponding lines) agent/src/rpc/approval/shape.rs:309— agent/src/rpc/approval/shape.rs:309-329 | packages/rpc/src/tool_arguments.rs:87-107 — 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) channels/src/providers/imessage.rs:145— channels/src/providers/imessage.rs:145-162 | channels/src/providers/imessage.rs:182-199 — 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) packages/rpc/src/decode.rs:692— packages/rpc/src/decode.rs:692-709 | packages/rpc/src/encode.rs:643-660 — 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) tui/src/components/chat_area.rs:641— tui/src/components/chat_area.rs:641-659 | tui/src/terminal_image.rs:276-293 — 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) agent/src/runtime/scheduler_queue.rs:229— agent/src/runtime/scheduler_queue.rs:229-246 | agent/src/runtime/scheduler_queue.rs:259-278 — 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) agent/src/runtime/run_state.rs:330— agent/src/runtime/run_state.rs:330-347 | agent/src/runtime/run_state.rs:349-370 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×6
Edited copy of a member (13 corresponding lines) host/src/remote_host/pairing.rs:577— host/src/remote_host/pairing.rs:577-589 | host/src/remote_host/pairing.rs:793-806 — 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) tui/src/rpc/grpc_client.rs:577— tui/src/rpc/grpc_client.rs:577-589 | tui/src/rpc/grpc_client.rs:911-923 — 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) agent/src/config/providers.rs:392— agent/src/config/providers.rs:392-404 | host/src/auth_store.rs:71-88 — 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) tui/src/components/chat_area.rs:971— tui/src/components/chat_area.rs:971-983 | tui/src/components/diff.rs:549-561 — 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) agent/src/rpc/protocol.rs:242— agent/src/rpc/protocol.rs:242-254 | agent/src/rpc/protocol.rs:262-274 — 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) packages/app-workspaces/src/lib.rs:175— packages/app-workspaces/src/lib.rs:175-197 | host/src/store/paging.rs:418-430 — 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.
Duplicated block (6 lines × 3) cli/src/relay/room.rs:574— cli/src/relay/room.rs:574-579 | cli/src/relay/server.rs:575-580 | packages/remote-client/src/runtime.rs:3499-3504 — 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) packages/remote-server/src/diagnostics.rs:7— packages/remote-server/src/diagnostics.rs:7-12 | packages/remote-server/src/health.rs:230-235 | packages/remote-server/src/supervisor.rs:1227-1232 — 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) REDACTED:284— REDACTED:284-293 | REDACTED:332-342 | REDACTED:350-355 — 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 `REDACTED:284` 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 × 3) host/src/future_login.rs:202— host/src/future_login.rs:202-208 | host/src/future_login.rs:261-266 | host/src/future_login.rs:513-519 — 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 `host/src/future_login.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.
Duplicated block (6 lines × 3) agent/src/session/content/reader.rs:323— agent/src/session/content/reader.rs:323-328 | agent/src/session/content/reader.rs:358-363 | agent/src/session/content/reader.rs:427-432 — 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 `agent/src/session/content/reader.rs:323` it does not close everything it opens, so those exact lines 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) scripts/perf/remote-commands/scale/summarize_scaling.py:338— scripts/perf/remote-commands/scale/summarize_scaling.py:338-348 | scripts/perf/remote-commands/scale/summarize_scaling.py:377-382 | scripts/perf/remote-commands/scale/summarize_scaling.py:396-402 — 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.
R6 · Tooling· This package's lint script runs in no CI job · ×6
This package's lint script runs in no CI job desktop/package.json:10— The package in `desktop` declares the lint script `lint` (`eslint "src/**/*.{ts,tsx}" "shot/**/*.{ts,tsx}" "vite.shot.config.ts" && npm run typecheck`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `desktop` (or the workspace's task runner).
This package's lint script runs in no CI job mobile/package.json:77— The package in `mobile` declares the lint script `lint` (`eslint .`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `mobile` (or the workspace's task runner).
This package's lint script runs in no CI job packages/remote-client/package.json:104— The package in `packages/remote-client` declares the lint script `lint` (`eslint src tests`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `packages/remote-client` (or the workspace's task runner).
This package's lint script runs in no CI job packages/remote-crypto/package.json:22— The package in `packages/remote-crypto` declares the lint script `lint` (`eslint src tests vitest.config.ts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `packages/remote-crypto` (or the workspace's task runner).
This package's lint script runs in no CI job packages/remote-protocol/package.json:22— The package in `packages/remote-protocol` declares the lint script `lint` (`eslint src tests vitest.config.ts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `packages/remote-protocol` (or the workspace's task runner).
This package's lint script runs in no CI job tests/remote-interop/package.json:11— The package in `tests/remote-interop` declares the lint script `lint` (`eslint src-ts scripts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `tests/remote-interop` (or the workspace's task runner).
Supervisor::catalog_loop (cyclomatic 40) packages/remote-server/src/supervisor/publisher.rs:363— Supervisor::catalog_loop 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.
Supervisor::spawn_credential_refresh (cyclomatic 31) packages/remote-server/src/supervisor/transport.rs:147— Supervisor::spawn_credential_refresh 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.
Supervisor::start_generation (cyclomatic 20) packages/remote-server/src/supervisor/start.rs:182— Supervisor::start_generation 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.
Supervisor::stopped_status (cyclomatic 20) packages/remote-server/src/supervisor/status.rs:431— Supervisor::stopped_status 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.
Supervisor::start_slot (cyclomatic 17) packages/remote-server/src/supervisor/start.rs:551— Supervisor::start_slot 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.
Input::handle_key (cognitive 84) tui/src/components/input.rs:522— Input::handle_key has cognitive complexity 84 (threshold 15). Drivers by points: if/else 44 (63 pts), boolean chains 15, loops 2 (6 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.
Input::move_word_backwards (cognitive 23) tui/src/components/input.rs:1147— Input::move_word_backwards has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (7 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. This shape REPEATS in the file: one other method here (Input::move_word_forwards) 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.
Input::move_word_forwards (cognitive 23) tui/src/components/input.rs:1186— Input::move_word_forwards has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (7 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. This shape REPEATS in the file: one other method here (Input::move_word_backwards) 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.
Input::build_visual_layout (cognitive 18) tui/src/components/input.rs:736— Input::build_visual_layout has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 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.
Input::render_cursor_in_line (cognitive 16) tui/src/components/input.rs:1245— Input::render_cursor_in_line has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 2, loops 2, 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.
MarkdownRenderer::render_block (cognitive 40) tui/src/components/markdown.rs:1340— MarkdownRenderer::render_block has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 6 (15 pts), boolean chains 5, 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.
MarkdownRenderer::render_table (cognitive 38) tui/src/components/markdown.rs:1738— MarkdownRenderer::render_table has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 11 (17 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MarkdownRenderer::render_impl (cognitive 20) tui/src/components/markdown.rs:1178— MarkdownRenderer::render_impl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 6 (9 pts), boolean chains 2 (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.
MarkdownRenderer::render_list (cognitive 19) tui/src/components/markdown.rs:1585— MarkdownRenderer::render_list 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.
MarkdownRenderer::render_list_item (cognitive 18) tui/src/components/markdown.rs:1644— MarkdownRenderer::render_list_item has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 11). 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.
Manager::create_segmented_fork (cognitive 33) agent/src/session/manager/fork.rs:44— Manager::create_segmented_fork has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 4 (9 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.
Manager::fork_source_entries (cognitive 21) agent/src/session/manager/fork.rs:219— Manager::fork_source_entries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (7 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.
Manager::summary_from_session (cognitive 21) agent/src/session/summary.rs:36— Manager::summary_from_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Manager::read_history_entry (cognitive 19) agent/src/session/history/recall.rs:228— Manager::read_history_entry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, match/switch 1 (2 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.
Manager::claim_compaction (cognitive 18) agent/src/session/compaction_ops.rs:32— Manager::claim_compaction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (18 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TooManyFunctions: future_tui::paste tui/src/paste.rs:53— 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: future_host::application::threads host/src/application/threads.rs:5— 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: future_tui::skills_cli tui/src/skills_cli.rs:71— TooManyFunctions — 37 free functions. The bar is 30 free functions; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: futureos::commands::threads desktop/src-tauri/src/commands/threads.rs:3— 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: future_host::agent_commands host/src/agent_commands.rs:40— 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×5
Members sharing a duplicated core (4 members, 50+ identical tokens) agent/src/session/entry.rs:115— agent/src/session/entry.rs:115-129 | agent/src/session/entry.rs:170-184 | agent/src/session/entry.rs:192-210 | agent/src/session/entry.rs:237-268 — 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) agent/src/session/sqlite_store/transcript.rs:206— agent/src/session/sqlite_store/transcript.rs:206-241 | orchestration/fusion/src/store.rs:434-440 | orchestration/fusion/src/store.rs:449-458 | orchestration/fusion/src/store.rs:485-494 — 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) REDACTED:333— REDACTED:333-389 | REDACTED:402-435 | REDACTED:441-480 | REDACTED:1678-1708 — 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) host/src/tasks/service.rs:271— host/src/tasks/service.rs:271-339 | host/src/tasks/service.rs:341-357 | host/src/tasks/service.rs:359-373 | host/src/tasks/service.rs:378-393 — 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) tui/src/workbench/git_panel.rs:509— tui/src/workbench/git_panel.rs:509-557 | tui/src/workbench/git_panel.rs:584-638 | tui/src/workbench/git_panel.rs:754-794 | tui/src/workbench/git_panel.rs:829-858 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×5
Edited copy of a member (42 corresponding lines) channels/src/providers/linq.rs:743— channels/src/providers/linq.rs:743-784 | channels/src/providers/whatsapp.rs:745-795 — 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) cli/src/commands/archive.rs:133— cli/src/commands/archive.rs:133-174 | cli/src/commands/archive.rs:177-224 — 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) cli/src/commands/session.rs:1101— cli/src/commands/session.rs:1101-1142 | cli/src/commands/session.rs:1235-1283 — 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) channels/src/providers/telegram.rs:295— channels/src/providers/telegram.rs:295-336 | channels/src/providers/telegram.rs:380-428 — 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) agent/src/rpc/mod.rs:798— agent/src/rpc/mod.rs:798-842 | REDACTED:375-416 — 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 (23 corresponding lines) · ×5
Edited copy of a member (23 corresponding lines) host/src/remote/relay.rs:207— host/src/remote/relay.rs:207-229 | host/src/remote/relay.rs:254-277 — 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) agent/src/session/content/fork.rs:140— agent/src/session/content/fork.rs:140-162 | agent/src/session/content/reset.rs:235-261 — 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) channels/src/providers/qq.rs:292— channels/src/providers/qq.rs:292-314 | channels/src/providers/slack.rs:247-269 — 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) host/src/agent_bridge/run_control.rs:325— host/src/agent_bridge/run_control.rs:325-347 | host/src/agent_bridge/run_control.rs:377-408 — 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) agent/src/llm/mod.rs:171— agent/src/llm/mod.rs:171-194 | agent/src/llm/mod.rs:204-226 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×5
Edited copy of a member (19 corresponding lines) cli/src/headless/agent.rs:193— cli/src/headless/agent.rs:193-211 | desktop/src-tauri/src/agent_host.rs:17-35 — 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) tui/src/index.rs:516— tui/src/index.rs:516-534 | tui/src/index.rs:541-559 — 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) cli/src/commands/skills.rs:357— cli/src/commands/skills.rs:357-375 | cli/src/commands/skills.rs:444-467 — 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) agent/src/sandbox/paths.rs:49— agent/src/sandbox/paths.rs:49-68 | orchestration/goal/src/agents/workspace_guard.rs:39-57 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) REDACTED:122— REDACTED:122-149 | REDACTED:233-251 — 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.
Duplicated block (20 lines × 2) agent/src/rpc/session_prompt.rs:1071— agent/src/rpc/session_prompt.rs:1071-1090 | agent/src/rpc/session_prompt.rs:2057-2076 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/session_prompt.rs:1071` it begins part-way through the construct above it, so those 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 (20 lines × 2) agent/src/runtime/scheduler_queue.rs:461— agent/src/runtime/scheduler_queue.rs:461-480 | agent/src/runtime/scheduler_queue.rs:621-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/runtime/scheduler_queue.rs:461` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) tui/src/skills_cli.rs:675— tui/src/skills_cli.rs:675-694 | tui/src/subprocess.rs:55-74 — before extracting anything, compare `tui/src/skills_cli.rs` and `tui/src/subprocess.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 `tui/src/skills_cli.rs:675` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) agent/src/llm/adapters/openai_responses.rs:202— agent/src/llm/adapters/openai_responses.rs:202-221 | agent/src/llm/adapters/openai_responses.rs:227-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/llm/adapters/openai_responses.rs:202` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 2) agent/src/sandbox/windows/process.rs:328— agent/src/sandbox/windows/process.rs:328-347 | agent/src/sandbox/windows/token.rs:203-222 — 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 `agent/src/sandbox/windows/process.rs:328` 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–10 lines × 2) agent/src/session/projection.rs:116— agent/src/session/projection.rs:116-125 | agent/src/types/mod.rs:1231-1239 — 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 `agent/src/session/projection.rs:116` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) cli/src/commands/browser_tools.rs:792— cli/src/commands/browser_tools.rs:792-801 | cli/src/commands/browser_tools.rs:824-832 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/browser_tools.rs:792` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9–10 lines × 2) cli/src/commands/model_settings.rs:520— cli/src/commands/model_settings.rs:520-529 | cli/src/commands/model_settings.rs:675-683 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/model_settings.rs:520` it begins part-way through the construct above it, so those 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 (9–10 lines × 2) desktop/src-tauri/src/commands/update.rs:503— desktop/src-tauri/src/commands/update.rs:503-511 | desktop/src-tauri/src/commands/update.rs:1785-1794 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `desktop/src-tauri/src/commands/update.rs:503` it begins part-way through the construct above it, so those 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–10 lines × 2) host/src/store/paging.rs:234— host/src/store/paging.rs:234-243 | host/src/store/paging.rs:402-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/store/paging.rs:234` it begins part-way through the construct above it, so those exact lines 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) channels/src/dingtalk/dingtalk_ws.rs:169— channels/src/dingtalk/dingtalk_ws.rs:169-175 | channels/src/dingtalk/dingtalk_ws.rs:186-192 | channels/src/dingtalk/dingtalk_ws.rs:202-208 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channels/src/dingtalk/dingtalk_ws.rs:201` calls `dispatch_bot_callback` and `channels/src/dingtalk/dingtalk_ws.rs:167` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) cli/src/relay/room.rs:348— cli/src/relay/room.rs:348-354 | cli/src/relay/room.rs:411-417 | cli/src/relay/room.rs:455-461 — 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 `cli/src/relay/room.rs:348` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `cli/src/relay/room.rs:345` calls `valid_identifier`, `Err` and `cli/src/relay/room.rs:410` 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) REDACTED:428— REDACTED:428-434 | REDACTED:456-462 | REDACTED:495-501 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:428` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) cli/src/commands/session_control.rs:121— cli/src/commands/session_control.rs:121-127 | cli/src/commands/session_history.rs:81-87 | cli/src/commands/session_transcript.rs:195-204 — before extracting anything, compare `cli/src/commands/session_history.rs` and `cli/src/commands/session_transcript.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/session_control.rs:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) host/src/agent_bridge/delete_outbox.rs:136— host/src/agent_bridge/delete_outbox.rs:136-142 | host/src/agent_bridge/observer.rs:425-431 | host/src/agent_bridge/reconciliation.rs:1051-1057 — 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. 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.
Low cohesion: Raw (LCOM4 6) cli/src/prompt.rs:117— Raw'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: WhatsappConfig (LCOM4 5) channels/src/providers/whatsapp.rs:96— WhatsappConfig'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: LinqConfig (LCOM4 4) channels/src/providers/linq.rs:103— LinqConfig's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WecomConfig (LCOM4 4) channels/src/providers/wecom.rs:101— WecomConfig's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ExecutionReport (LCOM4 4) orchestration/fusion/src/resilience.rs:118— ExecutionReport's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
R10 · Code Duplication· Duplicated block with local edits (29 matched lines × 2 locations) · ×5
Duplicated block with local edits (29 matched lines × 2 locations) desktop/src/components/layout/ActivityRailMenus.tsx:219— desktop/src/components/layout/ActivityRailMenus.tsx:219 · desktop/src/components/layout/ActivityRailMenus.tsx:320 — the two spans are one implementation copied and then locally edited — 165 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (29 matched lines × 2 locations) desktop/src/features/agent/ThinkingBlock.tsx:53— desktop/src/features/agent/ThinkingBlock.tsx:53 · mobile/src/features/chat/messages/ThinkingRow.tsx:55 — the two spans are one implementation copied and then locally edited — 214 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (29 matched lines × 2 locations) desktop/src/features/git-history/LaneGraph.tsx:58— desktop/src/features/git-history/LaneGraph.tsx:58 · mobile/src/features/chat/components/GitGraphPanel.tsx:292 — the two spans are one implementation copied and then locally edited — 155 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (29 matched lines × 2 locations) mobile/src/features/chat/components/SessionPicker.tsx:49— mobile/src/features/chat/components/SessionPicker.tsx:49 · mobile/src/features/chat/components/SkillPicker.tsx:70 — the two spans are one implementation copied and then locally edited — 298 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (29 matched lines × 2 locations) packages/markdown/src/remarkLatexMath.ts:8— packages/markdown/src/remarkLatexMath.ts:8 · packages/markdown/src/remarkMathFence.ts:8 — the two spans are one implementation copied and then locally edited — 188 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Dead file (~11 LoC) scripts/screenshots/injects/choice-card-v2-pill-text.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~11 LoC) scripts/screenshots/injects/choice-card-v2-popover.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~11 LoC) scripts/screenshots/injects/running-dot.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~11 LoC) scripts/screenshots/injects/running-ring.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~11 LoC) scripts/screenshots/injects/running-spinner.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
ServerSession::prompt_internal (cyclomatic 98) agent/src/rpc/session_prompt.rs:796— ServerSession::prompt_internal has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ServerSession::enqueue_prompt_with_model_context (cyclomatic 32) agent/src/rpc/session_prompt.rs:255— ServerSession::enqueue_prompt_with_model_context 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.
ServerSession::compact_with_policy (cyclomatic 25) agent/src/rpc/session.rs:1260— ServerSession::compact_with_policy 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.
ServerSession::restore_session (cyclomatic 22) agent/src/rpc/session.rs:2154— ServerSession::restore_session 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.
Client::stream_model (cognitive 86) agent/src/llm/mod.rs:435— Client::stream_model has cognitive complexity 86 (threshold 15). Drivers by points: if/else 20 (53 pts), loops 9 (19 pts), match/switch 7 (14 pts) (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Client::spawn_supervisor (cognitive 24) packages/remote-client/src/runtime.rs:2351— Client::spawn_supervisor has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client::spawn_event_stream_capped::handle_push (cognitive 24) packages/remote-client/src/runtime.rs:2595— Client::spawn_event_stream_capped::handle_push has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 3, match/switch 1 (2 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.
Client::connect_attempt (cognitive 19) packages/remote-client/src/runtime.rs:1771— Client::connect_attempt has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 4 (5 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.
Live::command (cognitive 64) tui/src/workbench/live.rs:2414— Live::command has cognitive complexity 64 (threshold 15). Drivers by points: if/else 21 (41 pts), match/switch 8 (19 pts), loops 1 (3 pts), boolean chains 1 (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.
Live::handle_event (cognitive 28) tui/src/workbench/live.rs:1148— Live::handle_event has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 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.
Live::new_session (cognitive 28) tui/src/workbench/live.rs:3586— Live::new_session has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), match/switch 2 (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.
Live::flush_submit (cognitive 18) tui/src/workbench/live.rs:2287— Live::flush_submit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1, 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.
EvidenceContext::observe (cognitive 37) agent/src/approval_review/evidence.rs:155— EvidenceContext::observe has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 4 (7 pts), 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.
EvidenceContext::action_context (cognitive 32) agent/src/approval_review/evidence.rs:431— EvidenceContext::action_context has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EvidenceContext::select_evidence (cognitive 19) agent/src/approval_review/evidence.rs:337— EvidenceContext::select_evidence has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 6, 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.
EvidenceContext::from_history (cognitive 17) agent/src/approval_review/evidence.rs:112— EvidenceContext::from_history has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 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.
SkillManager::install_locked (cognitive 21) agent/src/skills/manager.rs:504— SkillManager::install_locked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillManager::reconcile (cognitive 20) agent/src/skills/manager.rs:669— SkillManager::reconcile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillManager::sync_inner (cognitive 18) agent/src/skills/manager.rs:457— SkillManager::sync_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 2 (5 pts), boolean chains 4, 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.
SkillManager::recover (cognitive 17) agent/src/skills/manager.rs:628— SkillManager::recover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×4
REDACTED
REDACTED
REDACTED
REDACTED
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×4
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×4
Edited copy of a member (39 corresponding lines) agent/src/session/database/mod.rs:285— agent/src/session/database/mod.rs:285-333 | agent/src/session/database/readers.rs:101-139 — 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) packages/rpc/src/decode.rs:547— packages/rpc/src/decode.rs:547-585 | packages/rpc/src/encode.rs:324-362 — 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) cli/src/commands/desktop.rs:175— cli/src/commands/desktop.rs:175-213 | cli/src/commands/settings.rs:234-277 — 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) scripts/docs/generate_models.py:140— scripts/docs/generate_models.py:140-178 | scripts/docs/generate_models.py:182-224 — 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 (25 corresponding lines) · ×4
Edited copy of a member (25 corresponding lines) packages/remote-client/src/runtime.rs:3257— packages/remote-client/src/runtime.rs:3257-3281 | packages/remote-client/src/runtime.rs:3426-3457 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) agent/src/rpc/commands/run_control.rs:119— agent/src/rpc/commands/run_control.rs:119-143 | agent/src/rpc/commands/run_control.rs:219-251 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) REDACTED:606— REDACTED:606-632 | REDACTED:634-658 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) scripts/screenshots/capture.py:1096— scripts/screenshots/capture.py:1096-1125 | scripts/screenshots/capture.py:1329-1353 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×4
Edited copy of a member (17 corresponding lines) host/src/store/threads.rs:1167— host/src/store/threads.rs:1167-1185 | REDACTED:554-570 — 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) agent/src/models/future.rs:340— agent/src/models/future.rs:340-356 | host/src/future_platform.rs:36-57 — 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) tui/src/paste.rs:121— tui/src/paste.rs:121-137 | tui/src/paste.rs:197-213 — 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) host/src/store/markdown_refs/resolve.rs:255— host/src/store/markdown_refs/resolve.rs:255-271 | host/src/store/review_snapshots.rs:323-341 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (18 lines × 2) REDACTED:610— REDACTED:610-627 | REDACTED:637-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 (18 lines × 2) cli/src/commands/archive.rs:178— cli/src/commands/archive.rs:178-195 | cli/src/commands/pin.rs:139-156 — 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 `cli/src/commands/archive.rs:178` it does not close everything it opens, so those exact lines 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) host/src/git_history.rs:546— host/src/git_history.rs:546-563 | tui/src/workbench/git_panel.rs:208-225 — before extracting anything, compare `host/src/git_history.rs` and `tui/src/workbench/git_panel.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 207 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 `host/src/git_history.rs:546` it begins part-way through the construct above it, so those exact lines 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) agent/src/sandbox/windows/acl.rs:62— agent/src/sandbox/windows/acl.rs:62-79 | agent/src/sandbox/windows/acl.rs:158-175 — both copies are in the same file, so extract the 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) agent/src/rpc/approval.rs:199— agent/src/rpc/approval.rs:199-215 | agent/src/rpc/approval.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 `agent/src/rpc/approval.rs:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) agent/src/rpc/approval/shape.rs:310— agent/src/rpc/approval/shape.rs:310-326 | packages/rpc/src/tool_arguments.rs:88-104 — 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) cli/src/commands/desktop.rs:176— cli/src/commands/desktop.rs:176-192 | cli/src/commands/settings.rs:235-251 — before extracting anything, compare `cli/src/commands/desktop.rs` and `cli/src/commands/settings.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) host/src/future_login.rs:201— host/src/future_login.rs:201-217 | host/src/future_login.rs:512-528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/future_login.rs:201` it begins part-way through the construct above it, so those 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–12 lines × 2) agent/src/runtime/scheduler_queue.rs:424— agent/src/runtime/scheduler_queue.rs:424-435 | agent/src/runtime/scheduler_queue.rs:604-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/runtime/scheduler_queue.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 (11–12 lines × 2) channels/src/feishu/prompt_loop.rs:260— channels/src/feishu/prompt_loop.rs:260-270 | channels/src/feishu/prompt_loop.rs:306-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 `channels/src/feishu/prompt_loop.rs:306` it does not close everything it opens, so those 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) cli/src/browser/chromium/chromium_session.rs:940— cli/src/browser/chromium/chromium_session.rs:940-950 | cli/src/browser/chromium/chromium_session.rs:964-975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/browser/chromium/chromium_session.rs:940` it begins part-way through the construct above it, so those exact lines 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) tui/src/components/chat_area.rs:1615— tui/src/components/chat_area.rs:1615-1625 | tui/src/components/chat_area.rs:1750-1761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/chat_area.rs:1615` it begins part-way through the construct above it, so those exact lines 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) agent/src/config/providers.rs:393— agent/src/config/providers.rs:393-403 | host/src/auth_store.rs:75-84 — 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.
Duplicated block (10–11 lines × 2) agent/src/session/content/reader.rs:405— agent/src/session/content/reader.rs:405-414 | agent/src/session/content/reader.rs:844-854 — both copies are in the same file, so extract the 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–11 lines × 2) cli/src/commands/model_settings.rs:537— cli/src/commands/model_settings.rs:537-547 | cli/src/commands/model_settings.rs:685-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.
Duplicated block (10–11 lines × 2) scripts/screenshots/capture.py:776— scripts/screenshots/capture.py:776-785 | scripts/screenshots/capture.py:889-899 — both copies are in the same file, so extract the 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, `scripts/screenshots/capture.py:774` calls `ffmpeg_path` and `scripts/screenshots/capture.py:888` 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 × 3) agent/src/rpc/mod.rs:46— agent/src/rpc/mod.rs:46-53 | packages/rpc/src/decode.rs:618-625 | packages/rpc/src/encode.rs:400-407 — before extracting anything, compare `packages/rpc/src/decode.rs` and `packages/rpc/src/encode.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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `&proto::ReplayEvent` in one and `&ReplayEventPayload` 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, `packages/rpc/src/encode.rs:408` calls `event_payload` and `agent/src/rpc/mod.rs:54` 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 × 3) cli/src/commands/session_compact.rs:36— cli/src/commands/session_compact.rs:36-43 | cli/src/commands/session_history.rs:57-64 | cli/src/commands/session_transcript.rs:155-162 — before extracting anything, compare `cli/src/commands/session_history.rs` and `cli/src/commands/session_transcript.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/session_compact.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. 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) REDACTED:328— REDACTED:328-335 | REDACTED:346-353 | REDACTED:359-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:328` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) cli/src/commands/session.rs:429— cli/src/commands/session.rs:429-436 | cli/src/commands/skills.rs:347-354 | tui/src/index.rs:752-759 — 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 (5 lines × 3) cli/src/commands/session_history.rs:147— cli/src/commands/session_history.rs:147-151 | cli/src/commands/session_prune.rs:349-353 | cli/src/commands/session_transcript.rs:1088-1092 — before extracting anything, compare `cli/src/commands/session_history.rs` and `cli/src/commands/session_transcript.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/commands/session_history.rs:147` it begins part-way through the construct above it, so those exact lines 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) tui/src/utils.rs:68— tui/src/utils.rs:68-72 | tui/src/utils.rs:75-79 | tui/src/utils.rs:135-139 — 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) host/src/agent_bridge/import.rs:26— host/src/agent_bridge/import.rs:26-31 | host/src/shadow_review/repository.rs:24-28 | packages/config/src/lib.rs:45-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_bridge/import.rs:26` it begins part-way through the construct above it, so those 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 (5 lines × 3) agent/src/session/fork.rs:237— agent/src/session/fork.rs:237-241 | agent/src/session/fork.rs:244-248 | agent/src/session/fork.rs:259-263 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `agent/src/session/fork.rs:241` calls `filter`, `is_empty` and `agent/src/session/fork.rs:255` 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.
Dead file (~10 LoC) scripts/screenshots/injects/choice-card-r-chosen.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~10 LoC) scripts/screenshots/injects/qn-state-down.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~10 LoC) scripts/screenshots/injects/qn-state-up.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~10 LoC) scripts/screenshots/injects/user-bubble-border-on.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~6 LoC) harness/mobile-client/shims/expo-device.mjs— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~6 LoC) scripts/screenshots/injects/choice-card-a-free-row.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~6 LoC) scripts/screenshots/injects/choice-card-a-numbers.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~6 LoC) scripts/screenshots/injects/choice-card-c-pills.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
AC3 · Page structure· Page without a main landmark · ×3
Page without a main landmark desktop/scripts/storage-read-benchmark.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark desktop/scripts/streaming-markdown-benchmark.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark host/web/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×3
Animation without a prefers-reduced-motion guard desktop/src/components/layout/RailRow.tsx:284— <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard desktop/src/features/agent/MessageBlock.tsx:545— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard desktop/src/styles/globals.css:187— `.animate-pop-in` moves (`animation: pop-in 0.24s ease-out both`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Loop::run_streaming_inner (cyclomatic 163) agent/src/agent/run_loop.rs:248— Loop::run_streaming_inner has cyclomatic complexity 163 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Loop::execute_tools_sequential (cyclomatic 22) agent/src/agent/mod.rs:308— Loop::execute_tools_sequential 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.
Loop::execute_one_tool_with_context (cyclomatic 21) agent/src/agent/mod.rs:495— Loop::execute_one_tool_with_context 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.
future_remote_server::commands::command_loop_with_ready (cyclomatic 37) packages/remote-server/src/commands.rs:458— future_remote_server::commands::command_loop_with_ready 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.
future_remote_server::commands::handle_command_inner (cyclomatic 24) packages/remote-server/src/commands.rs:861— future_remote_server::commands::handle_command_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.
future_remote_server::wire_limits::truncated_event_data (cyclomatic 17) packages/remote-server/src/wire_limits.rs:243— future_remote_server::wire_limits::truncated_event_data 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.
Snapshot::page_impl (cyclomatic 30) agent/src/session/content/reader.rs:300— Snapshot::page_impl 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.
Snapshot::query (cyclomatic 19) orchestration/fusion/src/files.rs:255— Snapshot::query 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.
Snapshot::entry_impl (cyclomatic 17) agent/src/session/content/reader.rs:570— Snapshot::entry_impl 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.
Loop::run_streaming_inner (cognitive 400) agent/src/agent/run_loop.rs:248— Loop::run_streaming_inner has cognitive complexity 400 (threshold 15). Drivers by points: if/else 124 (327 pts), loops 12 (29 pts), match/switch 8 (26 pts), boolean chains 18 (nesting depth added 238). 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.
Loop::execute_tools_sequential (cognitive 44) agent/src/agent/mod.rs:308— Loop::execute_tools_sequential has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 2 (3 pts), match/switch 2 (3 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.
Loop::execute_one_tool_with_context (cognitive 39) agent/src/agent/mod.rs:495— Loop::execute_one_tool_with_context has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (33 pts), match/switch 3 (5 pts), 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.
MdParser::parse_block_start (cognitive 67) tui/src/components/markdown.rs:562— MdParser::parse_block_start has cognitive complexity 67 (threshold 15). Drivers by points: loops 10 (26 pts), match/switch 9 (25 pts), if/else 6 (14 pts), boolean chains 2 (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.
MdParser::parse_blocks (cognitive 26) tui/src/components/markdown.rs:461— MdParser::parse_blocks 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, 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.
MdParser::parse_inline_until (cognitive 20) tui/src/components/markdown.rs:827— MdParser::parse_inline_until has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (5 pts), match/switch 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.
Bridge::handle_slash_command (cognitive 63) channels/src/feishu/bridge.rs:525— Bridge::handle_slash_command has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (36 pts), match/switch 13 (27 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.
Bridge::handle_event (cognitive 43) channels/src/feishu/bridge.rs:160— Bridge::handle_event has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (29 pts), match/switch 8 (11 pts), boolean chains 3 (nesting depth added 9). 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.
Bridge::handle_card_action (cognitive 16) channels/src/feishu/bridge.rs:1115— Bridge::handle_card_action has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), match/switch 3 (4 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.
SseBroadcaster::broadcast_stamped (cognitive 49) agent/src/rpc/broadcaster/mod.rs:314— SseBroadcaster::broadcast_stamped has cognitive complexity 49 (threshold 15). Drivers by points: if/else 28 (36 pts), match/switch 4 (9 pts), boolean chains 4 (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.
SseBroadcaster::broadcast_with_ack (cognitive 22) agent/src/rpc/broadcaster/mod.rs:240— SseBroadcaster::broadcast_with_ack has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (4 pts), boolean chains 2 (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.
SseBroadcaster::uncaptured_run_snapshot (cognitive 16) agent/src/rpc/broadcaster/replay.rs:378— SseBroadcaster::uncaptured_run_snapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (16 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.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×3
Edited copy of a member (38 corresponding lines) channels/src/providers/email.rs:2624— channels/src/providers/email.rs:2624-2661 | channels/src/providers/irc.rs:1039-1091 — 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) cli/src/commands/remote.rs:109— cli/src/commands/remote.rs:109-146 | cli/src/commands/remote_peers.rs:77-121 — 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) cli/src/commands/configure.rs:824— cli/src/commands/configure.rs:824-861 | cli/src/commands/configure.rs:864-901 — 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 (29 corresponding lines) · ×3
Edited copy of a member (29 corresponding lines) host/src/future_login.rs:195— host/src/future_login.rs:195-227 | host/src/future_login.rs:506-534 — 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) REDACTED:472— REDACTED:472-501 | REDACTED:503-531 — 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) cli/src/commands/remote.rs:251— cli/src/commands/remote.rs:251-283 | cli/src/commands/remote_peers.rs:167-195 — 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 (22 corresponding lines) · ×3
Edited copy of a member (22 corresponding lines) channels/src/providers/email.rs:490— channels/src/providers/email.rs:490-511 | channels/src/providers/irc.rs:736-757 — 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) tui/src/components/markdown.rs:1258— tui/src/components/markdown.rs:1258-1279 | tui/src/components/markdown.rs:2048-2069 — 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) channels/src/providers/telegram.rs:430— channels/src/providers/telegram.rs:430-451 | channels/src/providers/telegram.rs:458-484 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×3
Edited copy of a member (28 corresponding lines) channels/src/dingtalk/bridge.rs:65— channels/src/dingtalk/bridge.rs:65-95 | channels/src/feishu/bridge.rs:130-157 — 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) REDACTED:83— REDACTED:83-110 | host/src/tasks/service.rs:114-142 — 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) scripts/screenshots/capture.py:766— scripts/screenshots/capture.py:766-793 | scripts/screenshots/capture.py:882-909 — 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 copies of one member (3 members, 12+ corresponding lines) · ×3
Edited copies of one member (3 members, 12+ corresponding lines) agent/src/session/journal_compaction.rs:212— agent/src/session/journal_compaction.rs:212-242 | agent/src/session/sqlite_store/events.rs:274-285 | agent/src/session/sqlite_store/events.rs:294-313 — 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.
Edited copies of one member (3 members, 12+ corresponding lines) tui/src/components/input.rs:1100— tui/src/components/input.rs:1100-1111 | tui/src/components/input.rs:1113-1128 | tui/src/components/input.rs:1130-1145 — 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.
Edited copies of one member (3 members, 12+ corresponding lines) channels/src/grpc_client.rs:395— channels/src/grpc_client.rs:395-406 | orchestration/goal/src/agent_client.rs:279-290 | tui/src/rpc/grpc_client.rs:553-564 — 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 copy of a member (21 corresponding lines) · ×3
Edited copy of a member (21 corresponding lines) host/src/agent_bridge/persist.rs:446— host/src/agent_bridge/persist.rs:446-468 | REDACTED:1228-1248 — 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) tui/src/workbench/live.rs:740— tui/src/workbench/live.rs:740-763 | tui/src/workbench/live.rs:4264-4284 — 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) agent/src/sandbox/windows/token.rs:254— agent/src/sandbox/windows/token.rs:254-280 | agent/src/sandbox/windows/token.rs:348-368 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×3
Edited copy of a member (20 corresponding lines) host/src/remote_host/pairing.rs:166— host/src/remote_host/pairing.rs:166-185 | packages/config/src/lib.rs:67-91 — 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) cli/src/rpc.rs:204— cli/src/rpc.rs:204-223 | cli/src/rpc.rs:235-254 — 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) scripts/measure/measure-lean-history.py:116— scripts/measure/measure-lean-history.py:116-138 | scripts/measure/verify-e2e-bytes.py:190-209 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×3
Edited copies of one member (3 members, 14+ corresponding lines) cli/src/commands/browser_tools.rs:911— cli/src/commands/browser_tools.rs:911-924 | cli/src/commands/browser_tools.rs:1049-1062 | cli/src/commands/browser_tools.rs:1096-1113 — 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) cli/src/browser/safari/webdriver_client.rs:170— cli/src/browser/safari/webdriver_client.rs:170-186 | cli/src/browser/safari/webdriver_client.rs:279-292 | cli/src/browser/safari/webdriver_client.rs:329-342 — 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) host/src/agent_bridge/queries.rs:292— host/src/agent_bridge/queries.rs:292-306 | host/src/agent_bridge/queries.rs:419-432 | host/src/agent_bridge/queries.rs:444-457 — 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, 7+ corresponding lines) · ×3
Edited copies of one member (3 members, 7+ corresponding lines) REDACTED:571— REDACTED:571-584 | REDACTED:586-592 | REDACTED:707-713 — 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) channels/src/cli_cmd.rs:279— channels/src/cli_cmd.rs:279-285 | cli/src/commands/mcp_servers.rs:1230-1236 | tui/src/workbench/local.rs:200-207 — 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) cli/src/commands/mcp_servers.rs:1040— cli/src/commands/mcp_servers.rs:1040-1046 | tui/src/workbench/editor.rs:99-105 | tui/src/workbench/state.rs:376-382 — 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 (4 corresponding lines) · ×3
Edited copy of a member (4 corresponding lines) tui/src/workbench/screen.rs:900— orchestration/goal/src/scheduler/state.rs:54-59 | tui/src/workbench/screen.rs:900-903 — 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) cli/src/relay/room.rs:103— cli/src/relay/room.rs:103-108 | host/src/remote/relay.rs:170-173 — 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) host/src/remote_host/pairing.rs:716— host/src/remote_host/pairing.rs:716-722 | packages/remote-protocol/src/invitation.rs:133-136 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (16 lines × 2) packages/rpc/src/decode.rs:694— packages/rpc/src/decode.rs:694-709 | packages/rpc/src/encode.rs:645-660 — before extracting anything, compare `packages/rpc/src/decode.rs` and `packages/rpc/src/encode.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. If that is what happened, the fix is to keep one copy and have the 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 `packages/rpc/src/decode.rs:694` 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 `model` to `&proto::ModelEntry` in one and `&crate::payloads_ext::ModelEntryPayload` 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 lines × 2) tui/src/components/markdown.rs:1262— tui/src/components/markdown.rs:1262-1277 | tui/src/components/markdown.rs:1290-1305 — both copies are in the same file, so extract the 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) agent/src/rpc/approval/shape.rs:331— agent/src/rpc/approval/shape.rs:331-346 | packages/rpc/src/tool_arguments.rs:109-124 — 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 (13–15 lines × 2) agent/src/session/history/display_index.rs:332— agent/src/session/history/display_index.rs:332-344 | agent/src/session/history/display_index.rs:397-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 `agent/src/session/history/display_index.rs:332` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–15 lines × 2) channels/src/providers/telegram.rs:301— channels/src/providers/telegram.rs:301-315 | channels/src/providers/telegram.rs:320-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/providers/telegram.rs:301` it begins part-way through the construct above it, so those 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–15 lines × 2) host/src/git_history.rs:766— host/src/git_history.rs:766-778 | tui/src/workbench/git_panel.rs:476-490 — before extracting anything, compare `host/src/git_history.rs` and `tui/src/workbench/git_panel.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 207 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 (7–8 lines × 2) agent/src/session/content/checkpoint.rs:156— agent/src/session/content/checkpoint.rs:156-162 | agent/src/session/content/checkpoint.rs:408-415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/content/checkpoint.rs:156` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. 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, `agent/src/session/content/checkpoint.rs:407` calls `query_row`, `get` and `agent/src/session/content/checkpoint.rs:155` 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–8 lines × 2) host/src/agent_bridge/import.rs:618— host/src/agent_bridge/import.rs:618-625 | host/src/agent_bridge/session.rs:405-411 — 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 `host/src/agent_bridge/import.rs:618` it does not close everything it opens, so those exact lines 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) host/src/agent_bridge/reconciliation.rs:215— host/src/agent_bridge/reconciliation.rs:215-222 | host/src/agent_bridge/reconciliation.rs:470-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.
Duplicated block (5 lines × 4) REDACTED:421— REDACTED:421-425 | REDACTED:478-482 | REDACTED:521-525 | REDACTED:534-538 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:421` 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 × 4) host/src/tasks/service.rs:272— host/src/tasks/service.rs:272-276 | host/src/tasks/service.rs:342-346 | host/src/tasks/service.rs:360-364 | host/src/tasks/service.rs:379-383 — 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 (5 lines × 4) channels/src/providers/linq.rs:737— channels/src/providers/linq.rs:737-741 | channels/src/providers/telegram.rs:812-816 | channels/src/providers/wecom.rs:582-586 | channels/src/providers/whatsapp.rs:739-743 — before extracting anything, compare `channels/src/providers/linq.rs` and `channels/src/providers/whatsapp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Outbound HTTP without resilience channels/src/tls.rs:12— `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience packages/http/src/lib.rs:27— `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience packages/http/src/lib.rs:44— `reqwest::blocking::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Dead file (~5 LoC) scripts/screenshots/injects/choice-card-a-empty.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~5 LoC) scripts/screenshots/injects/choice-card-b-compact.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~5 LoC) scripts/screenshots/injects/choice-card-m-sheet.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Live::command (cyclomatic 54) tui/src/workbench/live.rs:2414— Live::command has cyclomatic complexity 54 (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.
Live::handle_event (cyclomatic 33) tui/src/workbench/live.rs:1148— Live::handle_event 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. This is NOT this file's highest cyclomatic complexity: Live::apply (cyclomatic 46) 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.
RunClient::run (cyclomatic 53) cli/src/rpc.rs:1197— RunClient::run has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RunClient::stream_events_filtered (cyclomatic 18) cli/src/rpc.rs:1069— RunClient::stream_events_filtered 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.
MdParser::parse_block_start (cyclomatic 43) tui/src/components/markdown.rs:562— MdParser::parse_block_start has cyclomatic complexity 43 (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.
MdParser::parse_inline_until (cyclomatic 19) tui/src/components/markdown.rs:827— MdParser::parse_inline_until 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.
OpenAiResponsesAdapter::decode_frame (cyclomatic 34) agent/src/llm/adapters/openai_responses.rs:144— OpenAiResponsesAdapter::decode_frame 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.
OpenAiResponsesAdapter::build_body (cyclomatic 18) agent/src/llm/adapters/openai_responses.rs:58— OpenAiResponsesAdapter::build_body 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.
Client::stream_model (cyclomatic 34) agent/src/llm/mod.rs:435— Client::stream_model 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.
Client::spawn_event_stream_capped::handle_push (cyclomatic 22) packages/remote-client/src/runtime.rs:2595— Client::spawn_event_stream_capped::handle_push 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.
Bridge::handle_event (cyclomatic 33) channels/src/feishu/bridge.rs:160— Bridge::handle_event 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.
Bridge::handle_slash_command (cyclomatic 33) channels/src/feishu/bridge.rs:525— Bridge::handle_slash_command 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.
MarkdownRenderer::render_block (cyclomatic 30) tui/src/components/markdown.rs:1340— MarkdownRenderer::render_block has cyclomatic complexity 30 (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.
MarkdownRenderer::render_table (cyclomatic 24) tui/src/components/markdown.rs:1738— MarkdownRenderer::render_table 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.
futureos::commands::update_linux::worker (cyclomatic 26) desktop/src-tauri/src/commands/update_linux.rs:118— futureos::commands::update_linux::worker 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.
futureos::commands::update::install_app_update_inner (cyclomatic 21) desktop/src-tauri/src/commands/update.rs:1768— futureos::commands::update::install_app_update_inner 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.
FutureAgentService::stream_events (cyclomatic 25) agent/src/grpc/mod.rs:601— FutureAgentService::stream_events 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.
FutureAgentService::execute_command (cyclomatic 16) agent/src/grpc/mod.rs:255— FutureAgentService::execute_command 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.
TerminalServer::pump (cyclomatic 24) desktop/src-tauri/src/terminal/server.rs:445— TerminalServer::pump 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.
TerminalServer::handle (cyclomatic 18) desktop/src-tauri/src/terminal/server.rs:218— TerminalServer::handle 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.
ChatArea::fold_reply_segment (cyclomatic 18) tui/src/components/chat_area.rs:2429— ChatArea::fold_reply_segment 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.
ChatArea::render_assistant_message (cyclomatic 17) tui/src/components/chat_area.rs:3333— ChatArea::render_assistant_message 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.
RemoteComposer.RemoteComposer::pasteFiles (cyclomatic 16) desktop/src/features/remote-peer/RemoteComposer.tsx:594— RemoteComposer.RemoteComposer::pasteFiles has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (RemoteComposer.RemoteComposer, RemoteComposer.RemoteComposer::send) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
RemoteComposer.RemoteComposer::send (cyclomatic 16) desktop/src/features/remote-peer/RemoteComposer.tsx:965— RemoteComposer.RemoteComposer::send has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (RemoteComposer.RemoteComposer, RemoteComposer.RemoteComposer::pasteFiles) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
RunClient::run (cognitive 87) cli/src/rpc.rs:1197— RunClient::run has cognitive complexity 87 (threshold 15). Drivers by points: if/else 54 (82 pts), boolean chains 5 (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.
RunClient::stream_events_filtered (cognitive 34) cli/src/rpc.rs:1069— RunClient::stream_events_filtered has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (23 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
future_rpc::history::read_page_with (cognitive 47) packages/rpc/src/history.rs:247— future_rpc::history::read_page_with has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (37 pts), boolean chains 6, loops 2 (4 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.
future_rpc::connection::select_from (cognitive 20) packages/rpc/src/connection.rs:575— future_rpc::connection::select_from has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (3 pts) (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.
Scan::hash (cognitive 44) tui/src/workbench/syntax.rs:980— Scan::hash has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (33 pts), match/switch 3 (6 pts), boolean chains 5 (nesting depth added 21). 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.
Scan::number (cognitive 22) tui/src/workbench/syntax.rs:1281— Scan::number has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 1 (nesting depth added 11). 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.
DingtalkBridge::handle_slash_command (cognitive 43) channels/src/dingtalk/bridge.rs:179— DingtalkBridge::handle_slash_command has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (35 pts), match/switch 5 (8 pts) (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DingtalkBridge::handle_event (cognitive 16) channels/src/dingtalk/bridge.rs:97— DingtalkBridge::handle_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 2, 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.
CustomProviderDialog.CustomProviderDialog::handleSubmit (cognitive 43) desktop/src/features/settings/CustomProviderDialog.tsx:328— CustomProviderDialog.CustomProviderDialog::handleSubmit has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CustomProviderDialog.CustomProviderDialog::detectThinkingLevels) 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.
CustomProviderDialog.CustomProviderDialog::detectThinkingLevels (cognitive 20) desktop/src/features/settings/CustomProviderDialog.tsx:240— CustomProviderDialog.CustomProviderDialog::detectThinkingLevels has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (3 pts), boolean chains 1, loops 1, ternaries 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. This shape REPEATS in the file: one other method here (CustomProviderDialog.CustomProviderDialog::handleSubmit) 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.
FutureAgentService::stream_events (cognitive 34) agent/src/grpc/mod.rs:601— FutureAgentService::stream_events has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 5, loops 2 (3 pts), match/switch 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.
FutureAgentService::execute_command (cognitive 23) agent/src/grpc/mod.rs:255— FutureAgentService::execute_command has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 2, match/switch 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.
CustomProviderPage.CustomProviderPage::validate (cognitive 32) mobile/src/features/settings/CustomProviderPage.tsx:332— CustomProviderPage.CustomProviderPage::validate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 4, ternaries 2 (4 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. This shape REPEATS in the file: one other method here (CustomProviderPage.CustomProviderPage::detectThinkingLevels) 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.
CustomProviderPage.CustomProviderPage::detectThinkingLevels (cognitive 19) mobile/src/features/settings/CustomProviderPage.tsx:246— CustomProviderPage.CustomProviderPage::detectThinkingLevels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (3 pts), loops 1, ternaries 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. This shape REPEATS in the file: one other method here (CustomProviderPage.CustomProviderPage::validate) 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.
OpenAiResponsesAdapter::decode_frame (cognitive 29) agent/src/llm/adapters/openai_responses.rs:144— OpenAiResponsesAdapter::decode_frame has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAiResponsesAdapter::build_body (cognitive 18) agent/src/llm/adapters/openai_responses.rs:58— OpenAiResponsesAdapter::build_body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3, 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.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×2
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (49 corresponding lines) · ×2
Edited copy of a member (49 corresponding lines) cli/src/commands/doctor.rs:581— cli/src/commands/doctor.rs:581-629 | cli/src/commands/doctor.rs:631-683 — 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) agent/src/sandbox/windows/process.rs:319— agent/src/sandbox/windows/process.rs:319-367 | agent/src/sandbox/windows/token.rs:192-242 — 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 (31 corresponding lines) · ×2
Edited copy of a member (31 corresponding lines) tui/src/utils.rs:64— tui/src/utils.rs:64-97 | tui/src/utils.rs:124-154 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) channels/src/transport/webhook.rs:305— channels/src/transport/webhook.rs:305-335 | desktop/src-tauri/src/terminal/server.rs:824-854 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×2
Edited copy of a member (34 corresponding lines) packages/rpc/src/decode.rs:413— packages/rpc/src/decode.rs:413-451 | packages/rpc/src/encode.rs:132-165 — 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) channels/src/feishu/feishu_rest.rs:214— channels/src/feishu/feishu_rest.rs:214-249 | channels/src/feishu/feishu_rest.rs:257-290 — 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 (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) agent/src/models/mod.rs:1220— agent/src/models/mod.rs:1220-1251 | agent/src/models/mod.rs:1258-1287 — 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) agent/src/rpc/commands/settings.rs:537— agent/src/rpc/commands/settings.rs:537-566 | agent/src/rpc/commands/settings.rs:673-720 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×2
Edited copy of a member (26 corresponding lines) tui/src/skills_cli.rs:674— tui/src/skills_cli.rs:674-699 | tui/src/subprocess.rs:54-91 — 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) host/src/application/threads.rs:95— host/src/application/threads.rs:95-120 | host/src/application/threads.rs:124-150 — 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 (24 corresponding lines) · ×2
Edited copy of a member (24 corresponding lines) host/src/error.rs:76— host/src/error.rs:76-100 | host/src/error.rs:126-149 — 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) tui/src/terminal_posix.rs:299— tui/src/terminal_posix.rs:299-336 | tui/src/terminal_posix.rs:347-370 — 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 copies of one member (3 members, 20+ corresponding lines) · ×2
Edited copies of one member (3 members, 20+ corresponding lines) tui/src/paste.rs:332— orchestration/goal/src/webui/server.rs:217-236 | tui/src/paste.rs:332-351 | tui/src/workbench/links.rs:306-326 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 20+ corresponding lines) REDACTED:61— REDACTED:61-82 | REDACTED:153-172 | REDACTED:179-199 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) packages/remote-server/src/supervisor/shutdown.rs:62— packages/remote-server/src/supervisor/shutdown.rs:62-72 | packages/remote-server/src/supervisor/shutdown.rs:198-214 | packages/remote-server/src/supervisor/shutdown.rs:274-290 — 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) host/src/agent_bridge/models.rs:58— host/src/agent_bridge/models.rs:58-71 | host/src/agent_bridge/queries.rs:694-704 | host/src/agent_bridge/queries.rs:713-723 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×2
Edited copies of one member (3 members, 13+ corresponding lines) cli/src/commands/data.rs:247— cli/src/commands/data.rs:247-261 | desktop/src-tauri/src/commands/update_linux.rs:40-52 | host/src/remote_host/files.rs:466-478 — 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) agent/src/rpc/session.rs:1634— agent/src/rpc/session.rs:1634-1646 | agent/src/rpc/session.rs:1662-1684 | agent/src/rpc/session.rs:1714-1730 — 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, 6+ corresponding lines) · ×2
Edited copies of one member (3 members, 6+ corresponding lines) packages/rpc/src/decode.rs:115— packages/rpc/src/decode.rs:115-120 | packages/rpc/src/decode.rs:632-637 | packages/rpc/src/decode.rs:655-660 — 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) cli/src/browser/browser_state.rs:291— cli/src/browser/browser_state.rs:291-296 | cli/src/browser/selector.rs:152-157 | cli/src/commands/browser_tools.rs:1390-1395 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×2
Edited copies of one member (3 members, 10+ corresponding lines) host/src/agent_bridge/observer.rs:88— host/src/agent_bridge/observer.rs:88-97 | host/src/agent_bridge/reconciliation.rs:1050-1059 | host/src/agent_bridge/stream.rs:20-29 — 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) host/src/files.rs:48— host/src/files.rs:48-57 | host/src/remote_host/session_files.rs:143-152 | packages/app-workspaces/src/lib.rs:701-710 — 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.
Duplicated block (29 lines × 2) host/src/git_history.rs:587— host/src/git_history.rs:587-615 | tui/src/workbench/git_panel.rs:280-308 — before extracting anything, compare `host/src/git_history.rs` and `tui/src/workbench/git_panel.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 207 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 (29 lines × 2) scripts/measure/measure-lean-history.py:51— scripts/measure/measure-lean-history.py:51-79 | scripts/measure/verify-e2e-bytes.py:146-174 — 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 `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 (24 lines × 2) channels/src/feishu/bridge.rs:892— channels/src/feishu/bridge.rs:892-915 | channels/src/feishu/bridge.rs:974-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/bridge.rs:892` 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 (24 lines × 2) tui/src/utils.rs:896— tui/src/utils.rs:896-919 | tui/src/workbench/run.rs:1993-2016 — 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 (19 lines × 2) cli/src/browser/chromium/chromium_session.rs:641— cli/src/browser/chromium/chromium_session.rs:641-659 | cli/src/browser/chromium/chromium_session.rs:823-841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cli/src/browser/chromium/chromium_session.rs:641` it begins part-way through the construct above it, so those exact lines 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) REDACTED:473— REDACTED:473-491 | REDACTED:504-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED: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 (17–18 lines × 2) agent/src/rpc/approval.rs:218— agent/src/rpc/approval.rs:218-234 | agent/src/rpc/approval.rs:461-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/approval.rs:461` it begins part-way through the construct above it, so those 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 (17–18 lines × 2) packages/remote-client/src/runtime.rs:2168— packages/remote-client/src/runtime.rs:2168-2185 | packages/remote-client/src/runtime.rs:2280-2296 — both copies are in the same file, so extract the 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 × 3) cli/src/browser/chromium/chromium_page.rs:89— cli/src/browser/chromium/chromium_page.rs:89-103 | cli/src/browser/chromium/chromium_page.rs:133-147 | cli/src/browser/chromium/chromium_page.rs:229-243 — 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) cli/src/browser/chromium/chromium_session.rs:751— cli/src/browser/chromium/chromium_session.rs:751-765 | cli/src/browser/chromium/chromium_session.rs:772-786 | cli/src/browser/chromium/chromium_session.rs:795-809 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cli/src/browser/chromium/chromium_session.rs:771` calls `insert`, `into` and `cli/src/browser/chromium/chromium_session.rs:750` 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–14 lines × 2) channels/src/dingtalk/bridge.rs:477— channels/src/dingtalk/bridge.rs:477-487 | channels/src/feishu/prompt_loop.rs:147-160 — 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 `channels/src/dingtalk/bridge.rs:477` it does not close everything it opens, so those exact lines 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–14 lines × 2) channels/src/dingtalk/mod.rs:99— channels/src/dingtalk/mod.rs:99-109 | channels/src/feishu/mod.rs:71-84 — `channels/src/dingtalk/mod.rs` and `channels/src/feishu/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/dingtalk/mod.rs:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) REDACTED:709— REDACTED:709-721 | REDACTED:794-805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:709` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) desktop/src-tauri/src/commands/files.rs:169— desktop/src-tauri/src/commands/files.rs:169-181 | desktop/src-tauri/src/commands/remote.rs:162-173 — 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 (12 lines × 3) tui/src/workbench/git_panel.rs:537— tui/src/workbench/git_panel.rs:537-548 | tui/src/workbench/git_panel.rs:608-623 | tui/src/workbench/git_panel.rs:766-781 — 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 `tui/src/workbench/git_panel.rs:537` it does not close everything it opens, so those exact lines 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) cli/src/browser/chromium/chromium_console_hook.rs:80— cli/src/browser/chromium/chromium_console_hook.rs:80-91 | cli/src/browser/chromium/chromium_page.rs:280-291 | cli/src/browser/chromium/chromium_session.rs:183-194 — 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 `cli/src/browser/chromium/chromium_console_hook.rs:80` it begins part-way through the construct above it, so those exact lines 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) agent/src/session/entry.rs:120— agent/src/session/entry.rs:120-129 | agent/src/session/entry.rs:175-184 | agent/src/session/entry.rs:201-210 | agent/src/session/entry.rs:259-268 — 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 `agent/src/session/entry.rs:120` 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 × 4) REDACTED:378— REDACTED:378-387 | REDACTED:423-432 | REDACTED:469-478 | REDACTED:1697-1706 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:378` it begins part-way through the construct above it, so those exact lines 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) channels/src/feishu/feishu_rest.rs:142— channels/src/feishu/feishu_rest.rs:142-150 | channels/src/feishu/feishu_rest.rs:549-556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/feishu_rest.rs:142` it begins part-way through the construct above it, so those exact lines 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) scripts/compaction_experiment/harness.py:328— scripts/compaction_experiment/harness.py:328-336 | scripts/compaction_experiment/run_closed_book.py:561-568 — 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/compaction_experiment/run_closed_book.py:561` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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/compaction_experiment/run_closed_book.py:569` calls `normalize` and `scripts/compaction_experiment/harness.py:337` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) agent/src/session/content/checkpoint.rs:192— agent/src/session/content/checkpoint.rs:192-200 | agent/src/session/content/checkpoint.rs:457-465 | agent/src/session/content/metadata.rs:245-253 — 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 `agent/src/session/content/checkpoint.rs:192` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) cli/src/commands/doctor.rs:621— cli/src/commands/doctor.rs:621-629 | cli/src/commands/doctor.rs:675-683 | cli/src/commands/doctor.rs:729-737 — 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 `cli/src/commands/doctor.rs:621` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
R10 · Code Duplication· Duplicated block with local edits (72 matched lines × 2 locations) · ×2
Duplicated block with local edits (72 matched lines × 2 locations) desktop/src/features/review/GitChangesReview.tsx:39— desktop/src/features/review/GitChangesReview.tsx:39 · desktop/src/features/review/LastRunReview.tsx:99 — the two spans are one implementation copied and then locally edited — 271 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (72 matched lines × 2 locations) harness/lib/remote-live.mjs:343— harness/lib/remote-live.mjs:343 · harness/lib/remote-mobile-live.mjs:275 — the two spans are one implementation copied and then locally edited — 477 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (50 matched lines × 2 locations) · ×2
Duplicated block with local edits (50 matched lines × 2 locations) mobile/src/features/chat/messages/ReplyBlocks.tsx:249— mobile/src/features/chat/messages/ReplyBlocks.tsx:249 · mobile/src/features/chat/messages/ReplyBlocks.tsx:376 — the two spans are one implementation copied and then locally edited — 327 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (50 matched lines × 2 locations) mobile/src/remote/pendingContinuationStorage.ts:10— mobile/src/remote/pendingContinuationStorage.ts:10 · mobile/src/remote/pendingPromptStorage.ts:26 — the two spans are one implementation copied and then locally edited — 347 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (31 lines × 2 locations) desktop/src/components/layout/ActivityRailMenus.tsx:162— desktop/src/components/layout/ActivityRailMenus.tsx:162 · desktop/src/components/layout/ActivityRailMenus.tsx:270 — 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 (31 lines × 2 locations) desktop/src/features/remote-peer/peerGlyphs.ts:48— desktop/src/features/remote-peer/peerGlyphs.ts:48 · mobile/src/remote/peerGlyphs.ts:48 — the 2 copies are spread across 2 files, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents.
Duplicated block (27 lines × 2 locations) desktop/src/features/settings/AccountPage.tsx:139— desktop/src/features/settings/AccountPage.tsx:139 · desktop/src/features/settings/AccountPage.tsx:166 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (27 lines × 2 locations) mobile/src/features/chat/composer/ComposerToolbar.tsx:58— mobile/src/features/chat/composer/ComposerToolbar.tsx:58 · mobile/src/features/chat/composer/ComposerToolbar.tsx:85 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (26 lines × 2 locations) desktop/src/components/layout/ActivityRailSelectionToolbar.tsx:52— desktop/src/components/layout/ActivityRailSelectionToolbar.tsx:52 · desktop/src/components/layout/ActivityRailSelectionToolbar.tsx:86 — 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 (26 lines × 2 locations) desktop/src/features/agent/agentQueue.ts:84— desktop/src/features/agent/agentQueue.ts:84 · mobile/src/remote/sessionQueue.ts:96 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Dead file (~3 LoC) harness/mobile-client/shims/react-native.mjs— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~3 LoC) scripts/screenshots/injects/choice-card-m-chosen.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
SC1 · Supply-chain hygiene· JavaScript dependencies are not locked · ×2
JavaScript dependencies are not locked mobile/modules/future-file-handler/package.json:5— mobile/modules/future-file-handler/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 mobile/modules/future-share-intent/package.json:5— mobile/modules/future-share-intent/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.
AC1 · Text alternatives· <canvas> without a text alternative · ×1
<canvas> without a text alternative desktop/src/features/artifacts/PdfPreview.tsx:92— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
Low contrast colour pair in CSS (4.4:1) host/web/index.html:30— `button` sets color: #fff on background-color: #2b6cff — 4.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.5:1) host/web/index.html:38— `#presenceStatus.offline` sets color: #9aa4b2 on background-color: #4a4a4a — 3.5:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.9:1) scripts/screenshots/document.css:13— `h3 .num` sets color: #2b6cff on background-color: #eaf0ff — 3.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (4.0:1) scripts/screenshots/document.css:38— `.tag` sets color: #2b6cff on background-color: #eef3ff — 4.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AXI1 · Runtime container hardening· Container process runs as root · ×1
Container process runs as root: future-nats-dev — 'future-nats-dev' (nats:2.10-alpine) runs as uid 0 — no user was specified, or one resolving to root was. Observed on the running container, which is the only place the answer is settled: an image's own USER, a base image's inherited one and a compose override are all invisible to a Dockerfile reader. Advisory evidence for CRA Annex I (2)(b).
AXR1 · Runtime accessibility (rendered)· WCAG 1.1.1 reproducibly failed in a rendered surface · ×1
WCAG 1.1.1 reproducibly failed in a rendered surface — axe-core rule(s) svg-img-alt failed on: svg. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
AXR1 · Runtime accessibility (rendered)· WCAG 2.4.2 reproducibly failed in a rendered surface · ×1
WCAG 2.4.2 reproducibly failed in a rendered surface — axe-core rule(s) document-title failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
AXR1 · Runtime accessibility (rendered)· WCAG 3.1.1 reproducibly failed in a rendered surface · ×1
WCAG 3.1.1 reproducibly failed in a rendered surface — axe-core rule(s) html-has-lang, html-lang-valid failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
ActivityRail.ActivityRail (cyclomatic 290) desktop/src/components/layout/ActivityRail.tsx:276— ActivityRail.ActivityRail has cyclomatic complexity 290 (threshold 15). Of this number, 117 points are the body's own statements and 173 belong to 72 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.
AppShell.ReadyAppShell (cyclomatic 164) desktop/src/components/layout/AppShell.tsx:152— AppShell.ReadyAppShell has cyclomatic complexity 164 (threshold 15). Of this number, 77 points are the body's own statements and 87 belong to 54 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.
runCase (cyclomatic 149) harness/lib/run.mjs:82— runCase 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.
SessionsScreen.SessionsScreen (cyclomatic 147) mobile/src/screens/SessionsScreen.tsx:98— SessionsScreen.SessionsScreen has cyclomatic complexity 147 (threshold 15). Of this number, 70 points are the body's own statements and 77 belong to 31 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.
VibeStage.VibeStage (cyclomatic 143) desktop/src/features/vibe/VibeStage.tsx:147— VibeStage.VibeStage has cyclomatic complexity 143 (threshold 15). Of this number, 43 points are the body's own statements and 100 belong to 40 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.
liveApply.createProjector.processEvent (cyclomatic 125) REDACTED:225— liveApply.createProjector.processEvent has cyclomatic complexity 125 (threshold 15). Of this number, 121 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatScreen.ChatScreen (cyclomatic 120) mobile/src/features/chat/ChatScreen.tsx:72— ChatScreen.ChatScreen has cyclomatic complexity 120 (threshold 15). Of this number, 63 points are the body's own statements and 57 belong to 30 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.
useRemoteTimeline.useRemoteTimeline (cyclomatic 93) desktop/src/features/remote-peer/useRemoteTimeline.ts:268— useRemoteTimeline.useRemoteTimeline has cyclomatic complexity 93 (threshold 15). Most of this is not in the body itself: 2 of the 93 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 648, 416, 362, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
TimelineCard.TimelineCardView (cyclomatic 90) mobile/src/features/chat/messages/TimelineCard.tsx:43— TimelineCard.TimelineCardView has cyclomatic complexity 90 (threshold 15). Of this number, 72 points are the body's own statements and 18 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MessageBlock.MessageBlockImpl (cyclomatic 89) desktop/src/features/agent/MessageBlock.tsx:78— MessageBlock.MessageBlockImpl has cyclomatic complexity 89 (threshold 15). Of this number, 79 points are the body's own statements and 10 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runRemoteLiveCase (cyclomatic 87) harness/lib/remote-live.mjs:111— runRemoteLiveCase has cyclomatic complexity 87 (threshold 15). Of this number, 18 points are the body's own statements and 69 belong to 31 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentThread.AgentThread (cyclomatic 84) desktop/src/features/agent/AgentThread.tsx:188— AgentThread.AgentThread has cyclomatic complexity 84 (threshold 15). Of this number, 57 points are the body's own statements and 27 belong to 14 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.
RemoteContext.RemoteProvider (cyclomatic 84) mobile/shot/mock/RemoteContext.tsx:197— RemoteContext.RemoteProvider has cyclomatic complexity 84 (threshold 15). Of this number, 33 points are the body's own statements and 51 belong to 28 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runCliCase (cyclomatic 84) harness/lib/cli-driver.mjs:99— runCliCase has cyclomatic complexity 84 (threshold 15). Of this number, 76 points are the body's own statements and 8 belong to 16 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.
runRemoteMobileCase (cyclomatic 82) harness/lib/remote-mobile-live.mjs:98— runRemoteMobileCase has cyclomatic complexity 82 (threshold 15). Of this number, 22 points are the body's own statements and 60 belong to 28 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.
ComposerDock.ComposerDockView (cyclomatic 81) mobile/src/features/chat/components/ComposerDock.tsx:37— ComposerDock.ComposerDockView has cyclomatic complexity 81 (threshold 15). Of this number, 59 points are the body's own statements and 22 belong to 10 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ComposerControls.ComposerControls (cyclomatic 73) desktop/src/features/agent/composer/ComposerControls.tsx:104— ComposerControls.ComposerControls has cyclomatic complexity 73 (threshold 15). Of this number, 43 points are the body's own statements and 30 belong to 9 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.
replay.readRunReplay (cyclomatic 73) packages/thread-projection/src/replay.ts:262— replay.readRunReplay has cyclomatic complexity 73 (threshold 15). Of this number, 71 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FusionToolRow.FusionToolRow (cyclomatic 68) mobile/src/features/chat/messages/FusionToolRow.tsx:14— FusionToolRow.FusionToolRow has cyclomatic complexity 68 (threshold 15). Of this number, 21 points are the body's own statements and 47 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TasksSettingsPage.TaskForm (cyclomatic 68) mobile/src/features/settings/TasksSettingsPage.tsx:664— TasksSettingsPage.TaskForm has cyclomatic complexity 68 (threshold 15). Of this number, 38 points are the body's own statements and 30 belong to 13 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.
UpdatePage.UpdatePage (cyclomatic 67) desktop/src/features/settings/UpdatePage.tsx:28— UpdatePage.UpdatePage has cyclomatic complexity 67 (threshold 15). Of this number, 49 points are the body's own statements and 18 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
analyzeRun (cyclomatic 67) harness/lib/analyze.mjs:850— analyzeRun has cyclomatic complexity 67 (threshold 15). Of this number, 42 points are the body's own statements and 25 belong to 21 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ContextPanel.ContextPanel (cyclomatic 65) desktop/src/components/layout/ContextPanel.tsx:91— ContextPanel.ContextPanel has cyclomatic complexity 65 (threshold 15). Of this number, 38 points are the body's own statements and 27 belong to 12 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TerminalView.TerminalView (cyclomatic 63) desktop/src/features/terminal/TerminalView.tsx:63— TerminalView.TerminalView has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 1 of the 63 points is its own statement and the rest belongs to 23 function literals inside it that branch (lines 277, 79, 190, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionList.SessionList::renderRow (cyclomatic 63) mobile/src/screens/SessionList.tsx:997— SessionList.SessionList::renderRow has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent 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 (SessionList.SessionList) 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.
ArtifactDetailPanel.ArtifactDetailPanel (cyclomatic 62) desktop/src/features/artifacts/ArtifactDetailPanel.tsx:41— ArtifactDetailPanel.ArtifactDetailPanel has cyclomatic complexity 62 (threshold 15). Of this number, 46 points are the body's own statements and 16 belong to 9 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.
OnboardingGate.OnboardingGate (cyclomatic 62) desktop/src/components/layout/OnboardingGate.tsx:72— OnboardingGate.OnboardingGate has cyclomatic complexity 62 (threshold 15). Of this number, 33 points are the body's own statements and 29 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FusionActivity.FusionActivity (cyclomatic 61) desktop/src/features/agent/FusionActivity.tsx:12— FusionActivity.FusionActivity has cyclomatic complexity 61 (threshold 15). Of this number, 22 points are the body's own statements and 39 belong to 6 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.
writeReport (cyclomatic 61) harness/lib/report.mjs:41— writeReport has cyclomatic complexity 61 (threshold 15). Of this number, 53 points are the body's own statements and 8 belong to 17 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemoteView.RemoteHostSection (cyclomatic 60) desktop/src/features/remote/RemoteView.tsx:82— RemoteView.RemoteHostSection has cyclomatic complexity 60 (threshold 15). Of this number, 30 points are the body's own statements and 30 belong to 16 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity· main (cyclomatic 60) · ×1
main (cyclomatic 60) harness/cli.mjs:54— main has cyclomatic complexity 60 (threshold 15). Of this number, 52 points are the body's own statements and 8 belong to 21 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TerminalPanel.TerminalPanelShell (cyclomatic 59) desktop/src/features/terminal/TerminalPanel.tsx:100— TerminalPanel.TerminalPanelShell has cyclomatic complexity 59 (threshold 15). Of this number, 42 points are the body's own statements and 17 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Input::handle_key (cyclomatic 58) tui/src/components/input.rs:522— Input::handle_key has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemoteContext.RemoteProvider (cyclomatic 57) mobile/src/remote/RemoteContext.tsx:723— RemoteContext.RemoteProvider has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 2 of the 57 points are its own statements and the rest belongs to 25 function literals inside it that branch (lines 1038, 863, 922, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ApprovalPrompt.ApprovalPrompt (cyclomatic 55) desktop/src/features/agent/ApprovalPrompt.tsx:41— ApprovalPrompt.ApprovalPrompt has cyclomatic complexity 55 (threshold 15). Of this number, 23 points are the body's own statements and 32 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ThreadSearch.ThreadSearch (cyclomatic 54) desktop/src/features/agent/search/ThreadSearch.tsx:32— ThreadSearch.ThreadSearch has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 12 of the 54 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 153, 124, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionList.SessionList (cyclomatic 54) mobile/src/screens/SessionList.tsx:182— SessionList.SessionList 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. This shape REPEATS in the file: one other method here (SessionList.SessionList::renderRow) 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.
driver.main (cyclomatic 53) harness/tui/driver.py:232— driver.main has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useDesktopConnection.useDesktopConnection.connect (cyclomatic 53) mobile/src/remote/useDesktopConnection.ts:387— useDesktopConnection.useDesktopConnection.connect has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 5 of the 53 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 446, 583, 529, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteComposer.RemoteComposer (cyclomatic 52) desktop/src/features/remote-peer/RemoteComposer.tsx:230— RemoteComposer.RemoteComposer has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (RemoteComposer.RemoteComposer::pasteFiles, RemoteComposer.RemoteComposer::send) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
useTimelineController.useTimelineController (cyclomatic 52) mobile/src/remote/useTimelineController.ts:75— useTimelineController.useTimelineController has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 6 of the 52 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 624, 881, 750, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sendPipeline.runSendPipeline (cyclomatic 50) desktop/src/features/agent/sendPipeline.ts:74— sendPipeline.runSendPipeline has cyclomatic complexity 50 (threshold 15). Of this number, 43 points are the body's own statements and 7 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImagePreview.ImagePreview (cyclomatic 49) desktop/src/features/filepreview/ImagePreview.tsx:62— ImagePreview.ImagePreview has cyclomatic complexity 49 (threshold 15). Of this number, 23 points are the body's own statements and 26 belong to 11 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SyncEngine.runReconcile (cyclomatic 49) packages/remote-client/src/syncEngine.ts:571— SyncEngine.runReconcile has cyclomatic complexity 49 (threshold 15). Of this number, 41 points are the body's own statements and 8 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.
PendingApprovalCard.PendingApprovalCard (cyclomatic 47) mobile/src/features/chat/messages/PendingApprovalCard.tsx:36— PendingApprovalCard.PendingApprovalCard has cyclomatic complexity 47 (threshold 15). Of this number, 44 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useRemotePeers.useRemotePeers (cyclomatic 46) desktop/src/components/layout/hooks/useRemotePeers.ts:111— useRemotePeers.useRemotePeers has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 24 function literals inside it that branch (lines 462, 218, 389, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSendMessage.useSendMessage (cyclomatic 46) mobile/src/features/chat/useSendMessage.ts:117— useSendMessage.useSendMessage has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 120, 163, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MergedRows.MergedRows (cyclomatic 45) desktop/src/components/layout/MergedRows.tsx:46— MergedRows.MergedRows has cyclomatic complexity 45 (threshold 15). Of this number, 32 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemoteConversationView.RemoteConversationView (cyclomatic 44) desktop/src/features/remote-peer/RemoteConversationView.tsx:81— RemoteConversationView.RemoteConversationView has cyclomatic complexity 44 (threshold 15). Of this number, 24 points are the body's own statements and 20 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useRemotePeers.handleCatalog (cyclomatic 44) desktop/src/components/layout/hooks/useRemotePeers.ts:821— useRemotePeers.handleCatalog has cyclomatic complexity 44 (threshold 15). Of this number, 31 points are the body's own statements and 13 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillsSettingsPage.SkillsSettingsPage (cyclomatic 44) mobile/src/features/settings/SkillsSettingsPage.tsx:12— SkillsSettingsPage.SkillsSettingsPage has cyclomatic complexity 44 (threshold 15). Of this number, 16 points are the body's own statements and 28 belong to 7 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
FusionStepBody.StepResponse (cyclomatic 43) desktop/src/features/fusion/FusionStepBody.tsx:44— FusionStepBody.StepResponse has cyclomatic complexity 43 (threshold 15). Of this number, 21 points are the body's own statements and 22 belong to 11 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.
RemoteFilesPanel.RemoteFilesPanel (cyclomatic 43) desktop/src/features/remote-peer/RemoteFilesPanel.tsx:34— RemoteFilesPanel.RemoteFilesPanel has cyclomatic complexity 43 (threshold 15). Of this number, 27 points are the body's own statements and 16 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemotePeerSettings.RemotePeerSettings (cyclomatic 43) desktop/src/features/remote-peer/RemotePeerSettings.tsx:50— RemotePeerSettings.RemotePeerSettings has cyclomatic complexity 43 (threshold 15). Of this number, 24 points are the body's own statements and 19 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ComposerToolbar.ComposerToolbar (cyclomatic 42) mobile/src/features/chat/composer/ComposerToolbar.tsx:33— ComposerToolbar.ComposerToolbar has cyclomatic complexity 42 (threshold 15). Of this number, 23 points are the body's own statements and 19 belong to 8 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SyncEngine.applyOps (cyclomatic 42) packages/remote-client/src/syncEngine.ts:874— SyncEngine.applyOps has cyclomatic complexity 42 (threshold 15). Of this number, 39 points are the body's own statements and 3 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.
MentionEditor.MentionEditor::handleKeyDown (cyclomatic 41) desktop/src/features/agent/MentionEditor.tsx:802— MentionEditor.MentionEditor::handleKeyDown 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.
useTimelineController.useTimelineController.loadHistory (cyclomatic 41) mobile/src/remote/useTimelineController.ts:277— useTimelineController.useTimelineController.loadHistory has cyclomatic complexity 41 (threshold 15). Of this number, 37 points are the body's own statements and 4 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.
SessionFilesPanel.SessionFilesPanel (cyclomatic 41) mobile/src/features/chat/components/SessionFilesPanel.tsx:13— SessionFilesPanel.SessionFilesPanel has cyclomatic complexity 41 (threshold 15). Of this number, 22 points are the body's own statements and 19 belong to 11 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PairingScreen.PairingScreen (cyclomatic 40) mobile/src/screens/PairingScreen.tsx:84— PairingScreen.PairingScreen has cyclomatic complexity 40 (threshold 15). Of this number, 18 points are the body's own statements and 22 belong to 11 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deterministicFindings (cyclomatic 40) harness/lib/analyze.mjs:135— deterministicFindings has cyclomatic complexity 40 (threshold 15). Of this number, 38 points are the body's own statements and 2 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnsiCodeTracker::feed (cyclomatic 39) tui/src/utils.rs:468— AnsiCodeTracker::feed has cyclomatic complexity 39 (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.
usePromptOutbox.usePromptOutbox.sendMessage (cyclomatic 39) mobile/src/remote/usePromptOutbox.ts:272— usePromptOutbox.usePromptOutbox.sendMessage has cyclomatic complexity 39 (threshold 15). Of this number, 29 points are the body's own statements and 10 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.
useSessionMessageEvents.useSessionMessageEvents (cyclomatic 38) desktop/src/features/agent/runtime/useSessionMessageEvents.ts:24— useSessionMessageEvents.useSessionMessageEvents has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 1 of the 38 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 38, 122, 68, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useChatFiles.useChatFiles.openOrShare (cyclomatic 38) mobile/src/features/chat/files/useChatFiles.ts:349— useChatFiles.useChatFiles.openOrShare has cyclomatic complexity 38 (threshold 15). Of this number, 34 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FusionSettingsPage.Editor (cyclomatic 38) mobile/src/features/settings/FusionSettingsPage.tsx:17— FusionSettingsPage.Editor has cyclomatic complexity 38 (threshold 15). Of this number, 18 points are the body's own statements and 20 belong to 9 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TasksView.TasksView (cyclomatic 37) desktop/src/features/tasks/TasksView.tsx:229— TasksView.TasksView has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 8 of the 37 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 302, 417, 374, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
projection.applyEvent (cyclomatic 37) packages/remote-client/src/projection.ts:516— projection.applyEvent has cyclomatic complexity 37 (threshold 15). Of this number, 33 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
syncEngine.mergeLiveInto (cyclomatic 37) packages/remote-client/src/syncEngine.ts:1261— syncEngine.mergeLiveInto has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 2 of the 37 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1294, 1356, 1344, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProvidersPage.ProvidersPage (cyclomatic 36) desktop/src/features/settings/ProvidersPage.tsx:36— ProvidersPage.ProvidersPage has cyclomatic complexity 36 (threshold 15). Of this number, 16 points are the body's own statements and 20 belong to 8 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.
useAppLifecycle.useAppLifecycle (cyclomatic 35) mobile/src/remote/useAppLifecycle.ts:50— useAppLifecycle.useAppLifecycle has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 125, 80, 150, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ShareIntakeMenu.ShareIntakeMenu (cyclomatic 35) mobile/src/share/ShareIntakeMenu.tsx:15— ShareIntakeMenu.ShareIntakeMenu has cyclomatic complexity 35 (threshold 15). Of this number, 18 points are the body's own statements and 17 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Writer::encode (cyclomatic 34) agent/src/session/content/journal.rs:98— Writer::encode 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.
FileTreePanel.FileTreePanel (cyclomatic 34) desktop/src/features/filetree/FileTreePanel.tsx:34— FileTreePanel.FileTreePanel has cyclomatic complexity 34 (threshold 15). Of this number, 25 points are the body's own statements and 9 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NewConversation.NewConversation (cyclomatic 34) desktop/src/features/agent/NewConversation.tsx:85— NewConversation.NewConversation has cyclomatic complexity 34 (threshold 15). Of this number, 17 points are the body's own statements and 17 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.html.onEvent (cyclomatic 34) host/web/index.html:1192— index.html.onEvent has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useChatFiles.useChatFiles.openAttachment (cyclomatic 34) mobile/src/features/chat/files/useChatFiles.ts:97— useChatFiles.useChatFiles.openAttachment has cyclomatic complexity 34 (threshold 15). Of this number, 27 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemoteClient.watchStatus (cyclomatic 34) packages/remote-client/src/client.ts:1259— RemoteClient.watchStatus has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to one function literal inside it that branches (line 1260). 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.
AccountPage.AccountPage (cyclomatic 33) desktop/src/features/settings/AccountPage.tsx:16— AccountPage.AccountPage has cyclomatic complexity 33 (threshold 15). Of this number, 28 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useAgentStatus.useAgentStatus (cyclomatic 33) desktop/src/components/layout/hooks/useAgentStatus.ts:26— useAgentStatus.useAgentStatus has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 91, 86, 63, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ToolRow.StandardToolRow (cyclomatic 33) mobile/src/features/chat/messages/ToolRow.tsx:33— ToolRow.StandardToolRow has cyclomatic complexity 33 (threshold 15). Of this number, 27 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SendQueuePanel.SendQueuePanel (cyclomatic 33) mobile/src/features/chat/components/SendQueuePanel.tsx:99— SendQueuePanel.SendQueuePanel has cyclomatic complexity 33 (threshold 15). Of this number, 24 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
approval.parseAction (cyclomatic 33) packages/thread-projection/src/approval.ts:98— approval.parseAction 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.
projection.turnFromAcc (cyclomatic 33) packages/thread-projection/src/projection.ts:325— projection.turnFromAcc 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.
judgeCase (cyclomatic 33) harness/lib/analyze.mjs:618— judgeCase has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 13 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.
Terminal::start (cyclomatic 32) tui/src/terminal.rs:442— Terminal::start 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.
Composer.ComposerImpl::submitValue (cyclomatic 32) desktop/src/features/agent/Composer.tsx:542— Composer.ComposerImpl::submitValue has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (Composer.ComposerImpl) 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.
TasksView.TaskForm (cyclomatic 32) desktop/src/features/tasks/TasksView.tsx:506— TasksView.TaskForm has cyclomatic complexity 32 (threshold 15). Of this number, 22 points are the body's own statements and 10 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SseBroadcaster::broadcast_stamped (cyclomatic 31) agent/src/rpc/broadcaster/mod.rs:314— SseBroadcaster::broadcast_stamped 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.
CustomProviderDialog.CustomProviderDialog::handleSubmit (cyclomatic 31) desktop/src/features/settings/CustomProviderDialog.tsx:328— CustomProviderDialog.CustomProviderDialog::handleSubmit 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.
FusionDiscussionPanel.FusionDiscussionPanel (cyclomatic 31) desktop/src/features/fusion/FusionDiscussionPanel.tsx:18— FusionDiscussionPanel.FusionDiscussionPanel has cyclomatic complexity 31 (threshold 15). Of this number, 26 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useThreadStore.useThreadStore.refreshStore (cyclomatic 31) desktop/src/components/layout/hooks/useThreadStore.ts:646— useThreadStore.useThreadStore.refreshStore has cyclomatic complexity 31 (threshold 15). Of this number, 27 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.
loadThreadHistory.loadThreadHistory (cyclomatic 31) desktop/src/features/agent/history/loadThreadHistory.ts:36— loadThreadHistory.loadThreadHistory has cyclomatic complexity 31 (threshold 15). Of this number, 25 points are the body's own statements and 6 belong to 3 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.
DesktopPicker.DesktopPicker (cyclomatic 31) mobile/src/screens/DesktopPicker.tsx:43— DesktopPicker.DesktopPicker has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 9 of the 31 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 238, take, a function literal at line 156, …). 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.
projection.applyStandaloneCompaction (cyclomatic 31) packages/remote-client/src/projection.ts:779— projection.applyStandaloneCompaction has cyclomatic complexity 31 (threshold 15). Of this number, 27 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DesktopsScreen.DesktopsScreen (cyclomatic 30) mobile/src/screens/DesktopsScreen.tsx:60— DesktopsScreen.DesktopsScreen has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 162, a function literal at line 98, select, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.formatJsonForPreview (cyclomatic 30) packages/json-preview/src/index.ts:29— index.formatJsonForPreview has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
projection.messageToItems (cyclomatic 30) packages/remote-client/src/projection.ts:84— projection.messageToItems has cyclomatic complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Session::step (cyclomatic 29) channels/src/providers/irc.rs:787— Session::step has cyclomatic complexity 29 (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.
AgentStatusGate.AgentStatusGate (cyclomatic 29) desktop/src/components/layout/AgentStatusGate.tsx:11— AgentStatusGate.AgentStatusGate 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.
useTimelineController.useTimelineController.handleEvent (cyclomatic 29) mobile/src/remote/useTimelineController.ts:182— useTimelineController.useTimelineController.handleEvent has cyclomatic complexity 29 (threshold 15). Of this number, 27 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
utils.plainText (cyclomatic 29) mobile/src/features/chat/utils.ts:95— utils.plainText 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.
SettingsScreen.SettingsScreen (cyclomatic 29) mobile/src/features/settings/SettingsScreen.tsx:105— SettingsScreen.SettingsScreen 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. This shape REPEATS in the file: one other method here (SettingsScreen.SettingsScreen::renderLevel) 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.
RemoteClient.connectSocket (cyclomatic 29) packages/remote-client/src/client.ts:740— RemoteClient.connectSocket has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AnthropicMessagesAdapter::decode_frame (cyclomatic 28) agent/src/llm/adapters/anthropic.rs:127— AnthropicMessagesAdapter::decode_frame 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.
AgentHandle::drain (cyclomatic 28) agent/src/service/shutdown.rs:242— AgentHandle::drain 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.
Scan::hash (cyclomatic 28) tui/src/workbench/syntax.rs:980— Scan::hash 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.
mergeConversations.groupMergedRows (cyclomatic 28) desktop/src/features/remote-peer/mergeConversations.ts:828— mergeConversations.groupMergedRows has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
liveRunProjection.projectRunForLivePreview (cyclomatic 28) desktop/src/features/agent/runtime/liveRunProjection.ts:255— liveRunProjection.projectRunForLivePreview 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.
RailViewSwitch.RailViewSwitch (cyclomatic 28) desktop/src/components/layout/RailViewSwitch.tsx:41— RailViewSwitch.RailViewSwitch has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 9 function items inside it that branch (handlePointerMove, handleKeyDown, viewAt, …). 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.
useRemoteConversationSettings.useRemoteConversationSettings (cyclomatic 28) desktop/src/features/remote-peer/useRemoteConversationSettings.ts:153— useRemoteConversationSettings.useRemoteConversationSettings has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 323, 248, 301, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useComposerSubmission.useComposerSubmission (cyclomatic 28) mobile/src/features/chat/composer/useComposerSubmission.ts:37— useComposerSubmission.useComposerSubmission has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 46, 67). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ConnectionStatus.useConnectionSummary (cyclomatic 28) mobile/src/components/ConnectionStatus.tsx:142— ConnectionStatus.useConnectionSummary 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.
SettingsScreen.SettingsScreen::renderLevel (cyclomatic 28) mobile/src/features/settings/SettingsScreen.tsx:243— SettingsScreen.SettingsScreen::renderLevel 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. This shape REPEATS in the file: one other method here (SettingsScreen.SettingsScreen) 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.
SendQueuePanel.SendQueuePanel (cyclomatic 27) desktop/src/features/agent/SendQueuePanel.tsx:111— SendQueuePanel.SendQueuePanel has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 10 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 281, a function literal at line 425, toggleExpanded, …). 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.
agentStateCache.installAgentEventListener (cyclomatic 27) desktop/src/integrations/agent/agentStateCache.ts:326— agentStateCache.installAgentEventListener has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 342, 331). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSkillRecommendation.useSkillRecommendation (cyclomatic 27) mobile/src/features/chat/useSkillRecommendation.ts:115— useSkillRecommendation.useSkillRecommendation has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 135, 152, 205, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
bodyFor (cyclomatic 27) harness/lib/issues-en.mjs:85— bodyFor has cyclomatic complexity 27 (threshold 15). Of this number, 20 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runCase::perfValue (cyclomatic 27) harness/lib/run.mjs:163— runCase::perfValue 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.
ReasoningEffortVocabulary::parse (cyclomatic 26) agent/src/llm/schema.rs:403— ReasoningEffortVocabulary::parse 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.
SettingsDialog.SettingsDialog (cyclomatic 26) desktop/src/features/settings/SettingsDialog.tsx:67— SettingsDialog.SettingsDialog has cyclomatic complexity 26 (threshold 15). Of this number, 15 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SkillsView.InstalledTab (cyclomatic 26) desktop/src/features/skills/SkillsView.tsx:363— SkillsView.InstalledTab has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 452, 400). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ThinkingRow.ThinkingRow (cyclomatic 26) mobile/src/features/chat/messages/ThinkingRow.tsx:43— ThinkingRow.ThinkingRow has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TasksSettingsPage.TasksSettingsPage (cyclomatic 26) mobile/src/features/settings/TasksSettingsPage.tsx:398— TasksSettingsPage.TasksSettingsPage has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 7 function items inside it that branch (mutate, a function literal at line 496, a function literal at line 625, …). 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.
streamingMarkdown.createStreamingMarkdownParser.<returned closure> (cyclomatic 26) packages/markdown/src/streamingMarkdown.ts:65— streamingMarkdown.createStreamingMarkdownParser.<returned closure> 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.
RemoteClient.runRefreshToken (cyclomatic 26) packages/remote-client/src/client.ts:683— RemoteClient.runRefreshToken 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.
format.classifyAgentError (cyclomatic 26) packages/thread-projection/src/format.ts:84— format.classifyAgentError 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.
runRemoteCnCase (cyclomatic 26) harness/lib/remote-cn.mjs:80— runRemoteCnCase 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.
DingtalkBridge::handle_slash_command (cyclomatic 25) channels/src/dingtalk/bridge.rs:179— DingtalkBridge::handle_slash_command 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.
useMessagePaging.useMessagePaging (cyclomatic 25) desktop/src/features/agent/useMessagePaging.ts:95— useMessagePaging.useMessagePaging has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 406, 255, 451, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemotePeersView.RemoteClientSection (cyclomatic 25) desktop/src/features/remote-peer/RemotePeersView.tsx:60— RemotePeersView.RemoteClientSection has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillsView.AllTab (cyclomatic 25) desktop/src/features/skills/SkillsView.tsx:495— SkillsView.AllTab has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 560, 591, 603). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remarkLatexMath.tokenizeMath.<returned closure> (cyclomatic 25) packages/markdown/src/remarkLatexMath.ts:84— remarkLatexMath.tokenizeMath.<returned closure> has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (between, tokenizeClose::after, escaped, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
parseFutureMarkdown.blockToFutureNode (cyclomatic 25) packages/markdown/src/parseFutureMarkdown.ts:161— parseFutureMarkdown.blockToFutureNode 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.
RemoteClient.restoreServingConnection (cyclomatic 25) packages/remote-client/src/client.ts:495— RemoteClient.restoreServingConnection has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
runRemoteCases (cyclomatic 25) harness/lib/remote-driver.mjs:63— runRemoteCases 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.
ContentSequence::stamp (cyclomatic 24) agent/src/rpc/broadcaster/content_sequence.rs:26— ContentSequence::stamp 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.
JsonPreview.JsonPreview (cyclomatic 24) desktop/src/features/filepreview/JsonPreview.tsx:18— JsonPreview.JsonPreview has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AppShellDialogs.AppShellDialogs (cyclomatic 24) desktop/src/components/layout/AppShellDialogs.tsx:88— AppShellDialogs.AppShellDialogs has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MarkdownText.renderBlock (cyclomatic 24) mobile/src/components/MarkdownText.tsx:306— MarkdownText.renderBlock 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.
useOlderHistory.useOlderHistory.loadOlderTimeline (cyclomatic 24) mobile/src/remote/timeline/useOlderHistory.ts:45— useOlderHistory.useOlderHistory.loadOlderTimeline has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RemoteClient.subscribe (cyclomatic 24) packages/remote-client/src/client.ts:1045— RemoteClient.subscribe has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1062, 1082, 1079). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 24) desktop/shot/terminal-server.mjs:101— (anonymous) has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
draftIssues (cyclomatic 24) harness/lib/issues.mjs:55— draftIssues has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ShareViewController.didSelectPost (cyclomatic 23) mobile/modules/future-share-intent/extension/ShareViewController.swift:22— ShareViewController.didSelectPost 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.
remotePeerClient.normalizeRemoteSessionRows (cyclomatic 23) desktop/src/features/remote-peer/remotePeerClient.ts:293— remotePeerClient.normalizeRemoteSessionRows has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 296). 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.
RemoteApprovalMenu.RemoteApprovalMenu (cyclomatic 23) desktop/src/features/remote-peer/RemoteApprovalMenu.tsx:35— RemoteApprovalMenu.RemoteApprovalMenu has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 141, choose, a function literal at line 77, …). 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.
ReviewPanel.ReviewPanel (cyclomatic 23) desktop/src/features/review/ReviewPanel.tsx:21— ReviewPanel.ReviewPanel has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ThinkingBlock.ThinkingBlock (cyclomatic 23) desktop/src/features/agent/ThinkingBlock.tsx:38— ThinkingBlock.ThinkingBlock has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PreviewModal.PreviewLayer (cyclomatic 23) mobile/src/features/chat/components/PreviewModal.tsx:135— PreviewModal.PreviewLayer has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 8 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.
index.patchLines (cyclomatic 23) packages/git-graph/src/index.ts:445— index.patchLines has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 453). 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.
SyncEngine.replayInto (cyclomatic 23) packages/remote-client/src/syncEngine.ts:785— SyncEngine.replayInto has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
contentRange.applyContentRange (cyclomatic 23) packages/thread-projection/src/contentRange.ts:4— contentRange.applyContentRange 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.
ApprovalGate::request (cyclomatic 22) agent/src/rpc/approval.rs:119— ApprovalGate::request 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.
useThreadMessages.useThreadMessages (cyclomatic 22) desktop/src/features/agent/useThreadMessages.ts:53— useThreadMessages.useThreadMessages has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 170, 383, 131, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSkillRecommendation.useSkillRecommendation.evaluate (cyclomatic 22) desktop/src/features/agent/useSkillRecommendation.ts:284— useSkillRecommendation.useSkillRecommendation.evaluate has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SkillsView.SkillsView (cyclomatic 22) desktop/src/features/skills/SkillsView.tsx:52— SkillsView.SkillsView has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 143, 81, 214, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
UpdateRecoveryPanel.UpdateRecoveryPanel (cyclomatic 22) desktop/src/features/settings/UpdateRecoveryPanel.tsx:12— UpdateRecoveryPanel.UpdateRecoveryPanel has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RemoteFilesDialog.RemoteFilesDialog (cyclomatic 22) desktop/src/features/remote-peer/RemoteFilesDialog.tsx:24— RemoteFilesDialog.RemoteFilesDialog has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 154, a function literal at line 71, download, …). 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.
storage.readRegistry (cyclomatic 22) mobile/src/remote/storage.ts:139— storage.readRegistry has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
visual-regression.main (cyclomatic 22) harness/scripts/visual-regression.mjs:125— visual-regression.main 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.
useDesktopRuntime.useDesktopRuntime (cyclomatic 22) mobile/src/remote/useDesktopRuntime.ts:115— useDesktopRuntime.useDesktopRuntime has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 226, 422, 145, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useCompactContext.useCompactContext.compact (cyclomatic 22) mobile/src/features/chat/useCompactContext.ts:30— useCompactContext.useCompactContext.compact has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatTimeline.ChatTimeline (cyclomatic 22) mobile/src/features/chat/components/ChatTimeline.tsx:42— ChatTimeline.ChatTimeline has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
GitGraphPanel.GitGraphPanel (cyclomatic 22) mobile/src/features/chat/components/GitGraphPanel.tsx:71— GitGraphPanel.GitGraphPanel has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CustomProviderPage.CustomProviderPage::validate (cyclomatic 22) mobile/src/features/settings/CustomProviderPage.tsx:332— CustomProviderPage.CustomProviderPage::validate 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.
contentBody.readContentPages (cyclomatic 22) packages/thread-projection/src/contentBody.ts:42— contentBody.readContentPages 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.
judgeEvidence (cyclomatic 22) harness/lib/analyze.mjs:484— judgeEvidence has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
installEventHandlers (cyclomatic 22) harness/lib/cdp.mjs:291— installEventHandlers has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 298, 310, 334, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OpenAiChatAdapter::decode_frame (cyclomatic 21) agent/src/llm/adapters/openai_chat.rs:86— OpenAiChatAdapter::decode_frame 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.
future_rpc::history::read_page_with (cyclomatic 21) packages/rpc/src/history.rs:247— future_rpc::history::read_page_with 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.
mergeConversations.mergeConversations (cyclomatic 21) desktop/src/features/remote-peer/mergeConversations.ts:594— mergeConversations.mergeConversations has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 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.
DatabaseOrganization.DatabaseOrganization (cyclomatic 21) desktop/src/features/settings/DatabaseOrganization.tsx:45— DatabaseOrganization.DatabaseOrganization has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 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.
RunInspectPanel.ToolCallDetail (cyclomatic 21) desktop/src/features/runs/RunInspectPanel.tsx:332— RunInspectPanel.ToolCallDetail 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.
RunsPanel.ToolRow (cyclomatic 21) desktop/src/features/runs/RunsPanel.tsx:233— RunsPanel.ToolRow has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useThreadStore.useThreadStore (cyclomatic 21) desktop/src/components/layout/hooks/useThreadStore.ts:365— useThreadStore.useThreadStore has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 861, 448, 890, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ApprovalPrompt.ActionDetails (cyclomatic 21) desktop/src/features/agent/ApprovalPrompt.tsx:322— ApprovalPrompt.ActionDetails has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useThreadCompaction.useThreadCompaction (cyclomatic 21) desktop/src/features/agent/runtime/useThreadCompaction.ts:24— useThreadCompaction.useThreadCompaction has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 29, 53, 70). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteModelsPanel.RemoteModelsPanel (cyclomatic 21) desktop/src/features/remote-peer/RemoteModelsPanel.tsx:23— RemoteModelsPanel.RemoteModelsPanel has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 142, a function literal at line 67, setVisibility, …). 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.
RemoteProvidersPanel.RemoteProvidersPanel (cyclomatic 21) desktop/src/features/remote-peer/RemoteProvidersPanel.tsx:32— RemoteProvidersPanel.RemoteProvidersPanel has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 157, a function literal at line 50, write, …). 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.
TasksView.TaskDetail (cyclomatic 21) desktop/src/features/tasks/TasksView.tsx:891— TasksView.TaskDetail has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.html.mdToHtml (cyclomatic 21) host/web/index.html:1138— index.html.mdToHtml 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.
usePromptOutbox.usePromptOutbox.continueRun (cyclomatic 21) mobile/src/remote/usePromptOutbox.ts:581— usePromptOutbox.usePromptOutbox.continueRun has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 594). 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.
sessionTree.catalogRows (cyclomatic 21) mobile/src/screens/sessionTree.ts:603— sessionTree.catalogRows has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 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.
ModelsSettingsPage.ModelsSettingsPage (cyclomatic 21) mobile/src/features/settings/ModelsSettingsPage.tsx:56— ModelsSettingsPage.ModelsSettingsPage has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (setVisibility, a function literal at line 103, a function literal at line 113, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.laneDrawing (cyclomatic 21) packages/git-graph/src/index.ts:249— index.laneDrawing has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 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.
transfer.runDownloadPrepared (cyclomatic 21) packages/remote-client/src/transfer.ts:355— transfer.runDownloadPrepared 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.
Composer.compose (cyclomatic 21) packages/thread-projection/src/cooperativeJson.ts:144— Composer.compose 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.
liveApply.buildSegments (cyclomatic 21) REDACTED:717— liveApply.buildSegments 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.
projection.entriesToTurns (cyclomatic 21) packages/thread-projection/src/projection.ts:426— projection.entriesToTurns has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentHost::start_agent (cyclomatic 20) host/src/agent_host.rs:338— AgentHost::start_agent 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.
TransferLoop::run (cyclomatic 20) packages/remote-server/src/transfer.rs:50— TransferLoop::run 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.
useStreamingMarkdownBlocks.useStreamingMarkdownBlocks (cyclomatic 20) desktop/src/features/markdown/useStreamingMarkdownBlocks.ts:137— useStreamingMarkdownBlocks.useStreamingMarkdownBlocks has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 157, 195, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MarkdownContent.renderBlock (cyclomatic 20) desktop/src/features/markdown/MarkdownContent.tsx:168— MarkdownContent.renderBlock 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.
Composer.ComposerImpl (cyclomatic 20) desktop/src/features/agent/Composer.tsx:233— Composer.ComposerImpl has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Composer.ComposerImpl::submitValue) 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.
useRunReattach.useRunReattach (cyclomatic 20) desktop/src/features/agent/useRunReattach.ts:39— useRunReattach.useRunReattach has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 89, 140, 70, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useRemoteDoneBell.useRemoteDoneBell (cyclomatic 20) desktop/src/components/layout/hooks/useRemoteDoneBell.ts:22— useRemoteDoneBell.useRemoteDoneBell has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 40, 31). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
files.prepareFile (cyclomatic 20) mobile/src/remote/files.ts:195— files.prepareFile 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.
remarkMathFence.tokenizeMathFence (cyclomatic 20) packages/markdown/src/remarkMathFence.ts:108— remarkMathFence.tokenizeMathFence has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (contentStart, beforeContent, content, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
readPages.requestReadPage (cyclomatic 20) packages/remote-client/src/readPages.ts:50— readPages.requestReadPage has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (storeChunk, a function literal at line 83). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
replay.tailCoversRange (cyclomatic 20) packages/thread-projection/src/replay.ts:132— replay.tailCoversRange has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Transport::handshake (cyclomatic 19) packages/remote-server/src/secure.rs:268— Transport::handshake 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.
historyTransfer.read (cyclomatic 19) desktop/src/integrations/storage/historyTransfer.ts:119— historyTransfer.read has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agentStateCache.applySettingsEvent (cyclomatic 19) desktop/src/integrations/agent/agentStateCache.ts:439— agentStateCache.applySettingsEvent 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.
AttachmentChip.AttachmentChip (cyclomatic 19) desktop/src/features/agent/messages/AttachmentChip.tsx:13— AttachmentChip.AttachmentChip has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useThreadMessages.useThreadMessages.reloadThreadHistory (cyclomatic 19) desktop/src/features/agent/useThreadMessages.ts:224— useThreadMessages.useThreadMessages.reloadThreadHistory has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, 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.
dispatch.dispatchShortcut (cyclomatic 19) desktop/src/features/keyboard/dispatch.ts:101— dispatch.dispatchShortcut has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RemoteRenameDialog.RemoteRenameDialog (cyclomatic 19) desktop/src/features/remote-peer/RemoteRenameDialog.tsx:18— RemoteRenameDialog.RemoteRenameDialog has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (submit, generate, a function literal at line 101). 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.
terminal-server.server (cyclomatic 19) desktop/shot/terminal-server.mjs:101— terminal-server.server has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MarkdownText.renderInline (cyclomatic 19) mobile/src/components/MarkdownText.tsx:87— MarkdownText.renderInline has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 88). 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.
useSessionCatalog.useSessionCatalog.observeRunEvent (cyclomatic 19) mobile/src/remote/useSessionCatalog.ts:100— useSessionCatalog.useSessionCatalog.observeRunEvent 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.
useDesktopConnection.useDesktopConnection (cyclomatic 19) mobile/src/remote/useDesktopConnection.ts:237— useDesktopConnection.useDesktopConnection has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 671, 814, 848, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ActionMenu.ActionMenu (cyclomatic 19) mobile/src/components/ActionMenu.tsx:43— ActionMenu.ActionMenu has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 140, 150, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PairingScreen.pairingErrorMessage (cyclomatic 19) mobile/src/screens/PairingScreen.tsx:33— PairingScreen.pairingErrorMessage 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.
RenameModal.RenameModal (cyclomatic 19) mobile/src/features/chat/components/RenameModal.tsx:9— RenameModal.RenameModal has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (generate, save, generate::current). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useShareIntake.useShareIntake.chooseDestination (cyclomatic 19) mobile/src/share/useShareIntake.ts:74— useShareIntake.useShareIntake.chooseDestination 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.
connectionState.classifyError (cyclomatic 19) packages/remote-client/src/connectionState.ts:100— connectionState.classifyError 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. This is NOT this file's highest cyclomatic complexity: connectionState.transition (cyclomatic 24) 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.
RemoteClient.openAttempt (cyclomatic 19) packages/remote-client/src/client.ts:456— RemoteClient.openAttempt has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
projection.applyLiveEvent (cyclomatic 19) packages/remote-client/src/projection.ts:837— projection.applyLiveEvent 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.
readPages.chunkOf (cyclomatic 19) packages/remote-client/src/readPages.ts:17— readPages.chunkOf has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
EvidenceContext::observe (cyclomatic 18) agent/src/approval_review/evidence.rs:155— EvidenceContext::observe has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FeishuWsClient::connect_and_listen (cyclomatic 18) channels/src/feishu/feishu_ws.rs:192— FeishuWsClient::connect_and_listen 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.
useStreamingMarkdownBlocks.appendSuffixToNode (cyclomatic 18) desktop/src/features/markdown/useStreamingMarkdownBlocks.ts:39— useStreamingMarkdownBlocks.appendSuffixToNode 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.
SelectMenu.SelectMenu (cyclomatic 18) desktop/src/components/ui/SelectMenu.tsx:44— SelectMenu.SelectMenu has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 54, 51, 68). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GeneralPage.GeneralPage (cyclomatic 18) desktop/src/features/settings/GeneralPage.tsx:19— GeneralPage.GeneralPage has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelsPage.ModelsPage (cyclomatic 18) desktop/src/features/settings/ModelsPage.tsx:10— ModelsPage.ModelsPage has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 37, modelSubtitle, setVisibility, …). 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.
ShortcutRecorder.ShortcutRecorder (cyclomatic 18) desktop/src/features/settings/ShortcutRecorder.tsx:25— ShortcutRecorder.ShortcutRecorder has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentActivityList.labelForActivity (cyclomatic 18) desktop/src/features/agent/AgentActivityList.tsx:357— AgentActivityList.labelForActivity 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.
reconcileThreadHistory.reconcileThreadHistory (cyclomatic 18) desktop/src/features/agent/reconcileThreadHistory.ts:9— reconcileThreadHistory.reconcileThreadHistory has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 25, 36). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remoteClient.remoteConnectionPresentation (cyclomatic 18) desktop/src/features/remote/remoteClient.ts:281— remoteClient.remoteConnectionPresentation 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.
ThreadListItem.ThreadListItemImpl (cyclomatic 18) desktop/src/components/layout/ThreadListItem.tsx:20— ThreadListItem.ThreadListItemImpl 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.
DeviceChoiceDialog.DeviceChoiceDialog (cyclomatic 18) desktop/src/features/remote-peer/DeviceChoiceDialog.tsx:31— DeviceChoiceDialog.DeviceChoiceDialog 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 3 function items inside it that branch (a function literal at line 101, heldNote, a function literal at line 152). 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.
useHasProviders.useHasProviders (cyclomatic 18) desktop/src/components/layout/hooks/useHasProviders.ts:26— useHasProviders.useHasProviders has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
useFutureLoginFlow.useFutureLoginFlow (cyclomatic 18) desktop/src/features/settings/useFutureLoginFlow.ts:43— useFutureLoginFlow.useFutureLoginFlow has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 101). 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.
draftStorage.loadSessionDraftDirect (cyclomatic 18) mobile/src/remote/draftStorage.ts:115— draftStorage.loadSessionDraftDirect has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
historyPaging.retainOlderHistoryPrefix (cyclomatic 18) mobile/src/remote/timeline/historyPaging.ts:166— historyPaging.retainOlderHistoryPrefix has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 178, 173, 182, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useComposerDraft.useComposerDraft (cyclomatic 18) mobile/src/features/chat/useComposerDraft.ts:44— useComposerDraft.useComposerDraft has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 60, 125, 58, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SkillPicker.SkillPicker (cyclomatic 18) mobile/src/features/chat/components/SkillPicker.tsx:34— SkillPicker.SkillPicker has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 112, 132, 56, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sessionTree.mergedRows (cyclomatic 18) mobile/src/screens/sessionTree.ts:444— sessionTree.mergedRows has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
localPath.localFilePath (cyclomatic 18) packages/markdown/src/localPath.ts:31— localPath.localFilePath 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.
RemoteClient.signal (cyclomatic 18) packages/remote-client/src/client.ts:978— RemoteClient.signal 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.
RemoteClient.runHandshake::run (cyclomatic 18) packages/remote-client/src/client.ts:1844— RemoteClient.runHandshake::run has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
NatsHealth::handle_event (cyclomatic 17) packages/remote-server/src/health.rs:93— NatsHealth::handle_event 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.
MarkdownTheme::with_partial (cyclomatic 17) tui/src/components/markdown.rs:306— MarkdownTheme::with_partial 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.
TuiSettings::to_json (cyclomatic 17) tui/src/settings.rs:82— TuiSettings::to_json 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.
ChoiceCard.ChoiceOptionRow (cyclomatic 17) desktop/src/features/markdown/renderers/ChoiceCard.tsx:114— ChoiceCard.ChoiceOptionRow 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.
remotePeerClient.promptRemoteConversation (cyclomatic 17) desktop/src/features/remote-peer/remotePeerClient.ts:499— remotePeerClient.promptRemoteConversation 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.
FusionSettingsPage.Form (cyclomatic 17) desktop/src/features/settings/FusionSettingsPage.tsx:145— FusionSettingsPage.Form has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ShortcutsPage.ShortcutsPage (cyclomatic 17) desktop/src/features/settings/ShortcutsPage.tsx:35— ShortcutsPage.ShortcutsPage has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 171, a function literal at line 49, rowFor, …). 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.
PdfPreview.PdfPreview (cyclomatic 17) desktop/src/features/artifacts/PdfPreview.tsx:21— PdfPreview.PdfPreview has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 83, 34, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RunInspectPanel.RunInspectPanel (cyclomatic 17) desktop/src/features/runs/RunInspectPanel.tsx:59— RunInspectPanel.RunInspectPanel has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RunsPanel.RunsPanel (cyclomatic 17) desktop/src/features/runs/RunsPanel.tsx:50— RunsPanel.RunsPanel has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (archiveFinished, a function literal at line 87, a function literal at line 95, …). 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.
mentionDom.serialize (cyclomatic 17) desktop/src/features/agent/composer/mentionDom.ts:130— mentionDom.serialize has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (visit). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
remotePeerError.remotePeerErrorKind (cyclomatic 17) desktop/src/features/remote-peer/remotePeerError.ts:57— remotePeerError.remotePeerErrorKind 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.
useAgentConnection.useAgentConnection.refreshAgentModels (cyclomatic 17) desktop/src/components/layout/hooks/useAgentConnection.ts:76— useAgentConnection.useAgentConnection.refreshAgentModels has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 3 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.
useRemotePeers.handlePresence (cyclomatic 17) desktop/src/components/layout/hooks/useRemotePeers.ts:746— useRemotePeers.handlePresence has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.html.loadHistory (cyclomatic 17) host/web/index.html:882— index.html.loadHistory 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. This is NOT this file's highest cyclomatic complexity: index.html.performHandshake (cyclomatic 21) 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.
useChatFiles.useChatFiles.openLocalPath (cyclomatic 17) mobile/src/features/chat/files/useChatFiles.ts:529— useChatFiles.useChatFiles.openLocalPath has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sessionTree.groupMergedRows (cyclomatic 17) mobile/src/screens/sessionTree.ts:158— sessionTree.groupMergedRows has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
htmlBlocks.htmlBlockToNodes (cyclomatic 17) packages/markdown/src/htmlBlocks.ts:191— htmlBlocks.htmlBlockToNodes has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent 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: htmlBlocks.inlineNode (cyclomatic 18) 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.
projection.segmentToTimeline (cyclomatic 17) packages/remote-client/src/projection.ts:1082— projection.segmentToTimeline 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.
contentBody.createContentEventLane.pump (cyclomatic 17) packages/thread-projection/src/contentBody.ts:161— contentBody.createContentEventLane.pump has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Manager::read_history_entry (cyclomatic 16) agent/src/session/history/recall.rs:228— Manager::read_history_entry 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.
SkillManager::install_locked (cyclomatic 16) agent/src/skills/manager.rs:504— SkillManager::install_locked 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.
ShareInbox.take (cyclomatic 16) mobile/modules/future-share-intent/ios/ShareInbox.swift:84— ShareInbox.take 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.
storage-read-benchmark.run (cyclomatic 16) desktop/scripts/storage-read-benchmark.ts:8— storage-read-benchmark.run has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 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.
FutureEmbed.FutureEmbed (cyclomatic 16) desktop/src/features/markdown/renderers/FutureEmbed.tsx:17— FutureEmbed.FutureEmbed 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.
choiceAnswer.parseChoiceAnswer (cyclomatic 16) desktop/src/features/agent/composer/choiceAnswer.ts:122— choiceAnswer.parseChoiceAnswer has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mergeConversations.mergeRemoteSessionDelta (cyclomatic 16) desktop/src/features/remote-peer/mergeConversations.ts:466— mergeConversations.mergeRemoteSessionDelta has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
remotePeerClient.hostWorkspaceRows (cyclomatic 16) desktop/src/features/remote-peer/remotePeerClient.ts:1294— remotePeerClient.hostWorkspaceRows has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 1297). 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.
EnvironmentPage.EnvironmentPage (cyclomatic 16) desktop/src/features/settings/EnvironmentPage.tsx:25— EnvironmentPage.EnvironmentPage has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BuiltinProviderKeyDialog.BuiltinProviderKeyDialog (cyclomatic 16) desktop/src/features/settings/BuiltinProviderKeyDialog.tsx:13— BuiltinProviderKeyDialog.BuiltinProviderKeyDialog has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useContextData.useContextData.refreshContext (cyclomatic 16) desktop/src/components/layout/hooks/useContextData.ts:82— useContextData.useContextData.refreshContext 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.
GitHistoryPanel.GitHistoryPanel (cyclomatic 16) desktop/src/features/git-history/GitHistoryPanel.tsx:56— GitHistoryPanel.GitHistoryPanel has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agentStateCache.getAgentState (cyclomatic 16) desktop/src/integrations/agent/agentStateCache.ts:118— agentStateCache.getAgentState has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 138). 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.
threadSearchRanges.findThreadTextRanges (cyclomatic 16) desktop/src/features/agent/threadSearchRanges.ts:17— threadSearchRanges.findThreadTextRanges 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.
runHistoryProjection.applyRunMetadata (cyclomatic 16) desktop/src/features/agent/history/runHistoryProjection.ts:21— runHistoryProjection.applyRunMetadata has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AddToVibeDialog.AddToVibeDialog (cyclomatic 16) desktop/src/features/vibe/AddToVibeDialog.tsx:26— AddToVibeDialog.AddToVibeDialog has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 61, 200, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
VibeMenu.VibeMenu (cyclomatic 16) desktop/src/features/vibe/VibeMenu.tsx:28— VibeMenu.VibeMenu has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 57, 78, 131). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useRemoteApprovals.useRemoteApprovals (cyclomatic 16) desktop/src/features/remote-peer/useRemoteApprovals.ts:42— useRemoteApprovals.useRemoteApprovals has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 57, 101, 50, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
threadTree.buildTree (cyclomatic 16) desktop/src/components/layout/threadTree.ts:47— threadTree.buildTree 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.
DeviceSelector.DeviceSelector (cyclomatic 16) desktop/src/components/layout/DeviceSelector.tsx:21— DeviceSelector.DeviceSelector has cyclomatic complexity 16 (threshold 15). Of this number, 9 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.
fusion.fusionProgress.models (cyclomatic 16) packages/thread-projection/src/fusion.ts:121— fusion.fusionProgress.models has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.html.document.addEventListener("keydown") (cyclomatic 16) host/web/index.html:836— index.html.document.addEventListener("keydown") 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: index.html.performHandshake (cyclomatic 21) 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.
codeHighlight.highlightCode (cyclomatic 16) mobile/src/components/codeHighlight.ts:308— codeHighlight.highlightCode has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MarkdownImage.LocalImage (cyclomatic 16) mobile/src/components/MarkdownImage.tsx:76— MarkdownImage.LocalImage has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mathSvg.renderMathSvg (cyclomatic 16) mobile/src/components/mathSvg.ts:30— mathSvg.renderMathSvg has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MarkdownText.CodeSource (cyclomatic 16) mobile/src/components/MarkdownText.tsx:215— MarkdownText.CodeSource has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MarkdownText.MarkdownText (cyclomatic 16) mobile/src/components/MarkdownText.tsx:503— MarkdownText.MarkdownText has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 541, 532, 580, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
connectionPresentation.connectionPresentation (cyclomatic 16) mobile/src/remote/connectionPresentation.ts:69— connectionPresentation.connectionPresentation 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.
usePromptOutbox.usePromptOutbox.recoverPendingContinuation (cyclomatic 16) mobile/src/remote/usePromptOutbox.ts:654— usePromptOutbox.usePromptOutbox.recoverPendingContinuation has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useAttachmentPicker.useAttachmentPicker.chooseFromAlbum (cyclomatic 16) mobile/src/features/chat/useAttachmentPicker.tsx:104— useAttachmentPicker.useAttachmentPicker.chooseFromAlbum 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.
sessionTree.buildSessionTree (cyclomatic 16) mobile/src/screens/sessionTree.ts:11— sessionTree.buildSessionTree 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.
recentRows.recentHierarchy (cyclomatic 16) mobile/src/screens/recentRows.ts:169— recentRows.recentHierarchy 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.
disconnectedCopy.disconnectedCopy (cyclomatic 16) mobile/src/remote/disconnectedCopy.ts:4— disconnectedCopy.disconnectedCopy 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.
index.numberEnd (cyclomatic 16) packages/json-preview/src/index.ts:158— index.numberEnd 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.
RemoteClient.runRecovery (cyclomatic 16) packages/remote-client/src/client.ts:631— RemoteClient.runRecovery has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SyncEngine.runPrefixDecision (cyclomatic 16) packages/remote-client/src/syncEngine.ts:1048— SyncEngine.runPrefixDecision has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runIssuesEn (cyclomatic 16) harness/lib/issues-en-run.mjs:81— runIssuesEn has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ActivityRail.ActivityRail (cognitive 444) desktop/src/components/layout/ActivityRail.tsx:276— ActivityRail.ActivityRail has cognitive complexity 444 (threshold 15). Drivers by points: ternaries 106 (247 pts), if/else 63 (88 pts), boolean chains 81, loops 23 (28 pts) (nesting depth added 171). Of this number, 214 points are the body's own statements and 230 belong to 72 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.
AppShell.ReadyAppShell (cognitive 242) desktop/src/components/layout/AppShell.tsx:152— AppShell.ReadyAppShell has cognitive complexity 242 (threshold 15). Drivers by points: ternaries 64 (144 pts), if/else 46 (52 pts), boolean chains 31, error handling 10 (12 pts), loops 3 (nesting depth added 88). Of this number, 136 points are the body's own statements and 106 belong to 54 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.
runCase (cognitive 235) harness/lib/run.mjs:82— runCase has cognitive complexity 235 (threshold 15). Drivers by points: if/else 82 (147 pts), ternaries 22 (50 pts), other 48, boolean chains 21, error handling 11 (18 pts), loops 1 (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
liveApply.createProjector.processEvent (cognitive 211) REDACTED:225— liveApply.createProjector.processEvent has cognitive complexity 211 (threshold 15). Drivers by points: if/else 59 (118 pts), ternaries 21 (58 pts), boolean chains 31, loops 2 (4 pts) (nesting depth added 98). Of this number, 208 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
VibeStage.VibeStage (cognitive 187) desktop/src/features/vibe/VibeStage.tsx:147— VibeStage.VibeStage has cognitive complexity 187 (threshold 15). Drivers by points: ternaries 58 (99 pts), if/else 43 (52 pts), boolean chains 35, loops 1 (nesting depth added 50). Of this number, 75 points are the body's own statements and 112 belong to 40 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.
SessionsScreen.SessionsScreen (cognitive 183) mobile/src/screens/SessionsScreen.tsx:98— SessionsScreen.SessionsScreen has cognitive complexity 183 (threshold 15). Drivers by points: ternaries 45 (78 pts), boolean chains 53, if/else 36 (47 pts), error handling 4, loops 1 (nesting depth added 44). Of this number, 86 points are the body's own statements and 97 belong to 31 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.
TimelineCard.TimelineCardView (cognitive 157) mobile/src/features/chat/messages/TimelineCard.tsx:43— TimelineCard.TimelineCardView has cognitive complexity 157 (threshold 15). Drivers by points: ternaries 38 (122 pts), boolean chains 22, if/else 8 (12 pts), loops 1 (nesting depth added 88). Of this number, 133 points are the body's own statements and 24 belong to 6 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FusionToolRow.FusionToolRow (cognitive 139) mobile/src/features/chat/messages/FusionToolRow.tsx:14— FusionToolRow.FusionToolRow has cognitive complexity 139 (threshold 15). Drivers by points: ternaries 33 (105 pts), if/else 12 (17 pts), boolean chains 16, error handling 1 (nesting depth added 77). Of this number, 23 points are the body's own statements and 116 belong to 6 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
runCliCase (cognitive 139) harness/lib/cli-driver.mjs:99— runCliCase has cognitive complexity 139 (threshold 15). Drivers by points: if/else 26 (53 pts), ternaries 16 (42 pts), other 28, error handling 3 (8 pts), boolean chains 7, loops 1 (nesting depth added 58). Of this number, 131 points are the body's own statements and 8 belong to 16 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.
ChatScreen.ChatScreen (cognitive 117) mobile/src/features/chat/ChatScreen.tsx:72— ChatScreen.ChatScreen has cognitive complexity 117 (threshold 15). Drivers by points: ternaries 36 (44 pts), boolean chains 40, if/else 24 (27 pts), error handling 5, loops 1 (nesting depth added 11). Of this number, 51 points are the body's own statements and 66 belong to 30 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
ComposerControls.ComposerControls (cognitive 110) desktop/src/features/agent/composer/ComposerControls.tsx:104— ComposerControls.ComposerControls has cognitive complexity 110 (threshold 15). Drivers by points: ternaries 28 (77 pts), boolean chains 25, if/else 8 (nesting depth added 49). Of this number, 50 points are the body's own statements and 60 belong to 9 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RemoteContext.RemoteProvider (cognitive 109) mobile/shot/mock/RemoteContext.tsx:197— RemoteContext.RemoteProvider has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 53 (81 pts), boolean chains 17, if/else 11 (nesting depth added 28). Of this number, 35 points are the body's own statements and 74 belong to 28 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MessageBlock.MessageBlockImpl (cognitive 108) desktop/src/features/agent/MessageBlock.tsx:78— MessageBlock.MessageBlockImpl has cognitive complexity 108 (threshold 15). Drivers by points: ternaries 43 (69 pts), boolean chains 29, if/else 4 (7 pts), loops 2 (3 pts) (nesting depth added 30). Of this number, 95 points are the body's own statements and 13 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
writeReport (cognitive 104) harness/lib/report.mjs:41— writeReport has cognitive complexity 104 (threshold 15). Drivers by points: ternaries 16 (46 pts), if/else 13 (22 pts), other 17, loops 7 (15 pts), boolean chains 4 (nesting depth added 47). Of this number, 91 points are the body's own statements and 13 belong to 17 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnboardingGate.OnboardingGate (cognitive 101) desktop/src/components/layout/OnboardingGate.tsx:72— OnboardingGate.OnboardingGate has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 26 (65 pts), if/else 12 (13 pts), boolean chains 12, error handling 6 (9 pts), loops 2 (nesting depth added 43). Of this number, 67 points are the body's own statements and 34 belong to 10 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity· main (cognitive 100) · ×1
main (cognitive 100) harness/cli.mjs:54— main has cognitive complexity 100 (threshold 15). Drivers by points: if/else 25 (40 pts), loops 11 (29 pts), other 12, ternaries 6 (11 pts), error handling 2 (5 pts), boolean chains 3 (nesting depth added 41). Of this number, 89 points are the body's own statements and 11 belong to 21 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PendingApprovalCard.PendingApprovalCard (cognitive 99) mobile/src/features/chat/messages/PendingApprovalCard.tsx:36— PendingApprovalCard.PendingApprovalCard has cognitive complexity 99 (threshold 15). Drivers by points: ternaries 34 (88 pts), boolean chains 11 (nesting depth added 54). Of this number, 88 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TasksSettingsPage.TaskForm (cognitive 98) mobile/src/features/settings/TasksSettingsPage.tsx:664— TasksSettingsPage.TaskForm has cognitive complexity 98 (threshold 15). Drivers by points: ternaries 38 (69 pts), boolean chains 18, if/else 10 (11 pts) (nesting depth added 32). Of this number, 59 points are the body's own statements and 39 belong to 13 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.
useRemoteTimeline.useRemoteTimeline (cognitive 97) desktop/src/features/remote-peer/useRemoteTimeline.ts:268— useRemoteTimeline.useRemoteTimeline has cognitive complexity 97 (threshold 15). Drivers by points: if/else 46 (55 pts), boolean chains 22, ternaries 12 (17 pts), error handling 3 (nesting depth added 14). Most of this is not in the body itself: 1 of the 97 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 416, 648, 362, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runRemoteMobileCase (cognitive 93) harness/lib/remote-mobile-live.mjs:98— runRemoteMobileCase has cognitive complexity 93 (threshold 15). Drivers by points: other 41, if/else 18 (30 pts), boolean chains 8, ternaries 7 (8 pts), loops 5, error handling 1 (nesting depth added 13). Of this number, 31 points are the body's own statements and 62 belong to 28 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.
AgentThread.AgentThread (cognitive 87) desktop/src/features/agent/AgentThread.tsx:188— AgentThread.AgentThread has cognitive complexity 87 (threshold 15). Drivers by points: ternaries 35 (40 pts), if/else 19 (24 pts), boolean chains 19, loops 3, error handling 1 (nesting depth added 10). Of this number, 57 points are the body's own statements and 30 belong to 14 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
runRemoteLiveCase (cognitive 87) harness/lib/remote-live.mjs:111— runRemoteLiveCase has cognitive complexity 87 (threshold 15). Drivers by points: other 28, if/else 23 (26 pts), boolean chains 14, error handling 6 (8 pts), ternaries 7, loops 4 (nesting depth added 5). Of this number, 19 points are the body's own statements and 68 belong to 31 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
driver.main (cognitive 83) harness/tui/driver.py:232— driver.main has cognitive complexity 83 (threshold 15). Drivers by points: if/else 21 (45 pts), ternaries 5 (16 pts), boolean chains 10, error handling 3 (6 pts), loops 4 (6 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FusionStepBody.StepResponse (cognitive 82) desktop/src/features/fusion/FusionStepBody.tsx:44— FusionStepBody.StepResponse has cognitive complexity 82 (threshold 15). Drivers by points: ternaries 15 (45 pts), if/else 9 (25 pts), boolean chains 11, error handling 1 (nesting depth added 46). Of this number, 24 points are the body's own statements and 58 belong to 11 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
analyzeRun (cognitive 82) harness/lib/analyze.mjs:850— analyzeRun has cognitive complexity 82 (threshold 15). Drivers by points: other 30, if/else 9 (19 pts), boolean chains 11, ternaries 7 (11 pts), error handling 3 (6 pts), loops 3 (5 pts) (nesting depth added 19). Of this number, 57 points are the body's own statements and 25 belong to 21 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sendPipeline.runSendPipeline (cognitive 78) desktop/src/features/agent/sendPipeline.ts:74— sendPipeline.runSendPipeline has cognitive complexity 78 (threshold 15). Drivers by points: if/else 29 (53 pts), ternaries 6 (14 pts), boolean chains 10, error handling 1 (nesting depth added 32). Of this number, 66 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
replay.readRunReplay (cognitive 77) packages/thread-projection/src/replay.ts:262— replay.readRunReplay has cognitive complexity 77 (threshold 15). Drivers by points: if/else 19 (38 pts), ternaries 11 (21 pts), boolean chains 17, 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.
useSendMessage.useSendMessage (cognitive 76) mobile/src/features/chat/useSendMessage.ts:117— useSendMessage.useSendMessage has cognitive complexity 76 (threshold 15). Drivers by points: if/else 22 (40 pts), ternaries 7 (20 pts), boolean chains 10, loops 3 (5 pts), error handling 1 (nesting depth added 33). None of this is in the body itself: all 76 points belong to 9 function literals inside it that branch (lines 120, 174, 248, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionList.SessionList::renderRow (cognitive 76) mobile/src/screens/SessionList.tsx:997— SessionList.SessionList::renderRow has cognitive complexity 76 (threshold 15). Drivers by points: boolean chains 37, ternaries 18 (37 pts), if/else 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. This shape REPEATS in the file: one other method here (SessionList.SessionList) 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.
SyncEngine.applyOps (cognitive 75) packages/remote-client/src/syncEngine.ts:874— SyncEngine.applyOps has cognitive complexity 75 (threshold 15). Drivers by points: if/else 27 (61 pts), boolean chains 10, error handling 1 (3 pts), loops 1 (nesting depth added 36). Of this number, 72 points are the body's own statements and 3 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.
SessionList.SessionList (cognitive 73) mobile/src/screens/SessionList.tsx:182— SessionList.SessionList has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 68 (121 pts), boolean chains 84, if/else 49 (66 pts), loops 10 (21 pts), error handling 4 (8 pts) (nesting depth added 85). To reduce it, split the body into named stages: move each independent 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 (SessionList.SessionList::renderRow) 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.
RemoteComposer.RemoteComposer (cognitive 72) desktop/src/features/remote-peer/RemoteComposer.tsx:230— RemoteComposer.RemoteComposer has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 48 (85 pts), if/else 55 (75 pts), boolean chains 26, error handling 12 (14 pts), loops 2 (3 pts) (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. This shape REPEATS in the file: one other method here (RemoteComposer.RemoteComposer::pasteFiles) 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.
Writer::encode (cognitive 70) agent/src/session/content/journal.rs:98— Writer::encode has cognitive complexity 70 (threshold 15). Drivers by points: if/else 29 (51 pts), loops 5 (13 pts), boolean chains 5, match/switch 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.
UpdatePage.UpdatePage (cognitive 70) desktop/src/features/settings/UpdatePage.tsx:28— UpdatePage.UpdatePage has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 27 (58 pts), if/else 11 (18 pts), boolean chains 13, error handling 6 (8 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent 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 (UpdatePage.UpdatePage::handleInstall) 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.
ContextPanel.ContextPanel (cognitive 70) desktop/src/components/layout/ContextPanel.tsx:91— ContextPanel.ContextPanel has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 20 (32 pts), if/else 21 (24 pts), boolean chains 14 (nesting depth added 15). Of this number, 41 points are the body's own statements and 29 belong to 12 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApprovalPrompt.ApprovalPrompt (cognitive 68) desktop/src/features/agent/ApprovalPrompt.tsx:41— ApprovalPrompt.ApprovalPrompt has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 19 (28 pts), if/else 15 (21 pts), boolean chains 16, error handling 3 (nesting depth added 15). Of this number, 27 points are the body's own statements and 41 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteView.RemoteHostSection (cognitive 66) desktop/src/features/remote/RemoteView.tsx:82— RemoteView.RemoteHostSection has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 21 (31 pts), boolean chains 13, if/else 11, error handling 10, loops 1 (nesting depth added 10). Of this number, 32 points are the body's own statements and 34 belong to 16 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AccountPage.AccountPage (cognitive 62) desktop/src/features/settings/AccountPage.tsx:16— AccountPage.AccountPage has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 23 (53 pts), boolean chains 5, if/else 3, error handling 1 (nesting depth added 30). Of this number, 57 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TerminalPanel.TerminalPanelShell (cognitive 62) desktop/src/features/terminal/TerminalPanel.tsx:100— TerminalPanel.TerminalPanelShell has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 31 (40 pts), boolean chains 16, if/else 6 (nesting depth added 9). Of this number, 46 points are the body's own statements and 16 belong to 5 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
useRemotePeers.handleCatalog (cognitive 62) desktop/src/components/layout/hooks/useRemotePeers.ts:821— useRemotePeers.handleCatalog has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (32 pts), ternaries 12 (22 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 23). Of this number, 39 points are the body's own statements and 23 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Terminal::start (cognitive 60) tui/src/terminal.rs:442— Terminal::start has cognitive complexity 60 (threshold 15). Drivers by points: if/else 20 (43 pts), loops 3 (8 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProvidersPage.ProvidersPage (cognitive 60) desktop/src/features/settings/ProvidersPage.tsx:36— ProvidersPage.ProvidersPage has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 23 (48 pts), boolean chains 6, error handling 3, if/else 3 (nesting depth added 25). Of this number, 22 points are the body's own statements and 38 belong to 8 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.
ArtifactDetailPanel.ArtifactDetailPanel (cognitive 60) desktop/src/features/artifacts/ArtifactDetailPanel.tsx:41— ArtifactDetailPanel.ArtifactDetailPanel has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 27 (38 pts), boolean chains 15, if/else 5, error handling 2 (nesting depth added 11). Of this number, 45 points are the body's own statements and 15 belong to 9 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.
RemoteContext.RemoteProvider (cognitive 60) mobile/src/remote/RemoteContext.tsx:723— RemoteContext.RemoteProvider has cognitive complexity 60 (threshold 15). Drivers by points: if/else 29 (35 pts), boolean chains 11, loops 7, ternaries 6 (7 pts) (nesting depth added 7). None of this is in the body itself: all 60 points belong to 25 function literals inside it that branch (lines 863, 922, 808, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteClient.watchStatus (cognitive 60) packages/remote-client/src/client.ts:1259— RemoteClient.watchStatus has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 9, error handling 2 (4 pts), loops 1 (nesting depth added 27). None of this is in the body itself: all 60 points belong to one function literal inside it that branches (line 1260). 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.
MergedRows.MergedRows (cognitive 57) desktop/src/components/layout/MergedRows.tsx:46— MergedRows.MergedRows has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 22 (34 pts), if/else 8 (12 pts), boolean chains 11 (nesting depth added 16). Of this number, 32 points are the body's own statements and 25 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usePromptOutbox.usePromptOutbox.sendMessage (cognitive 57) mobile/src/remote/usePromptOutbox.ts:272— usePromptOutbox.usePromptOutbox.sendMessage has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (36 pts), ternaries 6 (11 pts), boolean chains 9, error handling 1 (nesting depth added 19). Of this number, 45 points are the body's own statements and 12 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.
SendQueuePanel.SendQueuePanel (cognitive 56) desktop/src/features/agent/SendQueuePanel.tsx:111— SendQueuePanel.SendQueuePanel has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 19 (47 pts), if/else 3 (5 pts), boolean chains 4 (nesting depth added 30). Most of this is not in the body itself: 12 of the 56 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 281, a function literal at line 425, toggleExpanded, …). 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.
RemotePeerSettings.RemotePeerSettings (cognitive 56) desktop/src/features/remote-peer/RemotePeerSettings.tsx:50— RemotePeerSettings.RemotePeerSettings has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 19 (30 pts), if/else 11 (14 pts), boolean chains 9, error handling 3 (nesting depth added 14). Of this number, 28 points are the body's own statements and 28 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useSessionMessageEvents.useSessionMessageEvents (cognitive 55) desktop/src/features/agent/runtime/useSessionMessageEvents.ts:24— useSessionMessageEvents.useSessionMessageEvents has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 13 (27 pts), if/else 14 (20 pts), boolean chains 8 (nesting depth added 20). None of this is in the body itself: all 55 points belong to 5 function literals inside it that branch (lines 38, 122, 68, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useRemotePeers.useRemotePeers (cognitive 55) desktop/src/components/layout/hooks/useRemotePeers.ts:111— useRemotePeers.useRemotePeers has cognitive complexity 55 (threshold 15). Drivers by points: if/else 26 (31 pts), error handling 9 (10 pts), ternaries 4 (8 pts), boolean chains 3, loops 3 (nesting depth added 10). None of this is in the body itself: all 55 points belong to 24 function literals inside it that branch (lines 462, 218, 389, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PairingScreen.PairingScreen (cognitive 55) mobile/src/screens/PairingScreen.tsx:84— PairingScreen.PairingScreen has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 12 (28 pts), boolean chains 13, if/else 11, error handling 3 (nesting depth added 16). Of this number, 26 points are the body's own statements and 29 belong to 11 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useDesktopConnection.useDesktopConnection.connect (cognitive 54) mobile/src/remote/useDesktopConnection.ts:387— useDesktopConnection.useDesktopConnection.connect has cognitive complexity 54 (threshold 15). Drivers by points: if/else 46 (48 pts), boolean chains 6 (nesting depth added 2). Most of this is not in the body itself: 4 of the 54 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 446, 583, 529, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useChatFiles.useChatFiles.openAttachment (cognitive 52) mobile/src/features/chat/files/useChatFiles.ts:97— useChatFiles.useChatFiles.openAttachment has cognitive complexity 52 (threshold 15). Drivers by points: if/else 22 (34 pts), ternaries 6 (15 pts), boolean chains 2, error handling 1 (nesting depth added 21). Of this number, 49 points are the body's own statements and 3 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ComposerDock.ComposerDockView (cognitive 52) mobile/src/features/chat/components/ComposerDock.tsx:37— ComposerDock.ComposerDockView has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 31, if/else 11 (13 pts), ternaries 8 (nesting depth added 2). Of this number, 32 points are the body's own statements and 20 belong to 10 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SyncEngine.runReconcile (cognitive 52) packages/remote-client/src/syncEngine.ts:571— SyncEngine.runReconcile has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 14, ternaries 7 (10 pts), error handling 1 (nesting depth added 15). Of this number, 49 points are the body's own statements and 3 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.
MentionEditor.MentionEditor::handleKeyDown (cognitive 51) desktop/src/features/agent/MentionEditor.tsx:802— MentionEditor.MentionEditor::handleKeyDown has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 12, ternaries 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.
liveApply.buildSegments (cognitive 51) REDACTED:717— liveApply.buildSegments has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (27 pts), ternaries 6 (18 pts), loops 3 (5 pts), boolean chains 1 (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.
ShareViewController.didSelectPost (cognitive 50) mobile/modules/future-share-intent/extension/ShareViewController.swift:22— ShareViewController.didSelectPost has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (29 pts), boolean chains 8, error handling 3 (6 pts), loops 2 (5 pts), ternaries 1 (2 pts) (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.
RemoteFilesPanel.RemoteFilesPanel (cognitive 50) desktop/src/features/remote-peer/RemoteFilesPanel.tsx:34— RemoteFilesPanel.RemoteFilesPanel has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 20 (30 pts), boolean chains 13, if/else 7 (nesting depth added 10). Of this number, 29 points are the body's own statements and 21 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalView.TerminalView (cognitive 50) desktop/src/features/terminal/TerminalView.tsx:63— TerminalView.TerminalView has cognitive complexity 50 (threshold 15). Drivers by points: if/else 25 (27 pts), boolean chains 15, loops 2 (3 pts), ternaries 3, error handling 2 (nesting depth added 3). None of this is in the body itself: all 50 points belong to 23 function literals inside it that branch (lines 277, 190, 79, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useChatFiles.useChatFiles.openOrShare (cognitive 50) mobile/src/features/chat/files/useChatFiles.ts:349— useChatFiles.useChatFiles.openOrShare has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (30 pts), ternaries 7 (12 pts), boolean chains 7, error handling 1 (nesting depth added 13). Of this number, 44 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ThreadSearch.ThreadSearch (cognitive 49) desktop/src/features/agent/search/ThreadSearch.tsx:32— ThreadSearch.ThreadSearch has cognitive complexity 49 (threshold 15). Drivers by points: if/else 22 (25 pts), boolean chains 15, ternaries 6 (8 pts), error handling 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 49 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 153, 124, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SessionFilesPanel.SessionFilesPanel (cognitive 49) mobile/src/features/chat/components/SessionFilesPanel.tsx:13— SessionFilesPanel.SessionFilesPanel has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 20, ternaries 10 (19 pts), if/else 7 (10 pts) (nesting depth added 12). Of this number, 20 points are the body's own statements and 29 belong to 11 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.formatJsonForPreview (cognitive 48) packages/json-preview/src/index.ts:29— index.formatJsonForPreview has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 8, ternaries 1 (3 pts), loops 1 (nesting depth added 20). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ComposerToolbar.ComposerToolbar (cognitive 47) mobile/src/features/chat/composer/ComposerToolbar.tsx:33— ComposerToolbar.ComposerToolbar has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 28, ternaries 8 (17 pts), if/else 1 (2 pts) (nesting depth added 10). Of this number, 27 points are the body's own statements and 20 belong to 8 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
deterministicFindings (cognitive 47) harness/lib/analyze.mjs:135— deterministicFindings has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (18 pts), other 14, loops 6, boolean chains 5, ternaries 2 (4 pts) (nesting depth added 10). Of this number, 46 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileTreePanel.FileTreePanel (cognitive 46) desktop/src/features/filetree/FileTreePanel.tsx:34— FileTreePanel.FileTreePanel has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 18 (29 pts), if/else 9 (11 pts), boolean chains 5, error handling 1 (nesting depth added 13). Of this number, 34 points are the body's own statements and 12 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShareIntakeMenu.ShareIntakeMenu (cognitive 46) mobile/src/share/ShareIntakeMenu.tsx:15— ShareIntakeMenu.ShareIntakeMenu has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 16 (26 pts), boolean chains 11, if/else 7 (8 pts), error handling 1 (nesting depth added 11). Of this number, 25 points are the body's own statements and 21 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Composer.compose (cognitive 46) packages/thread-projection/src/cooperativeJson.ts:144— Composer.compose has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (41 pts), boolean chains 4, 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.
ImagePreview.ImagePreview (cognitive 44) desktop/src/features/filepreview/ImagePreview.tsx:62— ImagePreview.ImagePreview has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 20, if/else 13, ternaries 10 (11 pts) (nesting depth added 1). Of this number, 20 points are the body's own statements and 24 belong to 11 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.
FusionActivity.FusionActivity (cognitive 43) desktop/src/features/agent/FusionActivity.tsx:12— FusionActivity.FusionActivity has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 21, ternaries 10 (12 pts), if/else 7 (10 pts) (nesting depth added 5). Of this number, 20 points are the body's own statements and 23 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RemoteConversationView.RemoteConversationView (cognitive 43) desktop/src/features/remote-peer/RemoteConversationView.tsx:81— RemoteConversationView.RemoteConversationView has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 21 (30 pts), boolean chains 11, if/else 2 (nesting depth added 9). Of this number, 29 points are the body's own statements and 14 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TasksView.TasksView (cognitive 43) desktop/src/features/tasks/TasksView.tsx:229— TasksView.TasksView has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 17 (22 pts), if/else 12 (13 pts), boolean chains 6, error handling 2 (nesting depth added 6). Most of this is not in the body itself: 8 of the 43 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 302, 417, 374, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
streamingMarkdown.createStreamingMarkdownParser.<returned closure> (cognitive 43) packages/markdown/src/streamingMarkdown.ts:65— streamingMarkdown.createStreamingMarkdownParser.<returned closure> has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 8 (19 pts), if/else 7 (14 pts), boolean chains 10 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TerminalServer::pump (cognitive 42) desktop/src-tauri/src/terminal/server.rs:445— TerminalServer::pump has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (31 pts), match/switch 4 (9 pts), loops 2 (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.
mergeConversations.mergeConversations (cognitive 42) desktop/src/features/remote-peer/mergeConversations.ts:594— mergeConversations.mergeConversations has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 5 (15 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 22). Of this number, 40 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils.plainText (cognitive 42) mobile/src/features/chat/utils.ts:95— utils.plainText has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 12, ternaries 3 (9 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillsSettingsPage.SkillsSettingsPage (cognitive 42) mobile/src/features/settings/SkillsSettingsPage.tsx:12— SkillsSettingsPage.SkillsSettingsPage has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 16, ternaries 11 (13 pts), if/else 6 (11 pts), error handling 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 10 of the 42 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 91, mutate, a function literal at line 65, …). 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.
mergeConversations.groupMergedRows (cognitive 41) desktop/src/features/remote-peer/mergeConversations.ts:828— mergeConversations.groupMergedRows has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 6 (14 pts), loops 5 (6 pts), boolean chains 4 (nesting depth added 16). Of this number, 36 points are the body's own statements and 5 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.
useThreadStore.useThreadStore.refreshStore (cognitive 41) desktop/src/components/layout/hooks/useThreadStore.ts:646— useThreadStore.useThreadStore.refreshStore has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 5 (9 pts), boolean chains 7, error handling 1 (nesting depth added 13). Of this number, 37 points are the body's own statements and 4 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.
useTimelineController.useTimelineController (cognitive 40) mobile/src/remote/useTimelineController.ts:75— useTimelineController.useTimelineController has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 16, if/else 16, ternaries 6, loops 1 (2 pts) (nesting depth added 1). Most of this is not in the body itself: 5 of the 40 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 624, 881, 526, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useTimelineController.useTimelineController.handleEvent (cognitive 40) mobile/src/remote/useTimelineController.ts:182— useTimelineController.useTimelineController.handleEvent has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 7, ternaries 2 (5 pts), error handling 2 (4 pts) (nesting depth added 12). Of this number, 36 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillPicker.SkillPicker (cognitive 40) mobile/src/features/chat/components/SkillPicker.tsx:34— SkillPicker.SkillPicker has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 9 (32 pts), boolean chains 5, if/else 3 (nesting depth added 23). Of this number, 21 points are the body's own statements and 19 belong to 8 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AgentHandle::drain (cognitive 39) agent/src/service/shutdown.rs:242— AgentHandle::drain has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 6 (7 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.
useTimelineController.useTimelineController.loadHistory (cognitive 39) mobile/src/remote/useTimelineController.ts:277— useTimelineController.useTimelineController.loadHistory has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 13, ternaries 3, loops 2 (nesting depth added 10). Of this number, 38 points are the body's own statements and 1 belongs 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.
OpenAiChatAdapter::decode_frame (cognitive 38) agent/src/llm/adapters/openai_chat.rs:86— OpenAiChatAdapter::decode_frame has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 3, 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.
AgentStatusGate.AgentStatusGate (cognitive 38) desktop/src/components/layout/AgentStatusGate.tsx:11— AgentStatusGate.AgentStatusGate has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 17 (28 pts), boolean chains 7, if/else 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.
FusionSettingsPage.Editor (cognitive 38) mobile/src/features/settings/FusionSettingsPage.tsx:17— FusionSettingsPage.Editor has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 21 (25 pts), boolean chains 9, if/else 3, error handling 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 22 belong to 9 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
projection.applyEvent (cognitive 38) packages/remote-client/src/projection.ts:516— projection.applyEvent has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 10, ternaries 5 (9 pts), match/switch 1 (nesting depth added 10). Of this number, 35 points are the body's own statements and 3 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.
ReasoningEffortVocabulary::parse (cognitive 37) agent/src/llm/schema.rs:403— ReasoningEffortVocabulary::parse has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, loops 3 (5 pts), match/switch 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.
FeishuWsClient::connect_and_listen (cognitive 37) channels/src/feishu/feishu_ws.rs:192— FeishuWsClient::connect_and_listen has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 5 (20 pts), if/else 5 (16 pts), loops 1 (nesting depth added 26). 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.
TransferLoop::run (cognitive 37) packages/remote-server/src/transfer.rs:50— TransferLoop::run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (29 pts), match/switch 3 (6 pts), loops 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.
index.laneDrawing (cognitive 37) packages/git-graph/src/index.ts:249— index.laneDrawing has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 6 (10 pts), loops 5 (8 pts), boolean chains 3 (nesting depth added 17). Of this number, 28 points are the body's own statements and 9 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.
runRemoteCases (cognitive 37) harness/lib/remote-driver.mjs:63— runRemoteCases has cognitive complexity 37 (threshold 15). Drivers by points: other 13, if/else 4 (12 pts), error handling 2 (7 pts), loops 2 (3 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.
index.html.mdToHtml (cognitive 36) host/web/index.html:1138— index.html.mdToHtml has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (9 pts), boolean chains 6 (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.
ConnectionStatus.useConnectionSummary (cognitive 36) mobile/src/components/ConnectionStatus.tsx:142— ConnectionStatus.useConnectionSummary has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 18 (31 pts), boolean chains 5 (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.
Projection::push (cognitive 35) agent/src/rpc/broadcaster/projection.rs:120— Projection::push has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (34 pts), boolean chains 1 (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.
RunInspectPanel.ToolCallDetail (cognitive 35) desktop/src/features/runs/RunInspectPanel.tsx:332— RunInspectPanel.ToolCallDetail has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 15 (30 pts), boolean chains 5 (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.
visual-regression.main (cognitive 35) harness/scripts/visual-regression.mjs:125— visual-regression.main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 4 (7 pts), ternaries 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.
MessageStatus.CompactionDivider (cognitive 35) mobile/src/features/chat/messages/MessageStatus.tsx:13— MessageStatus.CompactionDivider has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (33 pts), boolean chains 2 (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.
runCase::perfValue (cognitive 35) harness/lib/run.mjs:163— runCase::perfValue has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (27 pts), other 4, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Transport::handshake (cognitive 34) packages/remote-server/src/secure.rs:268— Transport::handshake has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 2, 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.
NewConversation.NewConversation (cognitive 34) desktop/src/features/agent/NewConversation.tsx:85— NewConversation.NewConversation has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 11, if/else 7, error handling 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 18 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.html.onEvent (cognitive 34) host/web/index.html:1192— index.html.onEvent has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 6, ternaries 2 (4 pts), error handling 1, match/switch 1 (nesting depth added 11). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopsScreen.DesktopsScreen (cognitive 34) mobile/src/screens/DesktopsScreen.tsx:60— DesktopsScreen.DesktopsScreen has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 15 (20 pts), boolean chains 11, if/else 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 34 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 162, a function literal at line 98, select, …). 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.
projection.entriesToTurns (cognitive 34) packages/thread-projection/src/projection.ts:426— projection.entriesToTurns has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 5, loops 1 (nesting depth added 15). Of this number, 33 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TasksView.TaskForm (cognitive 33) desktop/src/features/tasks/TasksView.tsx:506— TasksView.TaskForm has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 21 (23 pts), boolean chains 8, error handling 1, if/else 1 (nesting depth added 2). Of this number, 21 points are the body's own statements and 12 belong to 7 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ToolRow.StandardToolRow (cognitive 33) mobile/src/features/chat/messages/ToolRow.tsx:33— ToolRow.StandardToolRow has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 15, ternaries 10 (14 pts), if/else 4 (nesting depth added 4). Of this number, 26 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RemoteClient.subscribe (cognitive 33) packages/remote-client/src/client.ts:1045— RemoteClient.subscribe has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 5, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1062, 1082, 1079). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
projection.applyStandaloneCompaction (cognitive 33) packages/remote-client/src/projection.ts:779— projection.applyStandaloneCompaction has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (18 pts), if/else 7 (8 pts), boolean chains 7 (nesting depth added 6). Of this number, 25 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
future_http::dns::query::lookup (cognitive 32) packages/http/src/dns/query.rs:37— future_http::dns::query::lookup has cognitive complexity 32 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 4 (11 pts), match/switch 1 (4 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.
ReviewPanel.ReviewPanel (cognitive 32) desktop/src/features/review/ReviewPanel.tsx:21— ReviewPanel.ReviewPanel has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13 (22 pts), if/else 6 (7 pts), boolean chains 2, error handling 1 (nesting depth added 10). Of this number, 21 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadThreadHistory.loadThreadHistory (cognitive 32) desktop/src/features/agent/history/loadThreadHistory.ts:36— loadThreadHistory.loadThreadHistory has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 10, if/else 4, error handling 1 (nesting depth added 3). Of this number, 26 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PreviewModal.PreviewLayer (cognitive 32) mobile/src/features/chat/components/PreviewModal.tsx:135— PreviewModal.PreviewLayer has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 11 (20 pts), boolean chains 8, if/else 4 (nesting depth added 9). Of this number, 19 points are the body's own statements and 13 belong to 8 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.
DesktopPicker.DesktopPicker (cognitive 32) mobile/src/screens/DesktopPicker.tsx:43— DesktopPicker.DesktopPicker has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 17, ternaries 10 (12 pts), if/else 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 238, take, a function literal at line 156, …). 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.
RemoteClient.runRefreshToken (cognitive 32) packages/remote-client/src/client.ts:683— RemoteClient.runRefreshToken has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8, ternaries 3 (8 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
projection.messageToItems (cognitive 32) packages/remote-client/src/projection.ts:84— projection.messageToItems has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 6 (8 pts), boolean chains 7 (nesting depth added 6). Of this number, 29 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RunInspectPanel.RunInspectPanel (cognitive 31) desktop/src/features/runs/RunInspectPanel.tsx:59— RunInspectPanel.RunInspectPanel has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 15 (30 pts), error handling 1 (nesting depth added 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useMessagePaging.useMessagePaging (cognitive 31) desktop/src/features/agent/useMessagePaging.ts:95— useMessagePaging.useMessagePaging has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 4 (9 pts), boolean chains 6 (nesting depth added 7). Most of this is not in the body itself: 3 of the 31 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 406, 255, 451, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RailViewSwitch.RailViewSwitch (cognitive 31) desktop/src/components/layout/RailViewSwitch.tsx:41— RailViewSwitch.RailViewSwitch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 7, ternaries 3, error handling 2, loops 1 (nesting depth added 3). None of this is in the body itself: all 31 points belong to 9 function items inside it that branch (handlePointerMove, viewAt, handleKeyDown, …). 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.
judgeEvidence (cognitive 31) harness/lib/analyze.mjs:484— judgeEvidence has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 5 (7 pts), loops 2 (3 pts), other 3, boolean chains 2 (nesting depth added 10). Of this number, 29 points are the body's own statements and 2 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Session::step (cognitive 30) channels/src/providers/irc.rs:787— Session::step has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (8 pts), loops 2 (6 pts) (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.
agentStateCache.applySettingsEvent (cognitive 30) desktop/src/integrations/agent/agentStateCache.ts:439— agentStateCache.applySettingsEvent has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), ternaries 1 (3 pts), loops 2, match/switch 1 (2 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.
liveRunProjection.projectRunForLivePreview (cognitive 30) desktop/src/features/agent/runtime/liveRunProjection.ts:255— liveRunProjection.projectRunForLivePreview has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 7, error handling 2 (3 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.
RemotePeersView.RemoteClientSection (cognitive 30) desktop/src/features/remote-peer/RemotePeersView.tsx:60— RemotePeersView.RemoteClientSection has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 6, error handling 3, if/else 2 (nesting depth added 7). Of this number, 18 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TasksView.TaskDetail (cognitive 30) desktop/src/features/tasks/TasksView.tsx:891— TasksView.TaskDetail has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 16 (27 pts), boolean chains 3 (nesting depth added 11). Of this number, 17 points are the body's own statements and 13 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.
GitGraphPanel.GitGraphPanel (cognitive 30) mobile/src/features/chat/components/GitGraphPanel.tsx:71— GitGraphPanel.GitGraphPanel has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 6 (8 pts), boolean chains 6 (nesting depth added 10). Of this number, 21 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TasksSettingsPage.TasksSettingsPage (cognitive 30) mobile/src/features/settings/TasksSettingsPage.tsx:398— TasksSettingsPage.TasksSettingsPage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 6 (10 pts), boolean chains 6, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 10 of the 30 points are its own statements and the rest belongs to 7 function items inside it that branch (mutate, a function literal at line 625, a function literal at line 496, …). 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.
judgeCase (cognitive 30) harness/lib/analyze.mjs:618— judgeCase has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13, other 9, if/else 5, boolean chains 2, error handling 1. Of this number, 27 points are the body's own statements and 3 belong to 13 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.
ApprovalGate::request (cognitive 29) agent/src/rpc/approval.rs:119— ApprovalGate::request has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 6 (11 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.
mergeConversations.mergeRemoteSessionDelta (cognitive 29) desktop/src/features/remote-peer/mergeConversations.ts:466— mergeConversations.mergeRemoteSessionDelta has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 4 (6 pts), loops 4 (6 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 4 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.
useComposerDraft.useComposerDraft (cognitive 29) mobile/src/features/chat/useComposerDraft.ts:44— useComposerDraft.useComposerDraft has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (6 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 60, 125, 58, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
approval.parseAction (cognitive 29) packages/thread-projection/src/approval.ts:98— approval.parseAction has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 11, boolean chains 10, if/else 6, error handling 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.
runRemoteCnCase (cognitive 29) harness/lib/remote-cn.mjs:80— runRemoteCnCase has cognitive complexity 29 (threshold 15). Drivers by points: other 12, if/else 9 (10 pts), boolean chains 4, ternaries 1 (2 pts), error handling 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.
AnsiCodeTracker::feed (cognitive 28) tui/src/utils.rs:468— AnsiCodeTracker::feed has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, 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.
ShareInbox.take (cognitive 28) mobile/modules/future-share-intent/ios/ShareInbox.swift:84— ShareInbox.take has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (14 pts), boolean chains 8, loops 2 (4 pts), error handling 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.
AppShellDialogs.AppShellDialogs (cognitive 28) desktop/src/components/layout/AppShellDialogs.tsx:88— AppShellDialogs.AppShellDialogs has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 19 (25 pts), boolean chains 3 (nesting depth added 6). Of this number, 24 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SkillsView.AllTab (cognitive 28) desktop/src/features/skills/SkillsView.tsx:495— SkillsView.AllTab has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 11, if/else 3 (nesting depth added 5). Most of this is not in the body itself: 5 of the 28 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 560, 591, 603). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useAgentStatus.useAgentStatus (cognitive 28) desktop/src/components/layout/hooks/useAgentStatus.ts:26— useAgentStatus.useAgentStatus has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, ternaries 5 (8 pts), error handling 1 (nesting depth added 4). None of this is in the body itself: all 28 points belong to 9 function literals inside it that branch (lines 63, 91, 86, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteClient.connectSocket (cognitive 28) packages/remote-client/src/client.ts:740— RemoteClient.connectSocket has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 11, error handling 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.
(anonymous) (cognitive 28) desktop/shot/terminal-server.mjs:101— (anonymous) has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, other 5, error handling 1 (2 pts) (nesting depth added 5). Of this number, 17 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bodyFor (cognitive 28) harness/lib/issues-en.mjs:85— bodyFor has cognitive complexity 28 (threshold 15). Drivers by points: other 10, ternaries 10, if/else 2 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 3). Of this number, 22 points are the body's own statements and 6 belong to 5 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.
AnthropicMessagesAdapter::decode_frame (cognitive 27) agent/src/llm/adapters/anthropic.rs:127— AnthropicMessagesAdapter::decode_frame has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 4 (8 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.
Composer.ComposerImpl::submitValue (cognitive 27) desktop/src/features/agent/Composer.tsx:542— Composer.ComposerImpl::submitValue has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 9 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Composer.ComposerImpl) 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.
ApprovalPrompt.ActionDetails (cognitive 27) desktop/src/features/agent/ApprovalPrompt.tsx:322— ApprovalPrompt.ActionDetails has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 6, if/else 5 (nesting depth added 8). Of this number, 25 points are the body's own statements and 2 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.
ThinkingBlock.ThinkingBlock (cognitive 27) desktop/src/features/agent/ThinkingBlock.tsx:38— ThinkingBlock.ThinkingBlock has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 6, if/else 3 (nesting depth added 5). Of this number, 21 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MessageStatus.CompactionDivider (cognitive 27) desktop/src/features/agent/messages/MessageStatus.tsx:30— MessageStatus.CompactionDivider has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (25 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SkillsView.SkillsView (cognitive 27) desktop/src/features/skills/SkillsView.tsx:52— SkillsView.SkillsView has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (20 pts), error handling 3, boolean chains 2, loops 1, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 143, 81, 214, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteFilesDialog.RemoteFilesDialog (cognitive 27) desktop/src/features/remote-peer/RemoteFilesDialog.tsx:24— RemoteFilesDialog.RemoteFilesDialog has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (15 pts), if/else 4 (5 pts), boolean chains 4, error handling 3 (nesting depth added 7). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 154, a function literal at line 71, download, …). 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.
htmlBlocks.htmlBlockToNodes (cognitive 27) packages/markdown/src/htmlBlocks.ts:191— htmlBlocks.htmlBlockToNodes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 12). Of this number, 26 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppState::reconcile_provider_references (cognitive 26) agent/src/rpc/mod.rs:324— AppState::reconcile_provider_references has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (5 pts), match/switch 1 (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.
useRemoteConversationSettings.useRemoteConversationSettings (cognitive 26) desktop/src/features/remote-peer/useRemoteConversationSettings.ts:153— useRemoteConversationSettings.useRemoteConversationSettings has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 7, ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 323, 248, 301, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.html.loadHistory (cognitive 26) host/web/index.html:882— index.html.loadHistory has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useComposerSubmission.useComposerSubmission (cognitive 26) mobile/src/features/chat/composer/useComposerSubmission.ts:37— useComposerSubmission.useComposerSubmission has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7, ternaries 2 (nesting depth added 3). None of this is in the body itself: all 26 points belong to 2 function literals inside it that branch (lines 46, 67). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sessionTree.catalogRows (cognitive 26) mobile/src/screens/sessionTree.ts:603— sessionTree.catalogRows has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, loops 4, ternaries 1 (3 pts) (nesting depth added 8). Of this number, 14 points are the body's own statements and 12 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.
syncEngine.mergeLiveInto (cognitive 26) packages/remote-client/src/syncEngine.ts:1261— syncEngine.mergeLiveInto has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 10, if/else 10, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 1294, 1356, 1275, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
contentBody.createContentEventLane.pump (cognitive 26) packages/thread-projection/src/contentBody.ts:161— contentBody.createContentEventLane.pump has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, error handling 2 (4 pts), loops 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
draftIssues (cognitive 26) harness/lib/issues.mjs:55— draftIssues has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), other 8, loops 3, boolean chains 2, error handling 1 (2 pts), ternaries 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 4 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RunApprovalReviewer::review_action (cognitive 25) agent/src/approval_review/context.rs:108— RunApprovalReviewer::review_action has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (9 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PolicyEngine::check_group (cognitive 25) channels/src/policy.rs:110— PolicyEngine::check_group has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, 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.
SettingsDialog.SettingsDialog (cognitive 25) desktop/src/features/settings/SettingsDialog.tsx:67— SettingsDialog.SettingsDialog has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 13, boolean chains 9, if/else 3. Of this number, 14 points are the body's own statements and 11 belong to 5 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.
FusionDiscussionPanel.StepCard (cognitive 25) desktop/src/features/fusion/FusionDiscussionPanel.tsx:86— FusionDiscussionPanel.StepCard has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (19 pts), boolean chains 5, if/else 1 (nesting depth added 11). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
useThreadMessages.useThreadMessages (cognitive 25) desktop/src/features/agent/useThreadMessages.ts:53— useThreadMessages.useThreadMessages has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (8 pts), boolean chains 5 (nesting depth added 5). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 170, 383, 131, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useAppLifecycle.useAppLifecycle (cognitive 25) mobile/src/remote/useAppLifecycle.ts:50— useAppLifecycle.useAppLifecycle has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 4). None of this is in the body itself: all 25 points belong to 8 function literals inside it that branch (lines 80, 125, 59, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SettingsScreen.SettingsScreen (cognitive 25) mobile/src/features/settings/SettingsScreen.tsx:105— SettingsScreen.SettingsScreen has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 27 (42 pts), boolean chains 31, if/else 13 (17 pts), error handling 4, 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. This shape REPEATS in the file: one other method here (SettingsScreen.SettingsScreen::renderLevel) 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.
retainedSize.retainedSize (cognitive 25) packages/remote-client/src/retainedSize.ts:4— retainedSize.retainedSize has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 7 (11 pts), boolean chains 1 (nesting depth added 12). 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.
Composer.string (cognitive 25) packages/thread-projection/src/cooperativeJson.ts:76— Composer.string has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 1 (3 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.
ContentSequence::stamp (cognitive 24) agent/src/rpc/broadcaster/content_sequence.rs:26— ContentSequence::stamp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 6, 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.
Database::open_cancellable (cognitive 24) agent/src/session/database/mod.rs:128— Database::open_cancellable has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 6 (11 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.
DingtalkChannel::run_with_data_dir (cognitive 24) channels/src/dingtalk/mod.rs:54— DingtalkChannel::run_with_data_dir has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (9 pts), loops 2 (3 pts) (nesting depth added 14). 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.
FeishuChannel::run (cognitive 24) channels/src/feishu/mod.rs:36— FeishuChannel::run has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (9 pts), loops 2 (3 pts) (nesting depth added 14). 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.
AgentHost::start_agent (cognitive 24) host/src/agent_host.rs:338— AgentHost::start_agent has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 6 (10 pts), boolean chains 1, 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.
GitHistoryPanel.GitHistoryPanel (cognitive 24) desktop/src/features/git-history/GitHistoryPanel.tsx:56— GitHistoryPanel.GitHistoryPanel has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (20 pts), if/else 3, boolean chains 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RunsPanel.ToolRow (cognitive 24) desktop/src/features/runs/RunsPanel.tsx:233— RunsPanel.ToolRow has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (18 pts), boolean chains 3, if/else 3 (nesting depth added 6). Of this number, 20 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteWorkspaceMenu.RemoteWorkspaceMenu (cognitive 24) desktop/src/features/remote-peer/RemoteWorkspaceMenu.tsx:31— RemoteWorkspaceMenu.RemoteWorkspaceMenu has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (22 pts), boolean chains 1, error handling 1 (nesting depth added 11). Of this number, 21 points are the body's own statements and 3 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.
RemoteProvidersPanel.RemoteProvidersPanel (cognitive 24) desktop/src/features/remote-peer/RemoteProvidersPanel.tsx:32— RemoteProvidersPanel.RemoteProvidersPanel has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 5, error handling 2 (nesting depth added 4). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 157, a function literal at line 50, write, …). 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.
SkillsView.InstalledTab (cognitive 24) desktop/src/features/skills/SkillsView.tsx:363— SkillsView.InstalledTab has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 4 (5 pts), ternaries 5, loops 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 452, 400). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MarkdownText.renderBlock (cognitive 24) mobile/src/components/MarkdownText.tsx:306— MarkdownText.renderBlock has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (21 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.
useChatFiles.useChatFiles.fetchDownload (cognitive 24) mobile/src/features/chat/files/useChatFiles.ts:290— useChatFiles.useChatFiles.fetchDownload has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 2 (4 pts) (nesting depth added 7). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 320, 334). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SendQueuePanel.SendQueuePanel (cognitive 24) mobile/src/features/chat/components/SendQueuePanel.tsx:99— SendQueuePanel.SendQueuePanel has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 20, ternaries 3, if/else 1. Of this number, 23 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
sessionTree.filterArchivedRows (cognitive 24) mobile/src/screens/sessionTree.ts:354— sessionTree.filterArchivedRows has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (4 pts), ternaries 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.
recentRows.recentHierarchy (cognitive 24) mobile/src/screens/recentRows.ts:169— recentRows.recentHierarchy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 6 (8 pts), boolean chains 4 (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.
ModelsSettingsPage.ModelsSettingsPage (cognitive 24) mobile/src/features/settings/ModelsSettingsPage.tsx:56— ModelsSettingsPage.ModelsSettingsPage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, ternaries 3, loops 2 (nesting depth added 3). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (setVisibility, a function literal at line 103, a function literal at line 113, …). 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.
SettingsScreen.SettingsScreen::renderLevel (cognitive 24) mobile/src/features/settings/SettingsScreen.tsx:243— SettingsScreen.SettingsScreen::renderLevel has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 6, if/else 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SettingsScreen.SettingsScreen) 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.
remarkLatexMath.tokenizeMath.<returned closure> (cognitive 24) packages/markdown/src/remarkLatexMath.ts:84— remarkLatexMath.tokenizeMath.<returned closure> has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 6, ternaries 5 (6 pts) (nesting depth added 2). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 7 function items inside it that branch (between, escaped, tokenizeClose::after, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
transfer.runDownloadPrepared (cognitive 24) packages/remote-client/src/transfer.ts:355— transfer.runDownloadPrepared has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 2 (3 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.
RemoteClient.runHandshake (cognitive 24) packages/remote-client/src/client.ts:1826— RemoteClient.runHandshake has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 2 function items inside it that branch (run, exchange). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
projection.segmentToTimeline (cognitive 24) packages/remote-client/src/projection.ts:1082— projection.segmentToTimeline has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (22 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Checkpointer::open (cognitive 23) agent/src/session/database/wal.rs:26— Checkpointer::open has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 3 (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.
ChannelSink::push (cognitive 23) channels/src/bridge/sink.rs:268— ChannelSink::push has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Email::poll (cognitive 23) channels/src/providers/email.rs:2523— Email::poll has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (15 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.
JsonPreview.JsonPreview (cognitive 23) desktop/src/features/filepreview/JsonPreview.tsx:18— JsonPreview.JsonPreview has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 6, if/else 5, error handling 1 (2 pts) (nesting depth added 5). Of this number, 13 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatabaseOrganization.DatabaseOrganization (cognitive 23) desktop/src/features/settings/DatabaseOrganization.tsx:45— DatabaseOrganization.DatabaseOrganization has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 6, loops 3 (4 pts), error handling 2 (3 pts), if/else 2 (3 pts) (nesting depth added 6). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to one function item inside it that branches (organize). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
FileTreeNode.FileTreeNode (cognitive 23) desktop/src/features/filetree/FileTreeNode.tsx:43— FileTreeNode.FileTreeNode has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (19 pts), boolean chains 2, if/else 2 (nesting depth added 10). Of this number, 21 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteModelsPanel.RemoteModelsPanel (cognitive 23) desktop/src/features/remote-peer/RemoteModelsPanel.tsx:23— RemoteModelsPanel.RemoteModelsPanel has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), ternaries 6, loops 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 67, setVisibility, a function literal at line 142, …). 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.
terminal-server.server (cognitive 23) desktop/shot/terminal-server.mjs:101— terminal-server.server has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MarkdownText.CodeSource (cognitive 23) mobile/src/components/MarkdownText.tsx:215— MarkdownText.CodeSource has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13 (21 pts), boolean chains 2 (nesting depth added 8). Of this number, 13 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ThinkingRow.ThinkingRow (cognitive 23) mobile/src/features/chat/messages/ThinkingRow.tsx:43— ThinkingRow.ThinkingRow has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, ternaries 8 (9 pts), if/else 4 (nesting depth added 1). Of this number, 17 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useAttachmentPicker.useAttachmentPicker.pick (cognitive 23) mobile/src/features/chat/useAttachmentPicker.tsx:71— useAttachmentPicker.useAttachmentPicker.pick has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (5 pts), loops 2 (3 pts), ternaries 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.
sessionTree.archivedRows (cognitive 23) mobile/src/screens/sessionTree.ts:252— sessionTree.archivedRows has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 5 (8 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). Of this number, 21 points are the body's own statements and 2 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.
localPath.localFilePath (cognitive 23) packages/markdown/src/localPath.ts:31— localPath.localFilePath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 2 (5 pts), boolean chains 2, error handling 1 (2 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.
RemoteClient.subscribeState (cognitive 23) packages/remote-client/src/client.ts:1192— RemoteClient.subscribeState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 8). None of this is in the body itself: all 23 points belong to one function literal inside it that branches (line 1194). 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.
replay.tailCoversRange (cognitive 23) packages/thread-projection/src/replay.ts:132— replay.tailCoversRange has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 8, loops 1 (2 pts), ternaries 1 (nesting depth added 7). Of this number, 20 points are the body's own statements and 3 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.
ChildSession::wait_for_output (cognitive 22) host/src/fusion.rs:1087— ChildSession::wait_for_output has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 1 (3 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.
future_fusion::config::settings_patch_from_args (cognitive 22) orchestration/fusion/src/config.rs:155— future_fusion::config::settings_patch_from_args has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (3 pts), boolean chains 2, 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.
remotePeerClient.normalizeRemoteSessionRows (cognitive 22) desktop/src/features/remote-peer/remotePeerClient.ts:293— remotePeerClient.normalizeRemoteSessionRows has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13, boolean chains 6, if/else 3. Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 296). 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.
RemoteApprovalMenu.RemoteApprovalMenu (cognitive 22) desktop/src/features/remote-peer/RemoteApprovalMenu.tsx:35— RemoteApprovalMenu.RemoteApprovalMenu has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 7, ternaries 3 (4 pts), error handling 1 (nesting depth added 1). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 141, choose, a function literal at line 77, …). 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.
PdfPreview.PdfPreview (cognitive 22) desktop/src/features/artifacts/PdfPreview.tsx:21— PdfPreview.PdfPreview has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 2 (6 pts), boolean chains 2, error handling 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 83, 34, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useThreadStore.useThreadStore (cognitive 22) desktop/src/components/layout/hooks/useThreadStore.ts:365— useThreadStore.useThreadStore has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, loops 2 (3 pts), ternaries 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 861, 448, 890, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
threadTree.buildTree (cognitive 22) desktop/src/components/layout/threadTree.ts:47— threadTree.buildTree has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 4 (8 pts), boolean chains 3, ternaries 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.
files.prepareFile (cognitive 22) mobile/src/remote/files.ts:195— files.prepareFile has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 4 (6 pts), error handling 3 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usePromptOutbox.usePromptOutbox.continueRun (cognitive 22) mobile/src/remote/usePromptOutbox.ts:581— usePromptOutbox.usePromptOutbox.continueRun has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 594). 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.
useSkillRecommendation.useSkillRecommendation (cognitive 22) mobile/src/features/chat/useSkillRecommendation.ts:115— useSkillRecommendation.useSkillRecommendation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, boolean chains 3, error handling 2, ternaries 2. Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 152, 205, 135, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useCompactContext.useCompactContext.compact (cognitive 22) mobile/src/features/chat/useCompactContext.ts:30— useCompactContext.useCompactContext.compact has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 2 (5 pts), error handling 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessionTree.buildSessionTree (cognitive 22) mobile/src/screens/sessionTree.ts:11— sessionTree.buildSessionTree has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 4 (8 pts), boolean chains 3, ternaries 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.
RemoteClient.openAttempt (cognitive 22) packages/remote-client/src/client.ts:456— RemoteClient.openAttempt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, error handling 1 (nesting depth added 6). Of this number, 17 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.
RemoteClient.signal (cognitive 22) packages/remote-client/src/client.ts:978— RemoteClient.signal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, 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.
perfDigest (cognitive 22) harness/lib/analyze.mjs:546— perfDigest has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 3, loops 2 (3 pts), other 3, boolean chains 2 (nesting depth added 8). Of this number, 21 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Observed::device_lines (cognitive 21) cli/src/commands/remote.rs:1371— Observed::device_lines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 5 (9 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.
Agent::supervise (cognitive 21) cli/src/headless/agent.rs:61— Agent::supervise has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (3 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.
ShareViewController.loadFile (cognitive 21) mobile/modules/future-share-intent/extension/ShareViewController.swift:123— ShareViewController.loadFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, ternaries 1 (2 pts), error handling 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.
MarkdownContent.renderBlock (cognitive 21) desktop/src/features/markdown/MarkdownContent.tsx:168— MarkdownContent.renderBlock has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (19 pts), boolean chains 1, match/switch 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.
AgentActivityList.labelForActivity (cognitive 21) desktop/src/features/agent/AgentActivityList.tsx:357— AgentActivityList.labelForActivity has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 5 (10 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
remoteClient.remoteConnectionPresentation (cognitive 21) desktop/src/features/remote/remoteClient.ts:281— remoteClient.remoteConnectionPresentation has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 7, boolean chains 2 (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.
ThreadListItem.ThreadListItemImpl (cognitive 21) desktop/src/components/layout/ThreadListItem.tsx:20— ThreadListItem.ThreadListItemImpl has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11 (16 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useDesktopConnection.useDesktopConnection (cognitive 21) mobile/src/remote/useDesktopConnection.ts:237— useDesktopConnection.useDesktopConnection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 671, 862, 814, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ActionMenu.ActionMenu (cognitive 21) mobile/src/components/ActionMenu.tsx:43— ActionMenu.ActionMenu has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (7 pts), ternaries 3 (nesting depth added 3). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 140, 150, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sessionTree.mergedRows (cognitive 21) mobile/src/screens/sessionTree.ts:444— sessionTree.mergedRows has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (7 pts), loops 4 (6 pts), boolean chains 5, if/else 2 (3 pts) (nesting depth added 5). Of this number, 13 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useShareIntake.useShareIntake.chooseDestination (cognitive 21) mobile/src/share/useShareIntake.ts:74— useShareIntake.useShareIntake.chooseDestination has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, ternaries 4 (7 pts), boolean chains 4, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
transfer.runPrepareDownload (cognitive 21) packages/remote-client/src/transfer.ts:273— transfer.runPrepareDownload has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 3 (5 pts), loops 1, ternaries 1 (nesting depth added 9). Of this number, 17 points are the body's own statements and 4 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.
RemoteClient.handleFailure (cognitive 21) packages/remote-client/src/client.ts:850— RemoteClient.handleFailure has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 5 (9 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.
SyncEngine.replayInto (cognitive 21) packages/remote-client/src/syncEngine.ts:785— SyncEngine.replayInto has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, ternaries 2 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
contentRange.applyContentRange (cognitive 21) packages/thread-projection/src/contentRange.ts:4— contentRange.applyContentRange has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (2 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.
DingtalkWsClient::connect_and_listen (cognitive 20) channels/src/dingtalk/dingtalk_ws.rs:122— DingtalkWsClient::connect_and_listen has cognitive complexity 20 (threshold 15). Drivers by points: if/else 2 (10 pts), match/switch 3 (9 pts), 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.
StdinBuffer::process (cognitive 20) tui/src/stdin_buffer.rs:229— StdinBuffer::process has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShareInbox.copyFile (cognitive 20) mobile/modules/future-share-intent/ios/ShareInbox.swift:160— ShareInbox.copyFile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
storage-read-benchmark.run (cognitive 20) desktop/scripts/storage-read-benchmark.ts:8— storage-read-benchmark.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (5 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 7). Of this number, 15 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.
RemoteComposer.RemoteComposer::pasteFiles (cognitive 20) desktop/src/features/remote-peer/RemoteComposer.tsx:594— RemoteComposer.RemoteComposer::pasteFiles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 1 (3 pts), ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RemoteComposer.RemoteComposer) 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.
FusionDiscussionPanel.FusionDiscussionPanel (cognitive 20) desktop/src/features/fusion/FusionDiscussionPanel.tsx:18— FusionDiscussionPanel.FusionDiscussionPanel has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, ternaries 5 (6 pts) (nesting depth added 1). Of this number, 19 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
recentOrder.recentTree (cognitive 20) desktop/src/components/layout/recentOrder.ts:174— recentOrder.recentTree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddToVibeDialog.AddToVibeDialog (cognitive 20) desktop/src/features/vibe/AddToVibeDialog.tsx:26— AddToVibeDialog.AddToVibeDialog has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 5 (7 pts), boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 61, 200, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remotePeerError.remotePeerErrorKind (cognitive 20) desktop/src/features/remote-peer/remotePeerError.ts:57— remotePeerError.remotePeerErrorKind has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (20 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.
DeviceSelector.DeviceSelector (cognitive 20) desktop/src/components/layout/DeviceSelector.tsx:21— DeviceSelector.DeviceSelector has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 4, error handling 1, if/else 1 (nesting depth added 5). Of this number, 10 points are the body's own statements and 10 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.
index.html.inlineToHtml (cognitive 20) host/web/index.html:1082— index.html.inlineToHtml has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MarkdownImage.LocalImage (cognitive 20) mobile/src/components/MarkdownImage.tsx:76— MarkdownImage.LocalImage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (8 pts), boolean chains 2, error handling 1 (nesting depth added 5). Of this number, 12 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useChatFiles.useChatFiles.openLocalPath (cognitive 20) mobile/src/features/chat/files/useChatFiles.ts:529— useChatFiles.useChatFiles.openLocalPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 4 (7 pts), boolean chains 1, error handling 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 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.
ChatTimeline.ChatTimeline (cognitive 20) mobile/src/features/chat/components/ChatTimeline.tsx:42— ChatTimeline.ChatTimeline has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, ternaries 4 (5 pts) (nesting depth added 1). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
parseFutureMarkdown.collectBlockReferences (cognitive 20) packages/markdown/src/parseFutureMarkdown.ts:779— parseFutureMarkdown.collectBlockReferences has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 5, boolean chains 1 (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.
connectionState.classifyError (cognitive 20) packages/remote-client/src/connectionState.ts:100— connectionState.classifyError has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, ternaries 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.
format.classifyAgentError (cognitive 20) packages/thread-projection/src/format.ts:84— format.classifyAgentError has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
replyDuplicates.collapseReplyDuplicates (cognitive 20) packages/thread-projection/src/replyDuplicates.ts:27— replyDuplicates.collapseReplyDuplicates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
DeltaFolder::push (cognitive 19) agent/src/rpc/run_snapshot.rs:200— DeltaFolder::push has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3 (nesting depth added 9). 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.
Signal::run (cognitive 19) channels/src/providers/signal.rs:499— Signal::run has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). 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.
EventStreamDecoder::feed (cognitive 19) cli/src/commands/mcp_http.rs:425— EventStreamDecoder::feed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (18 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.
AgentClient::execute_command (cognitive 19) host/src/agent_client.rs:24— AgentClient::execute_command has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (19 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
historyTransfer.read (cognitive 19) desktop/src/integrations/storage/historyTransfer.ts:119— historyTransfer.read has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, 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.
FutureEmbed.FutureEmbed (cognitive 19) desktop/src/features/markdown/renderers/FutureEmbed.tsx:17— FutureEmbed.FutureEmbed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 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.
ShortcutsPage.ShortcutsPage (cognitive 19) desktop/src/features/settings/ShortcutsPage.tsx:35— ShortcutsPage.ShortcutsPage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 5, boolean chains 2 (nesting depth added 2). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 171, a function literal at line 49, a function literal at line 69, …). 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.
UpdatePage.UpdatePage::handleInstall (cognitive 19) desktop/src/features/settings/UpdatePage.tsx:91— UpdatePage.UpdatePage::handleInstall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 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. This shape REPEATS in the file: one other method here (UpdatePage.UpdatePage) 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.
AttachmentChip.AttachmentChip (cognitive 19) desktop/src/features/agent/messages/AttachmentChip.tsx:13— AttachmentChip.AttachmentChip has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 6, boolean chains 4, error handling 1 (nesting depth added 1). Of this number, 10 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useThreadCompaction.useThreadCompaction (cognitive 19) desktop/src/features/agent/runtime/useThreadCompaction.ts:24— useThreadCompaction.useThreadCompaction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 3). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 29, 53, 70). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteDraftTargetChooser.RemoteDraftTargetChooser (cognitive 19) desktop/src/features/remote-peer/RemoteDraftTargetChooser.tsx:31— RemoteDraftTargetChooser.RemoteDraftTargetChooser has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (17 pts), boolean chains 2 (nesting depth added 6). Of this number, 15 points are the body's own statements and 4 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.
storage.readRegistry (cognitive 19) mobile/src/remote/storage.ts:139— storage.readRegistry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, error handling 1 (2 pts), 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.
video-judge.buildCorpus (cognitive 19) harness/scripts/video-judge.mjs:50— video-judge.buildCorpus has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (5 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (walk, walk::collect). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useOlderHistory.useOlderHistory.loadOlderTimeline (cognitive 19) mobile/src/remote/timeline/useOlderHistory.ts:45— useOlderHistory.useOlderHistory.loadOlderTimeline has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, error handling 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, 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.
PairingScreen.pairingErrorMessage (cognitive 19) mobile/src/screens/PairingScreen.tsx:33— PairingScreen.pairingErrorMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, ternaries 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.
sessionTree.groupMergedRows (cognitive 19) mobile/src/screens/sessionTree.ts:158— sessionTree.groupMergedRows has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 5 (7 pts), boolean chains 1, loops 1 (nesting depth added 6). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 191). 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.
remarkMathFence.tokenizeMathFence (cognitive 19) packages/markdown/src/remarkMathFence.ts:108— remarkMathFence.tokenizeMathFence has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 4, ternaries 1. Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 7 function items inside it that branch (contentStart, beforeContent, content, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
readPages.requestReadPage (cognitive 19) packages/remote-client/src/readPages.ts:50— readPages.requestReadPage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (storeChunk, a function literal at line 83). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ChromiumSession::press (cognitive 18) cli/src/browser/chromium/chromium_session.rs:714— ChromiumSession::press has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 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.
Tracker::arm (cognitive 18) host/src/startup.rs:138— Tracker::arm has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), boolean chains 2, 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.
generate.generate (cognitive 18) packages/remote-protocol/scripts/generate.py:29— generate.generate has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (9 pts), if/else 3 (6 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). 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.
GeneralPage.GeneralPage (cognitive 18) desktop/src/features/settings/GeneralPage.tsx:19— GeneralPage.GeneralPage has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 5 (nesting depth added 3). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BuiltinProviderKeyDialog.BuiltinProviderKeyDialog (cognitive 18) desktop/src/features/settings/BuiltinProviderKeyDialog.tsx:13— BuiltinProviderKeyDialog.BuiltinProviderKeyDialog has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 7, boolean chains 1, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (save, a function literal at line 40, run). 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.
ResetPage.ResetPage (cognitive 18) desktop/src/features/settings/ResetPage.tsx:9— ResetPage.ResetPage has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (13 pts), boolean chains 3, error handling 2 (nesting depth added 5). Of this number, 14 points are the body's own statements and 4 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.
ShortcutRecorder.ShortcutRecorder (cognitive 18) desktop/src/features/settings/ShortcutRecorder.tsx:25— ShortcutRecorder.ShortcutRecorder has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 7, boolean chains 3 (nesting depth added 1). Of this number, 9 points are the body's own statements and 9 belong to 4 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.
threadSearchRanges.findThreadTextRanges (cognitive 18) desktop/src/features/agent/threadSearchRanges.ts:17— threadSearchRanges.findThreadTextRanges has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), loops 4 (6 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteConversationRow.RemoteConversationRow (cognitive 18) desktop/src/components/layout/RemoteConversationRow.tsx:28— RemoteConversationRow.RemoteConversationRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (15 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.
useTerminalPanel.loadPrefs (cognitive 18) desktop/src/features/terminal/useTerminalPanel.ts:46— useTerminalPanel.loadPrefs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (5 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.onSessionsUpdate (cognitive 18) host/web/index.html:565— index.html.onSessionsUpdate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4 (nesting depth added 7). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usePromptOutbox.usePromptOutbox.recoverPendingContinuation (cognitive 18) mobile/src/remote/usePromptOutbox.ts:654— usePromptOutbox.usePromptOutbox.recoverPendingContinuation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 665). 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.
useDesktopRuntime.useDesktopRuntime (cognitive 18) mobile/src/remote/useDesktopRuntime.ts:115— useDesktopRuntime.useDesktopRuntime has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 1. Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 226, 422, 145, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RenameModal.RenameModal (cognitive 18) mobile/src/features/chat/components/RenameModal.tsx:9— RenameModal.RenameModal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 3 (4 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (generate, save, generate::current). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
leanRender.leanTargetForToolCall (cognitive 18) mobile/shot/mock/leanRender.ts:56— leanRender.leanTargetForToolCall has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (4 pts), error handling 1 (2 pts), ternaries 1 (2 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.
index.numberEnd (cognitive 18) packages/json-preview/src/index.ts:158— index.numberEnd has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, loops 3 (6 pts), boolean chains 4, ternaries 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.
RemoteClient.subscribeLiveness (cognitive 18) packages/remote-client/src/client.ts:1156— RemoteClient.subscribeLiveness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, error handling 1 (nesting depth added 5). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 1162). 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.
projection.foldAssistantEntry (cognitive 18) packages/thread-projection/src/projection.ts:254— projection.foldAssistantEntry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (6 pts), boolean chains 2, 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.
installEventHandlers (cognitive 18) harness/lib/cdp.mjs:291— installEventHandlers has cognitive complexity 18 (threshold 15). Drivers by points: other 10, if/else 6, boolean chains 1, error handling 1. None of this is in the body itself: all 18 points belong to 10 function literals inside it that branch (lines 298, 310, 334, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Text::parse_target (cognitive 17) agent/src/session/title_preview.rs:170— Text::parse_target has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, 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.
AgentMessage::new_user (cognitive 17) agent/src/types/mod.rs:565— AgentMessage::new_user has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (6 pts) (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.
Irc::session (cognitive 17) channels/src/providers/irc.rs:1097— Irc::session has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 2 (6 pts), loops 1 (nesting depth added 10). 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.
Counts::tally (cognitive 17) cli/src/commands/session_transcript.rs:536— Counts::tally has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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.
TuiSettings::to_json (cognitive 17) tui/src/settings.rs:82— TuiSettings::to_json has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16 (17 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.
FileHandlerModule.scanAlbumDirectories (cognitive 17) mobile/modules/future-file-handler/android/src/main/java/cn/future_os/filehandler/FileHandlerModule.kt:235— FileHandlerModule.scanAlbumDirectories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, 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.
ChoiceCard.ChoiceOptionRow (cognitive 17) desktop/src/features/markdown/renderers/ChoiceCard.tsx:114— ChoiceCard.ChoiceOptionRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 14 (15 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useStreamingMarkdownBlocks.appendSuffixToNode (cognitive 17) desktop/src/features/markdown/useStreamingMarkdownBlocks.ts:39— useStreamingMarkdownBlocks.appendSuffixToNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 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.
useStreamingMarkdownBlocks.useStreamingMarkdownBlocks (cognitive 17) desktop/src/features/markdown/useStreamingMarkdownBlocks.ts:137— useStreamingMarkdownBlocks.useStreamingMarkdownBlocks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 3, error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 3). None of this is in the body itself: all 17 points belong to 7 function literals inside it that branch (lines 157, 141, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SelectMenu.SelectMenu (cognitive 17) desktop/src/components/ui/SelectMenu.tsx:44— SelectMenu.SelectMenu has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, ternaries 6 (7 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 54, 51, 68). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
remotePeerClient.promptRemoteConversation (cognitive 17) desktop/src/features/remote-peer/remotePeerClient.ts:499— remotePeerClient.promptRemoteConversation has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 6, if/else 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.
remotePeerClient.hostWorkspaceRows (cognitive 17) desktop/src/features/remote-peer/remotePeerClient.ts:1294— remotePeerClient.hostWorkspaceRows has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 4, if/else 3 (nesting depth added 2). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 1297). 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.
EnvironmentPage.EnvironmentPage (cognitive 17) desktop/src/features/settings/EnvironmentPage.tsx:25— EnvironmentPage.EnvironmentPage has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 5, error handling 1, if/else 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ModelsPage.ModelsPage (cognitive 17) desktop/src/features/settings/ModelsPage.tsx:10— ModelsPage.ModelsPage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 6, boolean chains 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 37, setProviderVisibility, modelSubtitle, …). 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.
useContextData.useContextData.refreshContext (cognitive 17) desktop/src/components/layout/hooks/useContextData.ts:82— useContextData.useContextData.refreshContext has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 3, error handling 2 (3 pts), ternaries 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.
RunsPanel.RunsPanel (cognitive 17) desktop/src/features/runs/RunsPanel.tsx:50— RunsPanel.RunsPanel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, ternaries 4 (5 pts), boolean chains 4, error handling 2 (nesting depth added 1). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (archiveFinished, a function literal at line 87, a function literal at line 95, …). 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.
useComposerAttachments.useComposerAttachments.attachPastedFiles (cognitive 17) desktop/src/features/agent/composer/useComposerAttachments.ts:111— useComposerAttachments.useComposerAttachments.attachPastedFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), error handling 1 (2 pts), boolean chains 1, 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.
liveRunProjection.upsertStreamingPreview (cognitive 17) desktop/src/features/agent/runtime/liveRunProjection.ts:592— liveRunProjection.upsertStreamingPreview has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 5). Of this number, 11 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
vibeCells.vibeCellsOf (cognitive 17) desktop/src/features/vibe/vibeCells.ts:52— vibeCells.vibeCellsOf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dispatch.dispatchShortcut (cognitive 17) desktop/src/features/keyboard/dispatch.ts:101— dispatch.dispatchShortcut has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, 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.
useRemoteDoneBell.useRemoteDoneBell (cognitive 17) desktop/src/components/layout/hooks/useRemoteDoneBell.ts:22— useRemoteDoneBell.useRemoteDoneBell has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 3. None of this is in the body itself: all 17 points belong to 2 function literals inside it that branch (lines 40, 31). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
errorPresentation.remoteErrorPresentation (cognitive 17) mobile/src/remote/errorPresentation.ts:27— errorPresentation.remoteErrorPresentation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 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.
ReplyBlocks.buildReplyBlocks (cognitive 17) mobile/src/features/chat/messages/ReplyBlocks.tsx:135— ReplyBlocks.buildReplyBlocks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
usePromptOutbox.usePromptOutbox.recoverPendingPrompt (cognitive 17) mobile/src/remote/usePromptOutbox.ts:512— usePromptOutbox.usePromptOutbox.recoverPendingPrompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 531, assertCurrentPairing). 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.
AlbumPickerModal.AlbumPickerModal (cognitive 17) mobile/src/features/chat/components/AlbumPickerModal.tsx:43— AlbumPickerModal.AlbumPickerModal has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 4 (nesting depth added 6). Of this number, 10 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useAttachmentPicker.useAttachmentPicker.chooseFromAlbum (cognitive 17) mobile/src/features/chat/useAttachmentPicker.tsx:104— useAttachmentPicker.useAttachmentPicker.chooseFromAlbum has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, error handling 2, ternaries 1 (2 pts) (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.
useMarkdownImageLoader.useMarkdownImageLoader (cognitive 17) mobile/src/features/chat/useMarkdownImageLoader.ts:30— useMarkdownImageLoader.useMarkdownImageLoader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, error handling 1 (nesting depth added 3). None of this is in the body itself: all 17 points belong to 4 function literals inside it that branch (lines 45, 46, 79, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sessionTree.pageArchivedRows (cognitive 17) mobile/src/screens/sessionTree.ts:412— sessionTree.pageArchivedRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, loops 2 (3 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.
index.graphGeometry (cognitive 17) packages/git-graph/src/index.ts:88— index.graphGeometry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, ternaries 2, boolean chains 1 (nesting depth added 5). None of this is in the body itself: all 17 points belong to 2 function literals inside it that branch (lines 97, 89). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.tokenizeJsonLine (cognitive 17) packages/json-preview/src/index.ts:110— index.tokenizeJsonLine has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 3 (5 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.
projection.turnFromAcc (cognitive 17) packages/thread-projection/src/projection.ts:325— projection.turnFromAcc has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 5, if/else 3, 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.
navigate (cognitive 17) harness/lib/cdp.mjs:376— navigate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (6 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.
groupFindings (cognitive 17) harness/lib/issues-en.mjs:168— groupFindings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), other 4, boolean chains 2, loops 1 (nesting depth added 6). Of this number, 10 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordSender::request (cognitive 16) channels/src/providers/discord.rs:247— DiscordSender::request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 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.
ChromiumPageManager::initialize (cognitive 16) cli/src/browser/chromium/chromium_page.rs:56— ChromiumPageManager::initialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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.
Budget::fit_material (cognitive 16) host/src/fusion/budget.rs:80— Budget::fit_material has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (7 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.
MarkdownTheme::with_partial (cognitive 16) tui/src/components/markdown.rs:306— MarkdownTheme::with_partial has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. 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.
InputSink::plan (cognitive 16) tui/src/terminal.rs:1018— InputSink::plan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 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.
streamingMarkdownBlocks.createStreamingMarkdownProjector (cognitive 16) desktop/src/features/markdown/streamingMarkdownBlocks.ts:114— streamingMarkdownBlocks.createStreamingMarkdownProjector has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 5). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (project, a function literal at line 122, a function literal at line 117). 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.
updatePresentation.updatePresentation (cognitive 16) desktop/src/features/settings/updatePresentation.ts:26— updatePresentation.updatePresentation has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 6 (nesting depth added 6). 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.
mentionDom.serialize::visit (cognitive 16) desktop/src/features/agent/composer/mentionDom.ts:134— mentionDom.serialize::visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, 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.
useComposerAttachments.useComposerAttachments.addAttachmentPaths (cognitive 16) desktop/src/features/agent/composer/useComposerAttachments.ts:28— useComposerAttachments.useComposerAttachments.addAttachmentPaths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (3 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.
Composer.ComposerImpl (cognitive 16) desktop/src/features/agent/Composer.tsx:233— Composer.ComposerImpl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 47 (61 pts), boolean chains 34, ternaries 22 (29 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. This shape REPEATS in the file: one other method here (Composer.ComposerImpl::submitValue) 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.
replyBlocks.buildReplyBlocks (cognitive 16) desktop/src/features/agent/replyBlocks.ts:18— replyBlocks.buildReplyBlocks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), boolean chains 2, ternaries 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.
ReplySteps.ReplySteps (cognitive 16) desktop/src/features/agent/ReplySteps.tsx:11— ReplySteps.ReplySteps has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 2 (nesting depth added 3). Of this number, 9 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
runHistoryProjection.applyRunMetadata (cognitive 16) desktop/src/features/agent/history/runHistoryProjection.ts:21— runHistoryProjection.applyRunMetadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 2, ternaries 2 (nesting depth added 3). Of this number, 12 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
liveRunProjection.updatePendingMessageFromRunEvents (cognitive 16) desktop/src/features/agent/runtime/liveRunProjection.ts:744— liveRunProjection.updatePendingMessageFromRunEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (4 pts), boolean chains 1, error handling 1 (nesting depth added 5). Of this number, 11 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useRunReattach.useRunReattach (cognitive 16) desktop/src/features/agent/useRunReattach.ts:39— useRunReattach.useRunReattach has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 7. None of this is in the body itself: all 16 points belong to 9 function literals inside it that branch (lines 89, 70, 107, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useRemoteApprovals.useRemoteApprovals (cognitive 16) desktop/src/features/remote-peer/useRemoteApprovals.ts:42— useRemoteApprovals.useRemoteApprovals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 3, ternaries 2 (3 pts), error handling 1 (nesting depth added 1). None of this is in the body itself: all 16 points belong to 5 function literals inside it that branch (lines 57, 101, 50, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoteConversationMenu.RemoteConversationMenu (cognitive 16) desktop/src/features/remote-peer/RemoteConversationMenu.tsx:30— RemoteConversationMenu.RemoteConversationMenu has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 4). Of this number, 13 points are the body's own statements and 3 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.
RemoteRenameDialog.RemoteRenameDialog (cognitive 16) desktop/src/features/remote-peer/RemoteRenameDialog.tsx:18— RemoteRenameDialog.RemoteRenameDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 4, if/else 3, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (submit, generate, a function literal at line 101). 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.
RemoteWorkspacesPanel.RemoteWorkspacesPanel (cognitive 16) desktop/src/features/remote-peer/RemoteWorkspacesPanel.tsx:26— RemoteWorkspacesPanel.RemoteWorkspacesPanel has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 3, error handling 2 (nesting depth added 4). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 44, run, a function literal at line 94). 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.
useHasProviders.useHasProviders (cognitive 16) desktop/src/components/layout/hooks/useHasProviders.ts:26— useHasProviders.useHasProviders has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 3 (4 pts) (nesting depth added 1). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, 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.
useRemotePeers.handlePresence (cognitive 16) desktop/src/components/layout/hooks/useRemotePeers.ts:746— useRemotePeers.handlePresence has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 1. Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useUnreadThreads.useUnreadThreads (cognitive 16) desktop/src/components/layout/hooks/useUnreadThreads.ts:42— useUnreadThreads.useUnreadThreads has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4, boolean chains 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to 4 function literals inside it that branch (lines 58, 94, 77, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
fusion.modelStatus (cognitive 16) packages/thread-projection/src/fusion.ts:82— fusion.modelStatus has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (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.
index.html.mdListHtml (cognitive 16) host/web/index.html:1122— index.html.mdListHtml has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (5 pts), ternaries 2 (4 pts), 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.
codeHighlight.highlightCode (cognitive 16) mobile/src/components/codeHighlight.ts:308— codeHighlight.highlightCode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (append, a function literal at line 328). 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.
codePreviewRows.codePreviewRows (cognitive 16) mobile/src/components/codePreviewRows.ts:15— codePreviewRows.codePreviewRows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MarkdownText.MarkdownText (cognitive 16) mobile/src/components/MarkdownText.tsx:503— MarkdownText.MarkdownText has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 541, 532, 510, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useSessionCatalog.useSessionCatalog.observeRunEvent (cognitive 16) mobile/src/remote/useSessionCatalog.ts:100— useSessionCatalog.useSessionCatalog.observeRunEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 5, ternaries 2 (3 pts), error handling 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.
withIosShareExtension.configureProject (cognitive 16) mobile/plugins/withIosShareExtension.js:12— withIosShareExtension.configureProject has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 4 (6 pts), boolean chains 2 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
index.patchLines (cognitive 16) packages/git-graph/src/index.ts:445— index.patchLines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 2). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 453). 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.
RemoteClient.runRecovery (cognitive 16) packages/remote-client/src/client.ts:631— RemoteClient.runRecovery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, error handling 1 (2 pts), 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.
projection.applyLiveEvent (cognitive 16) packages/remote-client/src/projection.ts:837— projection.applyLiveEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, ternaries 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.
SyncEngine.step (cognitive 16) packages/remote-client/src/syncEngine.ts:500— SyncEngine.step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), 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.
Composer.value (cognitive 16) packages/thread-projection/src/cooperativeJson.ts:122— Composer.value has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 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.
runIssuesEn (cognitive 16) harness/lib/issues-en-run.mjs:81— runIssuesEn has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (5 pts), if/else 4, error handling 1 (2 pts), loops 2, other 2, boolean chains 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 1 belongs to 5 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.
Near-duplicate member pair (46 shared lines) agent/src/runtime/scheduler_queue.rs:420— agent/src/runtime/scheduler_queue.rs:420-511 | agent/src/runtime/scheduler_queue.rs:599-687 — 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.
Near-duplicate member pair (40 shared lines) agent/src/session/history/display_index.rs:330— agent/src/session/history/display_index.rs:330-384 | agent/src/session/history/display_index.rs:396-470 — These two members are variants of one another: 40 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (81 corresponding lines) · ×1
Edited copy of a member (81 corresponding lines) tui/src/components/markdown.rs:827— tui/src/components/markdown.rs:827-915 | tui/src/components/markdown.rs:934-1014 — These two members are one piece of code written twice and then edited apart: 81 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding lines) packages/rpc/src/decode.rs:316— packages/rpc/src/decode.rs:316-390 | packages/rpc/src/encode.rs:55-118 — 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 (75 corresponding lines) · ×1
Edited copy of a member (75 corresponding lines) channels/src/dingtalk/mod.rs:59— channels/src/dingtalk/mod.rs:59-139 | channels/src/feishu/mod.rs:40-114 — 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 copy of a member (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) cli/src/commands/pin.rs:138— cli/src/commands/pin.rs:138-197 | cli/src/commands/pin.rs:200-242 — 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 (59 corresponding lines) · ×1
Edited copy of a member (59 corresponding lines) channels/src/providers/mattermost.rs:505— channels/src/providers/mattermost.rs:505-563 | channels/src/providers/slack.rs:721-784 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×1
Edited copy of a member (48 corresponding lines) agent/src/rpc/commands/session_lifecycle.rs:1098— agent/src/rpc/commands/session_lifecycle.rs:1098-1152 | agent/src/rpc/commands/session_lifecycle.rs:1159-1206 — 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 (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) channels/src/dingtalk/dingtalk_rest.rs:36— channels/src/dingtalk/dingtalk_rest.rs:36-75 | channels/src/feishu/feishu_rest.rs:46-92 — 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 (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) cli/src/commands/remote.rs:468— cli/src/commands/remote.rs:468-503 | cli/src/commands/remote_peers.rs:322-359 — 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 (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) agent/src/rpc/commands/providers.rs:430— agent/src/rpc/commands/providers.rs:430-466 | agent/src/rpc/commands/providers.rs:614-661 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) packages/remote-client/src/tasks.rs:68— packages/remote-client/src/tasks.rs:68-99 | packages/remote-server/src/tasks.rs:64-107 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×1
Edited copy of a member (27 corresponding lines) host/src/agent_providers/write.rs:71— host/src/agent_providers/write.rs:71-97 | host/src/agent_providers/write.rs:182-213 — 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 (4 members, 19+ corresponding lines) · ×1
Edited copies of one member (4 members, 19+ corresponding lines) channels/src/feishu/feishu_rest.rs:94— channels/src/feishu/feishu_rest.rs:94-113 | channels/src/feishu/feishu_rest.rs:115-134 | channels/src/feishu/feishu_rest.rs:136-154 | channels/src/feishu/feishu_rest.rs:540-560 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 21+ corresponding lines) · ×1
Edited copies of one member (3 members, 21+ corresponding lines) channels/src/providers/whatsapp.rs:499— channels/src/providers/whatsapp.rs:499-524 | channels/src/providers/whatsapp.rs:527-549 | channels/src/providers/whatsapp.rs:556-576 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 14+ corresponding lines) · ×1
Edited copies of one member (4 members, 14+ corresponding lines) channels/src/feishu/feishu_rest.rs:164— channels/src/feishu/feishu_rest.rs:164-184 | channels/src/feishu/feishu_rest.rs:192-211 | channels/src/feishu/feishu_rest.rs:393-407 | channels/src/feishu/feishu_rest.rs:414-427 — 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 (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) channels/src/grpc_client.rs:161— channels/src/grpc_client.rs:161-177 | orchestration/goal/src/agent_client.rs:228-245 | orchestration/goal/src/agent_client.rs:372-390 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 12+ corresponding lines) · ×1
Edited copies of one member (5 members, 12+ corresponding lines) host/src/store/approvals.rs:106— host/src/store/approvals.rs:106-117 | host/src/store/approvals.rs:122-133 | host/src/store/approvals.rs:173-184 | REDACTED:158-169 | host/src/store/threads.rs:46-57 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×1
Edited copies of one member (3 members, 9+ corresponding lines) agent/src/rpc/commands/settings.rs:372— agent/src/rpc/commands/settings.rs:372-381 | agent/src/rpc/commands/settings.rs:414-423 | agent/src/rpc/commands/settings.rs:428-436 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) desktop/src-tauri/src/commands/debug.rs:25— desktop/src-tauri/src/commands/debug.rs:25-27 | desktop/src-tauri/src/commands/update.rs:1989-1991 — 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· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) agent/src/session/content/compress.rs:34— agent/src/session/content/compress.rs:34-45 | agent/src/session/content/rechunk.rs:30-43 | agent/src/session/content/retire.rs:32-48 | REDACTED:147-153 — 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, 4+ corresponding lines) · ×1
Edited copies of one member (3 members, 4+ corresponding lines) agent/src/session/content/checkpoint_retirement.rs:7— agent/src/session/content/checkpoint_retirement.rs:7-14 | agent/src/session/content/metadata.rs:78-81 | agent/src/session/history/recovery.rs:67-83 — 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) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) agent/src/session/content/metadata.rs:83— agent/src/session/content/metadata.rs:83-87 | agent/src/session/history/display_index.rs:108-115 | agent/src/session/history/recovery.rs:85-94 — 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 (4 members, 4+ corresponding lines) · ×1
Edited copies of one member (4 members, 4+ corresponding lines) agent/src/main.rs:8— agent/src/main.rs:8-11 | channels/src/main.rs:9-12 | cli/src/main.rs:18-21 | tui/src/main.rs:9-12 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (134–145 lines × 2) host/src/git_history.rs:626— host/src/git_history.rs:626-759 | tui/src/workbench/git_panel.rs:320-464 — before extracting anything, compare `host/src/git_history.rs` and `tui/src/workbench/git_panel.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 207 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 `host/src/git_history.rs:626` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29–31 lines × 2) tui/src/workbench/git_panel.rs:608— tui/src/workbench/git_panel.rs:608-638 | tui/src/workbench/git_panel.rs:766-794 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/workbench/git_panel.rs:608` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (45 lines × 2) cli/src/rpc.rs:1686— cli/src/rpc.rs:1686-1730 | tui/src/rpc/grpc_client.rs:1402-1446 — before extracting anything, compare `cli/src/rpc.rs` and `tui/src/rpc/grpc_client.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 83 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 `cli/src/rpc.rs:1686` it begins part-way through the construct above it, so those exact lines 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) agent/src/llm/mod.rs:593— agent/src/llm/mod.rs:593-618 | agent/src/llm/mod.rs:647-672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/llm/mod.rs:593` it begins part-way through the construct above it, so those exact lines 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–26 lines × 2) cli/src/rpc.rs:172— cli/src/rpc.rs:172-197 | tui/src/rpc/grpc_client.rs:1371-1394 — before extracting anything, compare `cli/src/rpc.rs` and `tui/src/rpc/grpc_client.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 83 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 `cli/src/rpc.rs:172` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) packages/remote-client/src/tasks.rs:69— packages/remote-client/src/tasks.rs:69-91 | packages/remote-server/src/tasks.rs:65-87 — before extracting anything, compare `packages/remote-client/src/tasks.rs` and `packages/remote-server/src/tasks.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.
Duplicated block (20–22 lines × 2) agent/src/session/history/display_index.rs:363— agent/src/session/history/display_index.rs:363-382 | agent/src/session/history/display_index.rs:447-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/session/history/display_index.rs:363` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–22 lines × 2) channels/src/feishu/prompt_loop.rs:170— channels/src/feishu/prompt_loop.rs:170-190 | channels/src/feishu/prompt_loop.rs:220-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `channels/src/feishu/prompt_loop.rs:192` calls `from_millis` and `channels/src/feishu/prompt_loop.rs:243` 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 (19–20 lines × 2) channels/src/feishu/bridge.rs:605— channels/src/feishu/bridge.rs:605-624 | channels/src/feishu/bridge.rs:707-725 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/feishu/bridge.rs:605` 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–19 lines × 3) agent/src/tools/mod.rs:733— agent/src/tools/mod.rs:733-751 | host/src/agent_bridge/persist.rs:450-468 | REDACTED:1232-1248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_bridge/persist.rs:450` 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 `command` to `&str` in one and `Option<&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.
Duplicated block (18–19 lines × 2) tui/src/components/markdown.rs:1402— tui/src/components/markdown.rs:1402-1419 | tui/src/components/markdown.rs:1678-1696 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/markdown.rs:1402` it does not close everything it opens, so those 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, `tui/src/components/markdown.rs:1420` calls `is_some`, `Some`, `push` and `tui/src/components/markdown.rs:1697` 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 (16–17 lines × 2) host/src/remote_host/business/git.rs:21— host/src/remote_host/business/git.rs:21-36 | host/src/remote_host/business/git.rs:43-59 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/remote_host/business/git.rs:21` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 2) tui/src/utils.rs:1041— tui/src/utils.rs:1041-1057 | tui/src/utils.rs:1086-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.
Duplicated block (15–16 lines × 2) agent/src/runtime/scheduler_queue.rs:489— agent/src/runtime/scheduler_queue.rs:489-504 | agent/src/runtime/scheduler_queue.rs:666-680 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/runtime/scheduler_queue.rs:489` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14–16 lines × 2) host/src/application/threads.rs:100— host/src/application/threads.rs:100-113 | host/src/application/threads.rs:128-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/application/threads.rs:100` it does not close everything it opens, so those 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 (14–15 lines × 2) agent/src/agent/run_loop.rs:1362— agent/src/agent/run_loop.rs:1362-1375 | agent/src/agent/run_loop.rs:1535-1549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/agent/run_loop.rs:1362` 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–15 lines × 2) channels/src/dingtalk/bridge.rs:456— channels/src/dingtalk/bridge.rs:456-465 | channels/src/feishu/prompt_loop.rs:85-99 — 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 `channels/src/dingtalk/bridge.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 (15 lines × 2) host/src/tasks.rs:575— host/src/tasks.rs:575-589 | host/src/tasks.rs:612-626 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/tasks.rs:575` it does not close everything it opens, so those exact lines 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–14 lines × 2) channels/src/dingtalk/bridge.rs:130— channels/src/dingtalk/bridge.rs:130-138 | channels/src/feishu/bridge.rs:205-218 — `channels/src/dingtalk/bridge.rs` and `channels/src/feishu/bridge.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 33 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `channels/src/dingtalk/bridge.rs:130` 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 first that the copies are not typed on the same thing: the declarations holding them bind `event` to `DingtalkEvent` in one and `FeishuEvent` 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–14 lines × 2) host/src/agent_bridge/reconciliation.rs:559— host/src/agent_bridge/reconciliation.rs:559-572 | host/src/agent_bridge/reconciliation.rs:982-991 — both copies are in the same file, so extract the 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) tui/src/components/markdown.rs:1911— tui/src/components/markdown.rs:1911-1923 | tui/src/components/markdown.rs:1940-1953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/components/markdown.rs:1911` it does not close everything it opens, so those 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, `tui/src/components/markdown.rs:1939` calls `iter`, `enumerate` and `tui/src/components/markdown.rs:1908` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 3) agent/src/agent/run_loop.rs:1435— agent/src/agent/run_loop.rs:1435-1447 | agent/src/agent/run_loop.rs:1494-1506 | agent/src/agent/run_loop.rs:1624-1636 — 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 `agent/src/agent/run_loop.rs:1435` 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–13 lines × 2) agent/src/tools/shell/execution.rs:612— agent/src/tools/shell/execution.rs:612-622 | agent/src/tools/shell/execution.rs:675-687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/tools/shell/execution.rs:612` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–13 lines × 2) tui/src/terminal_posix.rs:317— tui/src/terminal_posix.rs:317-329 | tui/src/terminal_posix.rs:359-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tui/src/terminal_posix.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.
Duplicated block (12 lines × 7) tui/src/index.rs:319— tui/src/index.rs:319-330 | tui/src/index.rs:337-348 | tui/src/index.rs:355-366 | tui/src/index.rs:374-385 | tui/src/index.rs:404-415 | tui/src/index.rs:435-446 | tui/src/index.rs:454-465 — all 7 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 `tui/src/index.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tui/src/index.rs:368` calls `is_empty` and `tui/src/index.rs:332` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–12 lines × 3) REDACTED:414— REDACTED:414-423 | REDACTED:471-480 | REDACTED:512-523 — 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 `REDACTED:414` 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, `REDACTED:511` calls `wake` and `REDACTED:413` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–12 lines × 3) packages/remote-client/src/runtime.rs:3095— packages/remote-client/src/runtime.rs:3095-3106 | packages/remote-client/src/runtime.rs:3269-3279 | packages/remote-client/src/runtime.rs:3442-3452 — 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 `packages/remote-client/src/runtime.rs:3095` it begins part-way through the construct above it, so those 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–12 lines × 2) agent/src/agent/run_loop.rs:1508— agent/src/agent/run_loop.rs:1508-1514 | agent/src/agent/run_loop.rs:1660-1671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/agent/run_loop.rs:1508` it does not close everything it opens, so those exact lines 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) agent/src/rpc/commands/settings.rs:115— agent/src/rpc/commands/settings.rs:115-126 | agent/src/rpc/commands/settings.rs:204-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/rpc/commands/settings.rs:115` it does not close everything it opens, so those exact lines 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–12 lines × 2) REDACTED:170— REDACTED:170-181 | REDACTED:187-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:170` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) channels/src/feishu/feishu_rest.rs:103— channels/src/feishu/feishu_rest.rs:103-113 | channels/src/feishu/feishu_rest.rs:124-134 | channels/src/feishu/feishu_rest.rs:144-154 — 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 `channels/src/feishu/feishu_rest.rs:103` it begins part-way through the construct above it, so those exact lines 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 × 3) host/src/remote_host/business/transfers.rs:18— host/src/remote_host/business/transfers.rs:18-28 | host/src/remote_host/business/transfers.rs:31-40 | host/src/remote_host/business/transfers.rs:71-81 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 2) tui/src/skills_cli.rs:646— tui/src/skills_cli.rs:646-656 | tui/src/subprocess.rs:41-49 — before extracting anything, compare `tui/src/skills_cli.rs` and `tui/src/subprocess.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. 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–10 lines × 3) agent/src/llm/adapters/openai_responses.rs:267— agent/src/llm/adapters/openai_responses.rs:267-275 | agent/src/llm/adapters/openai_responses.rs:288-297 | agent/src/llm/adapters/openai_responses.rs:306-314 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 4) tui/src/index.rs:321— tui/src/index.rs:321-330 | tui/src/index.rs:339-348 | tui/src/index.rs:357-366 | tui/src/index.rs:418-426 — 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 `tui/src/index.rs:321` it begins part-way through the construct above it, so those 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, `tui/src/index.rs:368` calls `is_empty` and `tui/src/index.rs:332` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 3) channels/src/feishu/prompt_loop.rs:442— channels/src/feishu/prompt_loop.rs:442-449 | channels/src/feishu/prompt_loop.rs:500-506 | channels/src/feishu/prompt_loop.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channels/src/feishu/prompt_loop.rs:440` calls `as_deref`, `Some`, `is_some` and `channels/src/feishu/prompt_loop.rs:499` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 4) channels/src/feishu/feishu_rest.rs:102— channels/src/feishu/feishu_rest.rs:102-109 | channels/src/feishu/feishu_rest.rs:123-130 | channels/src/feishu/feishu_rest.rs:143-150 | channels/src/feishu/feishu_rest.rs:550-556 — 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 `channels/src/feishu/feishu_rest.rs:102` it begins part-way through the construct above it, so those exact lines 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 × 4) REDACTED:353— REDACTED:353-360 | REDACTED:417-422 | REDACTED:474-479 | REDACTED:515-522 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:417` it begins part-way through the construct above it, so those 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 (4–6 lines × 3) cli/src/commands/mcp_servers.rs:398— cli/src/commands/mcp_servers.rs:398-403 | cli/src/commands/mcp_servers.rs:663-666 | cli/src/commands/mcp_servers.rs:776-781 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cli/src/commands/mcp_servers.rs:403` calls `start` and `cli/src/commands/mcp_servers.rs:666` 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–7 lines × 2) host/src/agent_bridge/session.rs:137— host/src/agent_bridge/session.rs:137-142 | host/src/agent_bridge/session.rs:312-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `host/src/agent_bridge/session.rs:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (4–5 lines × 3) tui/src/workbench/live.rs:2031— tui/src/workbench/live.rs:2031-2034 | tui/src/workbench/live.rs:2571-2575 | tui/src/workbench/live.rs:2585-2590 — 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 `tui/src/workbench/live.rs:2571` it begins part-way through the construct above it, so those exact lines 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) channels/src/providers/linq.rs:116— channels/src/providers/linq.rs:116-123 | channels/src/providers/telegram.rs:110-117 | channels/src/providers/wecom.rs:125-132 | channels/src/providers/whatsapp.rs:113-120 — before extracting anything, compare `channels/src/providers/linq.rs` and `channels/src/providers/whatsapp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 7) cli/src/commands/home.rs:183— cli/src/commands/home.rs:183-188 | cli/src/commands/task.rs:346-351 | host/src/agent_bridge/observer.rs:208-213 | REDACTED:315-320 | host/src/tasks.rs:44-49 | host/src/tasks/service.rs:26-31 | tui/src/workbench/live.rs:5289-5294 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times.
Duplicated block (14 lines × 3) channels/src/feishu/bridge.rs:610— channels/src/feishu/bridge.rs:610-624 | channels/src/feishu/bridge.rs:712-725 | channels/src/feishu/bridge.rs:808-823 — 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 `channels/src/feishu/bridge.rs:610` it begins part-way through the construct above it, so those exact lines 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) channels/src/feishu/feishu_ws.rs:339— channels/src/feishu/feishu_ws.rs:339-344 | channels/src/feishu/feishu_ws.rs:347-352 | channels/src/feishu/feishu_ws.rs:355-360 | channels/src/feishu/feishu_ws.rs:374-381 | channels/src/feishu/feishu_ws.rs:564-570 — 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 `channels/src/feishu/feishu_ws.rs:339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `channels/src/feishu/feishu_ws.rs:337` calls `or_else`, `get` and `channels/src/feishu/feishu_ws.rs:345` 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 (4–5 lines × 4) agent/src/session/sqlite_store/transcript.rs:237— agent/src/session/sqlite_store/transcript.rs:237-241 | orchestration/fusion/src/store.rs:437-440 | orchestration/fusion/src/store.rs:451-455 | orchestration/fusion/src/store.rs:487-491 — 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 `agent/src/session/sqlite_store/transcript.rs:237` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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· Edited copy of a member (57 corresponding lines) · ×1
Edited copy of a member (57 corresponding lines) agent/src/sandbox/windows/acl.rs:61— agent/src/sandbox/windows/acl.rs:61-117 | agent/src/sandbox/windows/acl.rs:157-214 — 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.
Duplicated block (31 lines × 2) agent/src/sandbox/windows/acl.rs:87— agent/src/sandbox/windows/acl.rs:87-117 | agent/src/sandbox/windows/acl.rs:184-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `agent/src/sandbox/windows/acl.rs:87` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–10 lines × 2) scripts/measure/measure-lean-history.py:129— scripts/measure/measure-lean-history.py:129-138 | scripts/measure/verify-e2e-bytes.py:202-207 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8–9 lines × 3) scripts/perf/remote-commands/scale/summarize_scaling.py:335— scripts/perf/remote-commands/scale/summarize_scaling.py:335-343 | scripts/perf/remote-commands/scale/summarize_scaling.py:355-363 | scripts/perf/remote-commands/scale/summarize_scaling.py:374-381 — 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–8 lines × 4) scripts/screenshots/capture.py:767— scripts/screenshots/capture.py:767-773 | scripts/screenshots/capture.py:882-889 | scripts/screenshots/capture.py:1042-1048 | scripts/screenshots/capture.py:1102-1108 — 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/screenshots/capture.py:774` calls `ffmpeg_path` and `scripts/screenshots/capture.py:891` 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–7 lines × 3) scripts/screenshots/capture.py:1045— scripts/screenshots/capture.py:1045-1051 | scripts/screenshots/capture.py:1105-1110 | scripts/screenshots/capture.py:1331-1336 — 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 (3–6 lines × 3) scripts/screenshots/tui_terminal.py:696— scripts/screenshots/tui_terminal.py:696-701 | scripts/screenshots/tui_terminal.py:793-795 | scripts/screenshots/tui_terminal.py:832-838 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/screenshots/tui_terminal.py:694` calls `screen_from_stream`, `check`, `join` and `scripts/screenshots/tui_terminal.py:792` 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.
Duplication concentrated across 5 sibling directories (73 clone groups) desktop/src/features/settings/CustomProviderDialog.tsx:130— 73 duplicated blocks under the repository root have copies in at least two of the sibling directories desktop, harness, mobile, packages, scripts — 54 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 73 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 73 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 73 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 14 sibling directories (44 clone groups) desktop/src/features/agent/agentQueue.ts:133— 44 duplicated blocks under desktop/src/features/ have copies in at least two of the sibling directories agent, artifacts, filepreview, filetree, keyboard, markdown (+8 more sibling(s) not listed) — 21 of them are reported below, and 23 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 44 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 44 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 44 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 9 sibling directories (39 clone groups) mobile/src/i18n/LanguageSettings.tsx:17— 39 duplicated blocks under mobile/src/ have copies in at least two of the sibling directories components, features, i18n, lib, notifications, remote (+3 more sibling(s) not listed) — 13 of them are reported below, and 26 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 39 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 39 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 39 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 4 sibling directories (26 clone groups) desktop/src/components/layout/ArchiveGuideBubble.tsx:34— 26 duplicated blocks under desktop/src/ have copies in at least two of the sibling directories components, features, integrations, lib — 13 of them are reported below, and 13 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 26 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 26 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 26 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (147 matched lines × 2 locations) · ×1
Duplicated block with local edits (147 matched lines × 2 locations) mobile/src/features/settings/DateField.tsx:10— mobile/src/features/settings/DateField.tsx:10 · mobile/src/features/settings/TimeField.tsx:10 — the two spans are one implementation copied and then locally edited — 1059 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (132 matched lines × 2 locations) · ×1
Duplicated block with local edits (132 matched lines × 2 locations) desktop/src/features/agent/agentQueue.ts:133— desktop/src/features/agent/agentQueue.ts:133 · desktop/src/features/remote-peer/remoteQueue.ts:123 — the two spans are one implementation copied and then locally edited — 987 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (90 matched lines × 2 locations) · ×1
Duplicated block with local edits (90 matched lines × 2 locations) desktop/src/features/settings/CustomProviderDialog.tsx:130— desktop/src/features/settings/CustomProviderDialog.tsx:130 · mobile/src/features/settings/CustomProviderPage.tsx:176 — the two spans are one implementation copied and then locally edited — 595 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (86 matched lines × 2 locations) · ×1
Duplicated block with local edits (86 matched lines × 2 locations) scripts/measure/measure-sync-browser.ts:19— scripts/measure/measure-sync-browser.ts:19 · scripts/measure/measure-sync-snapshot.ts:21 — the two spans are one implementation copied and then locally edited — 917 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (78 matched lines × 2 locations) · ×1
Duplicated block with local edits (78 matched lines × 2 locations) desktop/src/features/remote-peer/RemoteProvidersPanel.tsx:47— desktop/src/features/remote-peer/RemoteProvidersPanel.tsx:47 · desktop/src/features/remote-peer/RemoteWorkspacesPanel.tsx:41 — the two spans are one implementation copied and then locally edited — 456 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (60 lines × 2 locations) desktop/shot/mock/data.ts:919— desktop/shot/mock/data.ts:919 · mobile/shot/mock/data.ts:363 — the 2 copies are spread across 2 files, 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.
R10 · Code Duplication· Duplicated block with local edits (58 matched lines × 2 locations) · ×1
Duplicated block with local edits (58 matched lines × 2 locations) desktop/src/components/layout/recentOrder.ts:115— desktop/src/components/layout/recentOrder.ts:115 · mobile/src/screens/recentRows.ts:98 — the two spans are one implementation copied and then locally edited — 399 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (53 matched lines × 2 locations) · ×1
Duplicated block with local edits (53 matched lines × 2 locations) mobile/src/features/chat/components/SendChoiceSheet.tsx:47— mobile/src/features/chat/components/SendChoiceSheet.tsx:47 · mobile/src/features/chat/components/SessionUsageSheet.tsx:75 — the two spans are one implementation copied and then locally edited — 360 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (48 matched lines × 2 locations) · ×1
Duplicated block with local edits (48 matched lines × 2 locations) desktop/src/features/remote-peer/RemoteFilesDialog.tsx:52— desktop/src/features/remote-peer/RemoteFilesDialog.tsx:52 · desktop/src/features/remote-peer/useRemoteFiles.ts:120 — the two spans are one implementation copied and then locally edited — 209 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (46 matched lines × 2 locations) · ×1
Duplicated block with local edits (46 matched lines × 2 locations) mobile/src/i18n/LanguageSettings.tsx:17— mobile/src/i18n/LanguageSettings.tsx:17 · mobile/src/theme/AppearanceSettings.tsx:32 — the two spans are one implementation copied and then locally edited — 339 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (41 matched lines × 2 locations) · ×1
Duplicated block with local edits (41 matched lines × 2 locations) desktop/src/features/remote-peer/remoteReasoning.ts:24— desktop/src/features/remote-peer/remoteReasoning.ts:24 · desktop/src/features/remote-peer/remoteToolTarget.ts:22 — the two spans are one implementation copied and then locally edited — 273 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (39 matched lines × 2 locations) · ×1
Duplicated block with local edits (39 matched lines × 2 locations) desktop/src/features/remote-peer/remoteSessionReference.ts:157— desktop/src/features/remote-peer/remoteSessionReference.ts:157 · mobile/src/features/chat/sessionCompletion.ts:42 — the two spans are one implementation copied and then locally edited — 331 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (38 matched lines × 2 locations) · ×1
Duplicated block with local edits (38 matched lines × 2 locations) desktop/src/features/tasks/TasksView.tsx:182— desktop/src/features/tasks/TasksView.tsx:182 · mobile/src/features/settings/TasksSettingsPage.tsx:335 — the two spans are one implementation copied and then locally edited — 265 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (37 matched lines × 2 locations) · ×1
Duplicated block with local edits (37 matched lines × 2 locations) desktop/src/features/agent/composer/choiceAnswer.ts:66— desktop/src/features/agent/composer/choiceAnswer.ts:66 · mobile/src/features/chat/choiceAnswer.ts:41 — the two spans are one implementation copied and then locally edited — 343 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (35 lines × 2 locations) desktop/src/features/remote-peer/RemotePeersView.tsx:601— desktop/src/features/remote-peer/RemotePeersView.tsx:601 · desktop/src/features/remote-peer/RemoteRenameDialog.tsx:72 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (34 matched lines × 2 locations) · ×1
Duplicated block with local edits (34 matched lines × 2 locations) desktop/src/features/agent/runtime/liveRunProjection.ts:594— desktop/src/features/agent/runtime/liveRunProjection.ts:594 · desktop/src/features/agent/runtime/liveRunProjection.ts:746 — the two spans are one implementation copied and then locally edited — 219 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (30 matched lines × 2 locations) · ×1
Duplicated block with local edits (30 matched lines × 2 locations) desktop/src/features/remote-peer/mergeConversations.ts:409— desktop/src/features/remote-peer/mergeConversations.ts:409 · packages/remote-client/src/catalogDelta.ts:20 — the two spans are one implementation copied and then locally edited — 165 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (30 lines × 2 locations) desktop/src/lib/fontSize.ts:51— desktop/src/lib/fontSize.ts:51 · desktop/src/lib/replyDisplay.ts:45 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (28 lines × 2 locations) desktop/src/components/layout/ActivityRail.tsx:2474— desktop/src/components/layout/ActivityRail.tsx:2474 · desktop/src/components/layout/ActivityRail.tsx:2539 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (27 matched lines × 2 locations) · ×1
Duplicated block with local edits (27 matched lines × 2 locations) desktop/src/features/agent/composer/useComposerAttachments.ts:77— desktop/src/features/agent/composer/useComposerAttachments.ts:77 · desktop/src/features/agent/composer/useComposerAttachments.ts:140 — the two spans are one implementation copied and then locally edited — 259 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (26 matched lines × 2 locations) · ×1
Duplicated block with local edits (26 matched lines × 2 locations) desktop/src/features/agent/replyBlocks.ts:18— desktop/src/features/agent/replyBlocks.ts:18 · mobile/src/features/chat/messages/ReplyBlocks.tsx:135 — the two spans are one implementation copied and then locally edited — 185 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function runCase (cyclomatic 149, cognitive 235) harness/lib/run.mjs:82— runCase has cyclomatic complexity 149 and cognitive complexity 235; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function processEvent (cyclomatic 127, cognitive 223) REDACTED:225— processEvent has cyclomatic complexity 127 and cognitive complexity 223; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ActivityRail (cyclomatic 124, cognitive 119) desktop/src/components/layout/ActivityRail.tsx:276— ActivityRail has cyclomatic complexity 124 and cognitive complexity 119; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ReadyAppShell (cyclomatic 99, cognitive 89) desktop/src/components/layout/AppShell.tsx:152— ReadyAppShell has cyclomatic complexity 99 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function machineSurface (cyclomatic 84, cognitive 83) mobile/src/remote/RemoteContext.tsx:564— machineSurface has cyclomatic complexity 84 and cognitive complexity 83; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function MessageBlockImpl (cyclomatic 83, cognitive 77) desktop/src/features/agent/MessageBlock.tsx:78— MessageBlockImpl has cyclomatic complexity 83 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SessionsScreen (cyclomatic 77, cognitive 72) mobile/src/screens/SessionsScreen.tsx:98— SessionsScreen has cyclomatic complexity 77 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runCliCase (cyclomatic 76, cognitive 131) harness/lib/cli-driver.mjs:99— runCliCase has cyclomatic complexity 76 and cognitive complexity 131; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function TimelineCardView (cyclomatic 75, cognitive 132) mobile/src/features/chat/messages/TimelineCard.tsx:43— TimelineCardView has cyclomatic complexity 75 and cognitive complexity 132; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readRunReplay (cyclomatic 69, cognitive 88) packages/thread-projection/src/replay.ts:262— readRunReplay has cyclomatic complexity 69 and cognitive complexity 88; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ChatScreen (cyclomatic 67, cognitive 56) mobile/src/features/chat/ChatScreen.tsx:72— ChatScreen has cyclomatic complexity 67 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function renderRow (cyclomatic 64, cognitive 63) mobile/src/screens/SessionList.tsx:997— renderRow has cyclomatic complexity 64 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ComposerDockView (cyclomatic 60, cognitive 37) mobile/src/features/chat/components/ComposerDock.tsx:37— ComposerDockView has cyclomatic complexity 60 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.
Complex function AgentThread (cyclomatic 59, cognitive 55) desktop/src/features/agent/AgentThread.tsx:188— AgentThread has cyclomatic complexity 59 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function RemoteComposer (cyclomatic 57, cognitive 49) desktop/src/features/remote-peer/RemoteComposer.tsx:230— RemoteComposer has cyclomatic complexity 57 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function VibeStage (cyclomatic 56, cognitive 55) desktop/src/features/vibe/VibeStage.tsx:147— VibeStage has cyclomatic complexity 56 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SessionList (cyclomatic 55, cognitive 52) mobile/src/screens/SessionList.tsx:182— SessionList has cyclomatic complexity 55 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function writeReport (cyclomatic 53, cognitive 91) harness/lib/report.mjs:41— writeReport has cyclomatic complexity 53 and cognitive complexity 91; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function UpdatePage (cyclomatic 53, cognitive 43) desktop/src/features/settings/UpdatePage.tsx:28— UpdatePage has cyclomatic complexity 53 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function main (cyclomatic 52, cognitive 89) · ×1
Complex function main (cyclomatic 52, cognitive 89) harness/cli.mjs:54— main has cyclomatic complexity 52 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ContextPanel (cyclomatic 48, cognitive 41) desktop/src/components/layout/ContextPanel.tsx:91— ContextPanel has cyclomatic complexity 48 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ArtifactDetailPanel (cyclomatic 47, cognitive 35) desktop/src/features/artifacts/ArtifactDetailPanel.tsx:41— ArtifactDetailPanel has cyclomatic complexity 47 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runReconcile (cyclomatic 46, cognitive 63) packages/remote-client/src/syncEngine.ts:571— runReconcile has cyclomatic complexity 46 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 46, cognitive 47) mobile/src/remote/useTimelineController.ts:277— (anonymous) has cyclomatic complexity 46 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function PendingApprovalCard (cyclomatic 45, cognitive 43) mobile/src/features/chat/messages/PendingApprovalCard.tsx:36— PendingApprovalCard has cyclomatic complexity 45 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function TerminalPanelShell (cyclomatic 45, cognitive 40) desktop/src/features/terminal/TerminalPanel.tsx:100— TerminalPanelShell has cyclomatic complexity 45 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ComposerControls (cyclomatic 45, cognitive 34) desktop/src/features/agent/composer/ComposerControls.tsx:104— ComposerControls has cyclomatic complexity 45 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function remote_peer_request (cyclomatic 45, cognitive 21) desktop/shot/mock/backend.ts:1525— remote_peer_request has cyclomatic complexity 45 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 sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runSendPipeline (cyclomatic 44, cognitive 67) desktop/src/features/agent/sendPipeline.ts:74— runSendPipeline has cyclomatic complexity 44 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function applyEvent (cyclomatic 44, cognitive 46) packages/remote-client/src/projection.ts:516— applyEvent has cyclomatic complexity 44 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 is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function analyzeRun (cyclomatic 42, cognitive 57) harness/lib/analyze.mjs:850— analyzeRun has cyclomatic complexity 42 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function TaskForm (cyclomatic 42, cognitive 41) mobile/src/features/settings/TasksSettingsPage.tsx:664— TaskForm has cyclomatic complexity 42 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function RemoteProvider (cyclomatic 42, cognitive 40) mobile/shot/mock/RemoteContext.tsx:197— RemoteProvider has cyclomatic complexity 42 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function applyOps (cyclomatic 41, cognitive 74) packages/remote-client/src/syncEngine.ts:874— applyOps has cyclomatic complexity 41 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleKeyDown (cyclomatic 41, cognitive 52) desktop/src/features/agent/MentionEditor.tsx:802— handleKeyDown has cyclomatic complexity 41 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function deterministicFindings (cyclomatic 38, cognitive 46) harness/lib/analyze.mjs:135— deterministicFindings has cyclomatic complexity 38 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 is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function turnFromAcc (cyclomatic 37, cognitive 40) packages/thread-projection/src/projection.ts:325— turnFromAcc has cyclomatic complexity 37 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function affected (cyclomatic 36, cognitive 66) scripts/ci/affected.mjs:42— affected has cyclomatic complexity 36 and cognitive complexity 66; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 36, cognitive 62) packages/remote-client/src/client.ts:1260— (anonymous) has cyclomatic complexity 36 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function AppShellDialogs (cyclomatic 36, cognitive 34) desktop/src/components/layout/AppShellDialogs.tsx:88— AppShellDialogs has cyclomatic complexity 36 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· desktop/src/components/layout/ActivityRail.tsx · ×1
desktop/src/components/layout/ActivityRail.tsx: 2780 lines of code desktop/src/components/layout/ActivityRail.tsx:1— desktop/src/components/layout/ActivityRail.tsx has 2780 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/components/layout/AppShell.tsx · ×1
desktop/src/components/layout/AppShell.tsx: 2462 lines of code desktop/src/components/layout/AppShell.tsx:1— desktop/src/components/layout/AppShell.tsx has 2462 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
desktop/shot/mock/data.ts: 2054 lines of code desktop/shot/mock/data.ts:1— desktop/shot/mock/data.ts has 2054 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/screens/SessionList.tsx · ×1
mobile/src/screens/SessionList.tsx: 1863 lines of code mobile/src/screens/SessionList.tsx:1— mobile/src/screens/SessionList.tsx has 1863 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/remote-client/src/client.ts · ×1
packages/remote-client/src/client.ts: 1852 lines of code packages/remote-client/src/client.ts:1— packages/remote-client/src/client.ts has 1852 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/shot/mock/backend.ts · ×1
desktop/shot/mock/backend.ts: 1695 lines of code desktop/shot/mock/backend.ts:1— desktop/shot/mock/backend.ts has 1695 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/remote-peer/RemoteComposer.tsx · ×1
desktop/src/features/remote-peer/RemoteComposer.tsx: 1661 lines of code desktop/src/features/remote-peer/RemoteComposer.tsx:1— desktop/src/features/remote-peer/RemoteComposer.tsx has 1661 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/screens/SessionsScreen.tsx · ×1
mobile/src/screens/SessionsScreen.tsx: 1580 lines of code mobile/src/screens/SessionsScreen.tsx:1— mobile/src/screens/SessionsScreen.tsx has 1580 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/vibe/VibeStage.tsx · ×1
desktop/src/features/vibe/VibeStage.tsx: 1450 lines of code desktop/src/features/vibe/VibeStage.tsx:1— desktop/src/features/vibe/VibeStage.tsx has 1450 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/remote-peer/remotePeerClient.ts · ×1
desktop/src/features/remote-peer/remotePeerClient.ts: 1448 lines of code desktop/src/features/remote-peer/remotePeerClient.ts:1— desktop/src/features/remote-peer/remotePeerClient.ts has 1448 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/remote/RemoteContext.tsx · ×1
mobile/src/remote/RemoteContext.tsx: 1401 lines of code mobile/src/remote/RemoteContext.tsx:1— mobile/src/remote/RemoteContext.tsx has 1401 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/remote-client/src/syncEngine.ts · ×1
packages/remote-client/src/syncEngine.ts: 1321 lines of code packages/remote-client/src/syncEngine.ts:1— packages/remote-client/src/syncEngine.ts has 1321 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/remote-client/src/projection.ts · ×1
packages/remote-client/src/projection.ts: 1205 lines of code packages/remote-client/src/projection.ts:1— packages/remote-client/src/projection.ts has 1205 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/features/settings/TasksSettingsPage.tsx · ×1
mobile/src/features/settings/TasksSettingsPage.tsx: 1204 lines of code mobile/src/features/settings/TasksSettingsPage.tsx:1— mobile/src/features/settings/TasksSettingsPage.tsx has 1204 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/features/chat/ChatScreen.tsx · ×1
mobile/src/features/chat/ChatScreen.tsx: 1186 lines of code mobile/src/features/chat/ChatScreen.tsx:1— mobile/src/features/chat/ChatScreen.tsx has 1186 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1127 lines of code REDACTED:1— REDACTED has 1127 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/agent/AgentThread.tsx · ×1
desktop/src/features/agent/AgentThread.tsx: 1116 lines of code desktop/src/features/agent/AgentThread.tsx:1— desktop/src/features/agent/AgentThread.tsx has 1116 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/remote-peer/mergeConversations.ts · ×1
desktop/src/features/remote-peer/mergeConversations.ts: 1059 lines of code desktop/src/features/remote-peer/mergeConversations.ts:1— desktop/src/features/remote-peer/mergeConversations.ts has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/tasks/TasksView.tsx · ×1
desktop/src/features/tasks/TasksView.tsx: 1056 lines of code desktop/src/features/tasks/TasksView.tsx:1— desktop/src/features/tasks/TasksView.tsx has 1056 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
mobile/src/remote/files.ts: 1047 lines of code mobile/src/remote/files.ts:1— mobile/src/remote/files.ts has 1047 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/agent/MentionEditor.tsx · ×1
desktop/src/features/agent/MentionEditor.tsx: 1045 lines of code desktop/src/features/agent/MentionEditor.tsx:1— desktop/src/features/agent/MentionEditor.tsx has 1045 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
harness/lib/analyze.mjs: 1036 lines of code harness/lib/analyze.mjs:1— harness/lib/analyze.mjs has 1036 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/components/layout/hooks/useThreadStore.ts · ×1
desktop/src/components/layout/hooks/useThreadStore.ts: 1008 lines of code desktop/src/components/layout/hooks/useThreadStore.ts:1— desktop/src/components/layout/hooks/useThreadStore.ts has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
mobile/shot/mock/data.ts: 989 lines of code mobile/shot/mock/data.ts:1— mobile/shot/mock/data.ts has 989 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/agent/Composer.tsx · ×1
desktop/src/features/agent/Composer.tsx: 979 lines of code desktop/src/features/agent/Composer.tsx:1— desktop/src/features/agent/Composer.tsx has 979 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/components/layout/hooks/useRemotePeers.ts · ×1
desktop/src/components/layout/hooks/useRemotePeers.ts: 975 lines of code desktop/src/components/layout/hooks/useRemotePeers.ts:1— desktop/src/components/layout/hooks/useRemotePeers.ts has 975 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/remote-peer/useRemoteTimeline.ts · ×1
desktop/src/features/remote-peer/useRemoteTimeline.ts: 974 lines of code desktop/src/features/remote-peer/useRemoteTimeline.ts:1— desktop/src/features/remote-peer/useRemoteTimeline.ts has 974 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/remote/useTimelineController.ts · ×1
mobile/src/remote/useTimelineController.ts: 961 lines of code mobile/src/remote/useTimelineController.ts:1— mobile/src/remote/useTimelineController.ts has 961 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 958 lines of code REDACTED:1— REDACTED has 958 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/remote/useSessionCatalog.ts · ×1
mobile/src/remote/useSessionCatalog.ts: 918 lines of code mobile/src/remote/useSessionCatalog.ts:1— mobile/src/remote/useSessionCatalog.ts has 918 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/remote/useDesktopConnection.ts · ×1
mobile/src/remote/useDesktopConnection.ts: 877 lines of code mobile/src/remote/useDesktopConnection.ts:1— mobile/src/remote/useDesktopConnection.ts has 877 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/shot/mock/RemoteContext.tsx · ×1
mobile/shot/mock/RemoteContext.tsx: 821 lines of code mobile/shot/mock/RemoteContext.tsx:1— mobile/shot/mock/RemoteContext.tsx has 821 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/markdown/src/parseFutureMarkdown.ts · ×1
packages/markdown/src/parseFutureMarkdown.ts: 812 lines of code packages/markdown/src/parseFutureMarkdown.ts:1— packages/markdown/src/parseFutureMarkdown.ts has 812 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/remote-peer/RemoteConversationView.tsx · ×1
desktop/src/features/remote-peer/RemoteConversationView.tsx: 792 lines of code desktop/src/features/remote-peer/RemoteConversationView.tsx:1— desktop/src/features/remote-peer/RemoteConversationView.tsx has 792 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/skills/SkillsView.tsx · ×1
desktop/src/features/skills/SkillsView.tsx: 763 lines of code desktop/src/features/skills/SkillsView.tsx:1— desktop/src/features/skills/SkillsView.tsx has 763 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/agent/runtime/liveRunProjection.ts · ×1
desktop/src/features/agent/runtime/liveRunProjection.ts: 758 lines of code desktop/src/features/agent/runtime/liveRunProjection.ts:1— desktop/src/features/agent/runtime/liveRunProjection.ts has 758 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· mobile/src/components/MarkdownText.tsx · ×1
mobile/src/components/MarkdownText.tsx: 755 lines of code mobile/src/components/MarkdownText.tsx:1— mobile/src/components/MarkdownText.tsx has 755 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/settings/CustomProviderDialog.tsx · ×1
desktop/src/features/settings/CustomProviderDialog.tsx: 742 lines of code desktop/src/features/settings/CustomProviderDialog.tsx:1— desktop/src/features/settings/CustomProviderDialog.tsx has 742 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/runs/RunInspectPanel.tsx · ×1
desktop/src/features/runs/RunInspectPanel.tsx: 719 lines of code desktop/src/features/runs/RunInspectPanel.tsx:1— desktop/src/features/runs/RunInspectPanel.tsx has 719 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· desktop/src/features/remote/RemoteView.tsx · ×1
desktop/src/features/remote/RemoteView.tsx: 708 lines of code desktop/src/features/remote/RemoteView.tsx:1— desktop/src/features/remote/RemoteView.tsx has 708 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~439 LoC) scripts/screenshots/injects/choice-card-lib.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~234 LoC) scripts/screenshots/injects/choice-card-mobile-lib.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~96 LoC) scripts/screenshots/injects/choice-card-v3-queue-desktop.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~88 LoC) scripts/screenshots/injects/choice-card-v3-queue-mobile.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~34 LoC) harness/scripts/file-issues.mjs— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~30 LoC) scripts/screenshots/injects/qn-nav-c-counter.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~25 LoC) scripts/screenshots/injects/qn-nav-b-latest.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~24 LoC) scripts/screenshots/injects/qn-nav-a-stacked.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~20 LoC) harness/mobile-client/shims/expo-secure-store.mjs— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~18 LoC) scripts/screenshots/injects/user-bubble-border-off.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~12 LoC) scripts/screenshots/injects/qn-state-idle.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~7 LoC) scripts/screenshots/injects/choice-card-a-chosen.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2 LoC) scripts/screenshots/injects/choice-card-m-empty.js— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~1 LoC) desktop/src/features/markdown/localPath.ts— no import path from any entry point (389 application, 57 tooling, 702 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Benchmark script nothing runs (~139 LoC) scripts/skill_reco/bench/check-parity.mjs— This script imports the product ('../roster.mjs'), so it is an authored benchmark, not measurement input — but nothing invokes it: no package.json script, no CI workflow or build recipe, no Dockerfile, no other file under scripts/skill_reco/bench/, and no in-repo reference to its name at all. It runs only if someone remembers to type `node scripts/skill_reco/bench/check-parity.mjs`, and it silently rots against the API it measures. Wire it into a script or workflow the way its wired siblings are, or delete it.
Unused dependency 'expo-system-ui' mobile/package.json:35— Declared in mobile/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'fflate' mobile/package.json:37— Declared in mobile/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Mock-dominated test: foreground attempts immediately, then retries at 1s, 2s, 4s without network events packages/remote-client/tests/client.test.ts:348— This test sets up 3 test doubles (for example `jest.spyOn`) against 1 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: network-restored accelerates backoff and does not leave a duplicate retry packages/remote-client/tests/client.test.ts:370— This test sets up 3 test doubles (for example `jest.spyOn`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: network notifications during a pending retry share the same connection attempt packages/remote-client/tests/client.test.ts:387— This test sets up 3 test doubles (for example `jest.spyOn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: revoked credentials stop foreground retries and ignore later network recovery packages/remote-client/tests/client.test.ts:421— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: initial timeout rejects a late credential result packages/remote-client/tests/client.test.ts:436— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: credential refresh pending does not retire the serving event subscription packages/remote-client/tests/client.test.ts:447— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: changing the visible session reinstalls only a selective subscription packages/remote-client/tests/client.test.ts:743— This test sets up 3 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a live subscription that dies while a replacement is opening is not retried twice packages/remote-client/tests/client.test.ts:977— This test sets up 3 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a pairing revoked while the replacement was activating is never published packages/remote-client/tests/client.test.ts:1070— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 3 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: an authorization failure on the status stream is recorded and ends the loop packages/remote-client/tests/client.test.ts:1515— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a protocol failure on the status stream retires the generation packages/remote-client/tests/client.test.ts:1533— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a revoked pairing is not rotated again by the refresh timer packages/remote-client/tests/client.test.ts:1548— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a reconnect whose handshake fails retires that generation instead of claiming ready packages/remote-client/tests/client.test.ts:1590— This test sets up 3 test doubles (for example `jest.spyOn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a presence callback that tears the client down during handshaking cancels the ready announcement packages/remote-client/tests/client.test.ts:1603— This test sets up 3 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: an expired-JWT broker error rotates the token instead of giving up packages/remote-client/tests/client.test.ts:1649— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a revoked refresh token stops the client and asks the user to re-pair packages/remote-client/tests/client.test.ts:1663— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 2 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a retryable refresh failure backs off instead of spinning on the old token packages/remote-client/tests/client.test.ts:1679— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a token rotation that does not help turns into a terminal service failure packages/remote-client/tests/client.test.ts:1711— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a presence frame from another bridge forces a fresh handshake packages/remote-client/tests/client.test.ts:1890— This test sets up 3 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a presence frame with an unreadable payload is ignored, not fatal packages/remote-client/tests/client.test.ts:1913— This test sets up 3 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: rotated credentials are persisted before the socket is used packages/remote-client/tests/client.test.ts:1932— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a revoked device is reported as revoked and stops dialling packages/remote-client/tests/client.test.ts:1947— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a misconfigured service is fatal and stops every timer packages/remote-client/tests/client.test.ts:1976— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a socket that outlives its attempt is closed instead of being installed packages/remote-client/tests/client.test.ts:2001— This test sets up 3 test doubles (for example `jest.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a token refused before this pairing ever served traffic fails the client instead of retrying packages/remote-client/tests/client.test.ts:2147— This test sets up 5 test doubles (for example `jest.spyOn`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Duplicated predicate desktop/src/features/agent/composer/choiceAnswer.ts:134— `!Array.isArray(options) || options.length === 0 || !Array.isArray(selectedIds)` appears character-identically in 2 files — desktop/src/features/agent/composer/choiceAnswer.ts, mobile/src/features/chat/choiceAnswer.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/components/layout/hooks/useThreadDialogs.ts:190— `!deleteDialog || deleteDialog.submitting` appears character-identically in 2 files — desktop/src/components/layout/hooks/useThreadDialogs.ts, desktop/src/components/layout/hooks/useWorkspaceDialogs.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/composerDraft.ts:51— `!parsed || typeof parsed !== "object" || parsed.version !== DRAFT_VERSION` appears character-identically in 3 files — desktop/src/features/agent/composerDraft.ts, desktop/src/features/remote-peer/remoteComposerDraft.ts, mobile/src/remote/draftStorage.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/runtime/liveRunProjection.ts:709— `!projection.content.trim() && projection.activityItems.length === 0 && projection.segments.length === 0 && !projection.reconnecting` appears character-identically in 2 files — desktop/src/features/agent/runtime/liveRunProjection.ts, desktop/src/features/remote-peer/remoteRunStreams.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/remote-peer/remoteSessionReference.ts:162— `!taken[base] || taken[base]!.sessionId === target.sessionId` appears character-identically in 2 files — desktop/src/features/remote-peer/remoteSessionReference.ts, mobile/src/features/chat/sessionCompletion.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate mobile/src/features/chat/ChatScreen.tsx:417— `!text.trim() && attachments.length === 0` appears character-identically in 3 files — mobile/src/features/chat/ChatScreen.tsx, mobile/src/remote/usePromptOutbox.ts, packages/remote-client/src/projection.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/ApprovalPrompt.tsx:173— `(event.metaKey || event.ctrlKey) && event.key === "Enter"` appears character-identically in 2 files — desktop/src/features/agent/ApprovalPrompt.tsx, scripts/skill_reco/public/app.js. 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 harness/lib/analyze.mjs:61— `Array.isArray(model.modalities) && model.modalities.includes("image")` appears character-identically in 2 files — harness/lib/analyze.mjs, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate mobile/src/features/chat/ChatScreen.tsx:988— `Platform.OS === "android" && keyboardHeight > 0` appears character-identically in 2 files — mobile/src/features/chat/ChatScreen.tsx, mobile/src/features/settings/SettingsScreen.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate harness/lib/remote-cn.mjs:40— `String(text).replace(/[^\w\u4e00-\u9fa5-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "case"` appears character-identically in 3 files — harness/lib/remote-cn.mjs, harness/lib/remote-live.mjs, harness/lib/remote-mobile-live.mjs. 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 desktop/src/features/agent/ApprovalPrompt.tsx:60— `action?.category === "windows_write_capability" || action?.category === "file_permissions"` appears character-identically in 2 files — desktop/src/features/agent/ApprovalPrompt.tsx, mobile/src/features/chat/messages/PendingApprovalCard.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/components/layout/OnboardingGate.tsx:281— `activeId === "test" || activeId === "production"` appears character-identically in 2 files — desktop/src/components/layout/OnboardingGate.tsx, desktop/src/features/settings/EnvironmentPage.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/components/layout/hooks/useRemotePeers.ts:887— `at === undefined || session.lastMessageAt === at` appears character-identically in 2 files — desktop/src/components/layout/hooks/useRemotePeers.ts, mobile/src/remote/useSessionCatalog.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/Composer.tsx:901— `attachment.kind === "image" && !supportsImages` appears character-identically in 2 files — desktop/src/features/agent/Composer.tsx, mobile/src/features/chat/components/ComposerDock.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/agentQueue.ts:140— `attachment.path.split(/[\\/]/).pop() || attachment.path` appears character-identically in 3 files — desktop/src/features/agent/agentQueue.ts, desktop/src/features/remote-peer/remoteQueue.ts, mobile/src/remote/sessionQueue.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/replyBlocks.ts:74— `block.kind === "segment" && block.segment.kind === "text"` appears character-identically in 3 files — desktop/src/features/agent/replyBlocks.ts, mobile/src/features/chat/messages/ReplyBlocks.tsx, mobile/src/features/chat/messages/TimelineCard.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/replyBlocks.ts:97— `block.kind === "segment" && block.segment.kind === "text" && block.segment.text.trim().length > 0` appears character-identically in 2 files — desktop/src/features/agent/replyBlocks.ts, mobile/src/features/chat/messages/ReplyBlocks.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/Composer.tsx:320— `build.data?.isRelease === false && fusionAvailable` appears character-identically in 2 files — desktop/src/features/agent/Composer.tsx, desktop/src/features/remote-peer/RemoteComposer.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/agent/agentQueue.ts:401— `cancelled || threadRef.current !== threadId` appears character-identically in 2 files — desktop/src/features/agent/agentQueue.ts, desktop/src/features/terminal/useTerminalTabs.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/markdown/src/remarkLatexMath.ts:58— `code === -5 || code === -4 || code === -3` appears character-identically in 2 files — packages/markdown/src/remarkLatexMath.ts, packages/markdown/src/remarkMathFence.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/markdown/src/remarkLatexMath.ts:62— `code === 32 || code === -2 || code === -1` appears character-identically in 2 files — packages/markdown/src/remarkLatexMath.ts, packages/markdown/src/remarkMathFence.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/settings/CustomProviderDialog.tsx:202— `current && (key === undefined || current.key === key)` appears character-identically in 2 files — desktop/src/features/settings/CustomProviderDialog.tsx, mobile/src/features/settings/CustomProviderPage.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate harness/lib/remote-live.mjs:100— `current === null || current === undefined` appears character-identically in 2 files — harness/lib/remote-live.mjs, harness/lib/remote-mobile-live.mjs. 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 mobile/src/features/chat/sessionCompletion.ts:14— `cursor !== end || cursor < 0 || cursor > text.length` appears character-identically in 2 files — mobile/src/features/chat/sessionCompletion.ts, mobile/src/features/chat/skillCompletion.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate desktop/src/features/remote-peer/RemoteConversationMenu.tsx:203— `disabled && "cursor-not-allowed opacity-50"` appears character-identically in 2 files — desktop/src/features/remote-peer/RemoteConversationMenu.tsx, desktop/src/features/remote-peer/RemoteWorkspaceMenu.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default on Err agent/src/rpc/run_snapshot.rs:74— `strip_repeated_tool_arguments` turns every `Err` into `true` — 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 channels/src/providers/telegram.rs:490— `load_offset` 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 cli/src/browser/chromium/chromium_session.rs:279— `evaluate_expression` turns every `Err` into `T::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 cli/src/browser/chromium/chromium_session.rs:957— `evaluate` turns every `Err` into `"null".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 cli/src/axi.rs:228— `bin_path` turns every `Err` into `"future".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 cli/src/commands/archive.rs:305— `streaming_thread_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 cli/src/commands/home.rs:122— `tasks_line` turns every `Err` into `"none — Run `future task add`".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 cli/src/commands/session_journal.rs:121— `number` 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 cli/src/commands/session_status.rs:107— `number` 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 cli/src/commands/tools.rs:1311— `example_flags` 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 host/src/agent_bridge/observer.rs:288— `reconcile_streaming_observers` turns every `Err` into `Ok(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 host/src/agent_host.rs:155— `launch_mode` turns every `Err` into `"auto".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err host/src/remote/control.rs:621— `requests` 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 REDACTED:756— `read_events_from_disk` turns every `Err` into `vec![]` — 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 host/src/terminal/pty.rs:361— `session_members_via_ps` 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 orchestration/goal/src/store.rs:1496— `backups` turns every `Err` into `vec![]` — 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 orchestration/goal/src/console.rs:6729— `worker_stop_requested` turns every `Err` into `false` — 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 orchestration/goal/src/console.rs:7834— `scan_worker_sessions` turns every `Err` into `vec![]` — 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 orchestration/goal/src/webui/api.rs:645— `scan_active_runs` 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 packages/remote-client/src/runtime.rs:2266— `hosts_due_for_rotation` 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 packages/rpc/src/encode.rs:212— `approval_card_to_proto` turns every `Err` into `"null".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 tui/src/workbench/preferences.rs:475— `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 tui/src/paste.rs:859— `sweep_stale_clipboard_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 tui/src/workbench/files.rs:422— `read_head` 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 in catch desktop/scripts/stabilize-dist-mtimes.mjs:43— `readState` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/keyboard/shortcuts.ts:73— `read` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/fusion/FusionStepBody.tsx:147— `publicAnswer` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/integrations/agent/agentStateCache.ts:548— `listStreamingThreadIds` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/agent/runtime/runProjectionUtils.ts:76— `safeListRunEvents` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/agent/buildReferencePrompt.ts:30— `buildReferenceContext` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/vibe/vibePreferences.ts:71— `readOrder` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/vibe/vibePreferences.ts:133— `readPanelMap` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/tasks/timezoneChoice.ts:190— `timezoneOffsetMinutes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/features/terminal/useTerminalPanel.ts:70— `loadPrefs` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/components/layout/hooks/useThreadDialogs.ts:453— `runningMembers` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch desktop/src/components/layout/hooks/useThreadDialogs.ts:475— `runningInTrees` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch harness/lib/analyze.mjs:786— `discoverCase` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch scripts/version.mjs:128— `gitShortHash` swallows every exception into `return "unknown"` — 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.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×8
Projects may be oversized for their cohesion agent/Cargo.toml:1— `agent` (145083 LoC, 404 module-visible types across 37 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion host/Cargo.toml:1— `host` (126843 LoC, 332 module-visible types across 18 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion tui/Cargo.toml:1— `tui` (103756 LoC, 248 module-visible types across 4 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion cli/Cargo.toml:1— `cli` (85937 LoC, 183 module-visible types across 9 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion desktop/package.json:1— `desktop` (83785 LoC, 825 module-visible types across 40 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion mobile/package.json:1— `mobile` (45864 LoC, 339 module-visible types across 21 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion channels/Cargo.toml:1— `channels` (39695 LoC, 182 module-visible types across 6 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Projects may be oversized for their cohesion package.json:1— `(repository root)` (33890 LoC, 170 module-visible types across 23 directories) overshoots its size bounds. 8 of 32 build unit(s) (Cargo, Gradle, npm) overshoot their size bounds, lowering Project Cohesion to 5.0/10. 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.
Subsumed condition operand tui/src/components/chat_area.rs:785— `line.starts_with("@@ ")` can never decide this `||` — every value satisfying `line.starts_with("@@ ")` also satisfies `line.starts_with("@@")`, 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/screenshots/injects/choice-card-v3-queue-mobile.js:82— `text.startsWith("[next]")` can never decide this `||` — every value satisfying `text.startsWith("[next]")` also satisfies `text.startsWith("[")`, 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/screenshots/injects/choice-card-v3-queue-mobile.js:82— `text.startsWith("[future-goal]")` can never decide this `||` — every value satisfying `text.startsWith("[future-goal]")` also satisfies `text.startsWith("[")`, 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 cli/src/browser/discovery.rs:137— `lower.contains("msedge")` can never decide this `||` — every value satisfying `lower.contains("msedge")` also satisfies `lower.contains("edge")`, 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 cli/src/browser/safari/safari_manager.rs:368— `lower.contains("allow remote automation")` can never decide this `||` — every value satisfying `lower.contains("allow remote automation")` also satisfies `lower.contains("remote automation")`, 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 cli/src/browser/chromium/chromium_endpoint.rs:153— `browser.contains("edge")` can never decide this `||` — every value satisfying `browser.contains("edge")` also satisfies `browser.contains("edg")`, 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 agent/tests/service_startup.rs:446— `error.contains("Agent failed to stop")` can never decide this `||` — every value satisfying `error.contains("Agent failed to stop")` also satisfies `error.contains("failed to stop")`, 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.
M2 · Architecture documentation· Architecture diagram out of date · ×6
Architecture diagram out of date docs/architecture/fusion.md:160— `docs/architecture/fusion.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-tasks`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
Architecture diagram out of date docs/architecture/headless-package-development.md:59— `docs/architecture/headless-package-development.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-channel`, `future-tui`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
Architecture diagram out of date docs/architecture/headless-package-development.zh-CN.md:59— `docs/architecture/headless-package-development.zh-CN.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-channel`, `future-tui`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
Architecture diagram out of date docs/architecture/remote-package-development.md:47— `docs/architecture/remote-package-development.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-agent`, `future-channel`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
Architecture diagram out of date docs/guide/ci.md:108— `docs/guide/ci.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-fusion`, `future-config`, `future-http`, `future-logging`, `future-relay-endpoint`, `@future-os/git-graph`, `@future-os/peer-icons`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
Architecture diagram out of date docs/guide/ci.zh-CN.md:88— `docs/guide/ci.zh-CN.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `future-fusion`, `future-config`, `future-http`, `future-logging`, `future-relay-endpoint`, `@future-os/git-graph`, `@future-os/peer-icons`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 254 significant file(s) lose their only recent owner: orchestration/goal/src/console.rs, host/src/remote/tests.rs, cli/src/commands/browser_tools.rs, cli/src/commands/session.rs, cli/src/commands/task.rs, tui/src/components/markdown.rs, cli/src/commands/mcp_servers.rs, host/src/remote/verify_e2e.rs (+246 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 38 significant file(s) lose their only recent owner: host/src/agent_bridge/persist.rs, agent/src/tools/shell/execution.rs, agent/src/approval_review/evidence.rs, desktop/src/features/runs/RunInspectPanel.tsx, desktop/src/components/layout/OnboardingGate.tsx, host/src/store/artifacts.rs, desktop/src/features/settings/ProvidersPage.tsx, host/src/store/approvals.rs (+30 more). Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (294 single-owned of 1339 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1339 of the 1720 production source files in this repository met that bar). They are anonymized user #3 (1 file(s)), anonymized user #4 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: channels/src/dingtalk/dingtalk_ws.rs, desktop/src/features/terminal/client.ts.
D21 · Naming Consistency· `toJSON` spells `JSON` where 17 names in the project spell it `Json` · ×1
`toJSON` spells `JSON` where 17 names in the project spell it `Json` desktop/shot/mock/core.ts:26— 17 of 18 names in project future-os spell the token `Json` (17 of 18; unit: names in project future-os containing `Json`). Peers: JsonPreview.VirtualJsonLines (desktop/src/features/filepreview/JsonPreview.tsx:90); useRemoteApprovals.readJson (desktop/src/features/remote-peer/useRemoteApprovals.ts:153); useRemoteTimeline.readJson (desktop/src/features/remote-peer/useRemoteTimeline.ts:995); pairing.responseJson (mobile/src/remote/pairing.ts:46); packages.json-preview.src.FormattedJsonPreview (packages/json-preview/src/index.ts:11). Rename to `toJson`. [rule N6]
D28 · Secrets (history)· Rotate the exposed credentials · ×1
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `docs/design/workspace-thread-archive-and-paging.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
Logging is not universal — Only 6/13 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `desktop`, `orchestration/goal`, `packages/remote-server` and 2 more.
No dependency-update automation desktop/package.json:19— `desktop/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`.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety REDACTED:211— Deployment is orchestrated by compose, but no service declares a `healthcheck:` and nothing pins a previous image to fall back to — the runtime can tell that the container is up, not that it is serving, so a bad release is harder to detect and reverse.
R7 · Dead Code· Unused export 'RemotePromptOutbox' · ×1
Unused export 'RemotePromptOutbox' desktop/src/features/remote-peer/remotePromptOutbox.ts:115— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'KEY_PROBE_GESTURE' · ×1
Unused export 'KEY_PROBE_GESTURE' desktop/src/features/vibe/keyProbe.ts:24— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'NEW_CONVERSATION_DRAFT_KEY' · ×1
Unused export 'NEW_CONVERSATION_DRAFT_KEY' mobile/src/remote/draftStorage.ts:45— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused module-local declaration 'mergeByModel' · ×1
Unused module-local declaration 'mergeByModel' harness/lib/issues-en-run.mjs:30— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Nullable reference types not enabled everywhere — 0/1 NRT-eligible project(s) enable <Nullable>enable</Nullable> (projects targeting a pre-C#-8 framework are excluded — NRTs aren't available there). NRTs catch a whole class of null-deref bugs at compile time.
Skipped (documented): (unnamed test) desktop/src/features/terminal/TerminalView.frames.test.tsx:107— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) desktop/src/features/terminal/TerminalView.keys.test.tsx:54— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) desktop/src/features/terminal/TerminalView.lifecycle.test.tsx:138— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
doc comments repeat the names desktop/src/features/vibe/vibeQueue.ts:40— 0 of 3 documented parameters and 1 of 3207 summaries in `@futureos/desktop` only repeat the member or parameter name (e.g. "What `cancel` did." for `CancelResult`). Delete the restating tags, or add what the name does not say.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 10 file(s) — `desktop/src/components/layout/ActivityRail.tsx`, `desktop/src/components/layout/ContextPanel.tsx`, `desktop/src/features/markdown/useCodeHighlighter.ts`, `mobile/modules/future-share-intent/extension/ShareViewController.swift`, `mobile/src/remote/RemoteContext.tsx`, … (+5 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1e57c-db5c-7c0c-aee4-75cf0bafef27 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 161 · Warnings: 2995 · Recommendations: 220 · Info: 4 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 16-11-2026 @ 17:52 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.